val append_among_gvars_s2_only_preserves_write_buffer_lists_match_except_global_variables
      (vs: list var_id_t)
      (write_buffer1 write_buffer2: list write_message_t)
      (write_message: write_message_t)
    : Lemma
      (requires
        write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
          (remove_global_variables_from_write_buffer vs write_buffer2) /\
        pointer_among_global_variables vs write_message.location)
      (ensures
        (let write_buffer2' = FStar.List.Tot.append write_buffer2 [write_message] in
          write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
            (remove_global_variables_from_write_buffer vs write_buffer2')))
val append_among_gvars_s2_only_preserves_write_buffer_lists_match_except_global_variables
      (vs: list var_id_t)
      (write_buffer1 write_buffer2: list write_message_t)
      (write_message: write_message_t)
    : Lemma
      (requires
        write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
          (remove_global_variables_from_write_buffer vs write_buffer2) /\
        pointer_among_global_variables vs write_message.location)
      (ensures
        (let write_buffer2' = FStar.List.Tot.append write_buffer2 [write_message] in
          write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
            (remove_global_variables_from_write_buffer vs write_buffer2')))
let append_among_gvars_s2_only_preserves_write_buffer_lists_match_except_global_variables
  (vs: list var_id_t)
  (write_buffer1: list write_message_t)
  (write_buffer2: list write_message_t)
  (write_message: write_message_t)
  : Lemma (requires   write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
                        (remove_global_variables_from_write_buffer vs write_buffer2)
                    /\ pointer_among_global_variables vs write_message.location)
          (ensures  (let write_buffer2' = FStar.List.Tot.append write_buffer2 [write_message] in
                     write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
                       (remove_global_variables_from_write_buffer vs write_buffer2'))) =
  pointer_among_gvars_implies_gvars_addressed vs write_message.location;
  append_effect_on_remove_global_variables_from_write_buffer_list vs write_buffer2 write_message
module Strategies.GlobalVars.VarIntro

open Armada.Base
open Armada.BinaryOp
open Armada.Computation
open Armada.Expression
open Armada.Init
open Armada.Memory
open Armada.Pointer
open Armada.State
open Armada.Statement
open Armada.Thread
open Armada.Type
open Armada.UnaryOp
open FStar.Sequence.Ambient
open FStar.Sequence.Base
open Spec.List
open Spec.Ubool
open Strategies.ArmadaInvariant.PositionsValid
open Strategies.ArmadaInvariant.RootsMatch
open Strategies.GlobalVars
open Strategies.GlobalVars.Pointer
open Strategies.GlobalVars.Unaddressed
open Strategies.GlobalVars.Util
open Strategies.PCRelation
open Util.Seq
open Util.Trigger

let rec pointer_among_gvars_implies_gvars_addressed
  (vs: list var_id_t)
  (p: Armada.Pointer.t)
  : Lemma (requires pointer_among_global_variables vs p)
          (ensures  not (global_variables_unaddressed_in_pointer vs p)) =
  match p with
  | PointerUninitialized -> ()
  | PointerNull -> ()
  | PointerRoot root_id -> ()
  | PointerField struct_ptr _ -> pointer_among_gvars_implies_gvars_addressed vs struct_ptr
  | PointerIndex array_ptr _ -> pointer_among_gvars_implies_gvars_addressed vs array_ptr
/
Util.Trigger.fst.checked Util.Seq.fsti.checked Strategies.PCRelation.fst.checked Strategies.GlobalVars.Util.fst.checked Strategies.GlobalVars.Unaddressed.fst.checked Strategies.GlobalVars.Pointer.fst.checked Strategies.GlobalVars.fst.checked Strategies.ArmadaInvariant.RootsMatch.fst.checked Strategies.ArmadaInvariant.PositionsValid.fsti.checked Spec.Ubool.fst.checked Spec.Map.fst.checked Spec.List.fst.checked prims.fst.checked FStar.Sequence.Base.fsti.checked FStar.Sequence.Ambient.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.Classical.Sugar.fsti.checked Armada.UnaryOp.fst.checked Armada.Type.fst.checked Armada.Threads.fst.checked Armada.Thread.fst.checked Armada.Statement.fst.checked Armada.State.fst.checked Armada.Pointer.fst.checked Armada.Memory.fst.checked Armada.Init.fst.checked Armada.Expression.fst.checked Armada.Computation.fst.checked Armada.BinaryOp.fst.checked Armada.Base.fst.checked
Strategies.GlobalVars.VarIntro.fst

    vs: Prims.list Armada.Base.var_id_t ->
    write_buffer1: Prims.list Armada.Thread.write_message_t ->
    write_buffer2: Prims.list Armada.Thread.write_message_t ->
    write_message: Armada.Thread.write_message_t
  -> FStar.Pervasives.Lemma
      (requires
        Strategies.PCRelation.write_buffers_match (Strategies.GlobalVars.remove_global_variables_from_write_buffer
              vs
              write_buffer1)
          (Strategies.GlobalVars.remove_global_variables_from_write_buffer vs write_buffer2) /\
        Strategies.GlobalVars.VarIntro.pointer_among_global_variables vs
          (Mkwrite_message_t?.location write_message))
      (ensures
        (let write_buffer2' = write_buffer2 @ [write_message] in
          Strategies.PCRelation.write_buffers_match (Strategies.GlobalVars.remove_global_variables_from_write_buffer
                vs
                write_buffer1)
            (Strategies.GlobalVars.remove_global_variables_from_write_buffer vs write_buffer2')))
Prims.list Armada.Base.var_id_t Armada.Thread.write_message_t Strategies.GlobalVars.Pointer.append_effect_on_remove_global_variables_from_write_buffer_list Prims.unit Strategies.GlobalVars.VarIntro.pointer_among_gvars_implies_gvars_addressed Armada.Thread.__proj__Mkwrite_message_t__item__location Prims.l_and Strategies.PCRelation.write_buffers_match Strategies.GlobalVars.remove_global_variables_from_write_buffer Prims.b2t Strategies.GlobalVars.VarIntro.pointer_among_global_variables Prims.squash FStar.List.Tot.Base.append Prims.Cons Prims.Nil FStar.Pervasives.pattern
let append_among_gvars_s2_only_preserves_write_buffer_lists_match_except_global_variables
      (vs: list var_id_t)
      (write_buffer1 write_buffer2: list write_message_t)
      (write_message: write_message_t)
    : Lemma
      (requires
        write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
          (remove_global_variables_from_write_buffer vs write_buffer2) /\
        pointer_among_global_variables vs write_message.location)
      (ensures
        (let write_buffer2' = FStar.List.Tot.append write_buffer2 [write_message] in
          write_buffers_match (remove_global_variables_from_write_buffer vs write_buffer1)
            (remove_global_variables_from_write_buffer vs write_buffer2'))) =
  
pointer_among_gvars_implies_gvars_addressed vs write_message.location;
append_effect_on_remove_global_variables_from_write_buffer_list vs write_buffer2 write_message