val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info)
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let
    (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
    Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list
    (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==>
    Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs))))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
    norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\
    Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc
    (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap
    ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers
    ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized
    ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint ==
    (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\
    heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
    {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some
    (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs
    ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet
    h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length
    #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index
    #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout
    va_sM (va_update_ok va_sM va_s0))))
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
  va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
  let (va_old_s:va_state) = va_s0 in
  va_ins_lemma (Ins (S.Ghost ())) va_s0;
  let (va_sM, va_fM) = va_eval_ins (Ins (S.Ghost ())) va_s0 in
  let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
  Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
  let va_sM = create_heaplets_this buffers va_sM in
  Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers (Vale.PPC64LE.Decls.from_heap_impl
    (va_old_s.ms_heap));
  Vale.PPC64LE.State.use_machine_state_equal ();
  (va_sM, va_fM)
val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info)
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let
    (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
    Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list
    (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==>
    Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs))))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
    norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\
    Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc
    (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap
    ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers
    ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized
    ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint ==
    (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\
    heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
    {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some
    (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs
    ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet
    h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length
    #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index
    #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout
    va_sM (va_update_ok va_sM va_s0))))
let va_lemma_CreateHeaplets va_b0 va_s0 buffers =
va_reveal_opaque (`%va_code_CreateHeaplets) (va_code_CreateHeaplets ());
let va_old_s:va_state = va_s0 in
va_ins_lemma (Ins (S.Ghost ())) va_s0;
let va_sM, va_fM = va_eval_ins (Ins (S.Ghost ())) va_s0 in
let bs:(FStar.Seq.Base.seq buffer_info) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
Vale.Lib.Seqs.lemma_list_to_seq #buffer_info buffers;
let va_sM = create_heaplets_this buffers va_sM in
Vale.PPC64LE.Memory_Sems.lemma_create_heaplets buffers
  (Vale.PPC64LE.Decls.from_heap_impl (va_old_s.ms_heap));
Vale.PPC64LE.State.use_machine_state_equal ();
(va_sM, va_fM)
Vale.PPC64LE.InsMem.fst.checked
Vale.PPC64LE.StateLemmas.fsti.checked Vale.PPC64LE.State.fsti.checked Vale.PPC64LE.Semantics_s.fst.checked Vale.PPC64LE.Memory_Sems.fsti.checked Vale.PPC64LE.Machine_s.fst.checked Vale.PPC64LE.InsBasic.fsti.checked Vale.PPC64LE.Decls.fst.checked Vale.PPC64LE.Decls.fst.checked Vale.Lib.Seqs.fsti.checked Vale.Arch.HeapImpl.fsti.checked Vale.Arch.Heap.fsti.checked prims.fst.checked FStar.Seq.Base.fsti.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked
Vale.PPC64LE.InsMem.fst
Vale.PPC64LE.Decls.va_code Vale.PPC64LE.Decls.va_state Prims.list Vale.Arch.HeapImpl.buffer_info Vale.PPC64LE.State.state Vale.PPC64LE.Lemmas.fuel FStar.Pervasives.Native.Mktuple2 Vale.PPC64LE.Decls.va_fuel Prims.unit Vale.PPC64LE.State.use_machine_state_equal Vale.PPC64LE.Memory_Sems.lemma_create_heaplets Vale.PPC64LE.Decls.from_heap_impl Vale.PPC64LE.Machine_s.__proj__Mkstate__item__ms_heap Vale.PPC64LE.Machine_s.state Vale.PPC64LE.InsMem.create_heaplets_this Vale.Lib.Seqs.lemma_list_to_seq FStar.Seq.Base.seq Vale.Lib.Seqs.list_to_seq FStar.Pervasives.Native.tuple2 Prims.nat Vale.PPC64LE.Decls.va_eval_ins Vale.PPC64LE.Machine_s.Ins Vale.PPC64LE.Semantics_s.ins Vale.PPC64LE.Semantics_s.ocmp Vale.PPC64LE.Semantics_s.Ghost Vale.PPC64LE.Decls.va_ins_lemma Vale.PPC64LE.Decls.ins Vale.PPC64LE.Decls.ocmp Vale.PPC64LE.Decls.va_reveal_opaque Vale.PPC64LE.InsMem.va_code_CreateHeaplets
module Vale.PPC64LE.InsMem
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.State
open Vale.PPC64LE.StateLemmas
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.Arch.Heap
open Vale.Arch.HeapImpl
module S = Vale.PPC64LE.Semantics_s

friend Vale.PPC64LE.Decls
#reset-options "--initial_fuel 2 --max_fuel 2 --max_ifuel 2 --z3rlimit 20"
let create_heaplets_this (buffers:list buffer_info) (s:state) : GTot state =
  {s with ms_heap = Vale.PPC64LE.Memory_Sems.create_heaplets buffers s.ms_heap}

let destroy_heaplets_this (s:state) : Ghost state
  (requires state_inv s)
  (ensures fun _ -> True)
  =
  {s with ms_heap = Vale.PPC64LE.Memory_Sems.destroy_heaplets s.ms_heap}
//-- CreateHeaplets

[@ "opaque_to_smt"]
let va_code_CreateHeaplets () =
  (Ins (S.Ghost ()))

[@ "opaque_to_smt"]
let va_codegen_success_CreateHeaplets () =
  (va_ttrue ())

[@"opaque_to_smt"]
val va_lemma_CreateHeaplets : va_b0:va_code -> va_s0:va_state -> buffers:(list buffer_info)
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_CreateHeaplets ()) va_s0 /\ va_get_ok va_s0 /\ (let
    (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
    Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (norm_list
    (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) ==>
    Vale.PPC64LE.Memory.init_heaplets_req (va_get_mem va_s0) bs))))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (bs:(FStar.Seq.Base.seq buffer_info)) = Vale.Lib.Seqs.list_to_seq #buffer_info buffers in
    norm_list (Vale.Lib.Seqs.list_to_seq_post #buffer_info buffers bs 0) /\
    Vale.PPC64LE.Memory.layout_modifies_loc ((va_get_mem_layout va_sM).vl_inner) == norm_loc
    (Vale.PPC64LE.Memory.loc_mutable_buffers buffers) /\ Vale.PPC64LE.Memory.layout_old_heap
    ((va_get_mem_layout va_sM).vl_inner) == va_get_mem va_s0 /\ Vale.PPC64LE.Memory.layout_buffers
    ((va_get_mem_layout va_sM).vl_inner) == bs /\ Vale.PPC64LE.Memory.layout_heaplets_initialized
    ((va_get_mem_layout va_sM).vl_inner) /\ (va_get_mem_layout va_sM).vl_taint ==
    (va_get_mem_layout va_s0).vl_taint /\ create_post (va_get_mem_layout va_sM) bs /\
    heaplet_id_is_none (va_get_mem va_sM) /\ (forall (h:heaplet_id) .
    {:pattern(trigger_create_heaplet h)}trigger_create_heaplet h ==> heaplet_id_is_some
    (Vale.PPC64LE.Decls.va_get_mem_heaplet h va_sM) h /\ Vale.PPC64LE.Memory.heaps_match bs
    ((va_get_mem_layout va_sM).vl_taint) (va_get_mem va_sM) (Vale.PPC64LE.Decls.va_get_mem_heaplet
    h va_sM) h) /\ (forall (i:nat) . {:pattern(Seq.index bs i)}i < FStar.Seq.Base.length
    #buffer_info bs ==> Vale.PPC64LE.Memory.buffer_info_has_id bs i ((FStar.Seq.Base.index
    #Vale.Arch.HeapImpl.buffer_info bs i).bi_heaplet))) /\ va_state_eq va_sM (va_update_mem_layout
    va_sM (va_update_ok va_sM va_s0))))

    va_b0: Vale.PPC64LE.Decls.va_code ->
    va_s0: Vale.PPC64LE.Decls.va_state ->
    buffers: Prims.list Vale.Arch.HeapImpl.buffer_info
  -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)