Skip to content
Snippets Groups Projects
Commit 76b67715 authored by Yusuke Matsushita's avatar Yusuke Matsushita
Browse files

Minor tweaks

parent e1ad0cb4
No related branches found
No related tags found
No related merge requests found
Pipeline #63461 passed
...@@ -12,8 +12,7 @@ Section vec_pushpop. ...@@ -12,8 +12,7 @@ Section vec_pushpop.
Definition vec_push {𝔄} (ty: type 𝔄) : val := Definition vec_push {𝔄} (ty: type 𝔄) : val :=
fn: ["v"; "x"] := fn: ["v"; "x"] :=
let: "v'" := !"v" in delete [ #1; "v"];; let: "v'" := !"v" in delete [ #1; "v"];;
vec_push_core ty ["v'"; "x"];; vec_push_core ty ["v'"; "x"];; delete [ #ty.(ty_size); "x"];;
delete [ #ty.(ty_size); "x"];;
let: "r" := new [ #0] in return: ["r"]. let: "r" := new [ #0] in return: ["r"].
Lemma vec_push_type {𝔄} (ty: type 𝔄) : Lemma vec_push_type {𝔄} (ty: type 𝔄) :
...@@ -40,9 +39,8 @@ Section vec_pushpop. ...@@ -40,9 +39,8 @@ Section vec_pushpop.
iCombine "⧖u ⧖x" as "#⧖". wp_seq. iCombine "⧖u ⧖x" as "#⧖". wp_seq.
wp_apply (wp_vec_push_core with "[↦l ↦tys ↦ex † ↦ty]"). { iExists _, _. iFrame. } wp_apply (wp_vec_push_core with "[↦l ↦tys ↦ex † ↦ty]"). { iExists _, _. iFrame. }
iIntros "(%&%& ↦ & ↦tys & ↦ex & † & (%& %Len & ↦x))". wp_seq. iIntros "(%&%& ↦ & ↦tys & ↦ex & † & (%& %Len & ↦x))". wp_seq.
rewrite freeable_sz_full. rewrite freeable_sz_full. wp_apply (wp_delete with "[$↦x †x]"); [lia|by rewrite Len|].
wp_apply (wp_delete with "[$↦x †x]"); [lia|by rewrite Len|]. iIntros "_". iIntros "_". wp_seq. set vπ' := λ π, (lapply (vsnoc aπl ) π, π ξ).
wp_seq. set vπ' := λ π, (lapply (vsnoc aπl ) π, π ξ).
iMod (uniq_update with "UNIQ Vo Pc") as "[Vo Pc]"; [done|]. iMod (uniq_update with "UNIQ Vo Pc") as "[Vo Pc]"; [done|].
iMod ("ToBor" with "[↦ ↦tys ↦ex † Pc]") as "[Bor α]". iMod ("ToBor" with "[↦ ↦tys ↦ex † Pc]") as "[Bor α]".
{ iNext. iExists _, _. rewrite split_mt_vec. iFrame "⧖ Pc". { iNext. iExists _, _. rewrite split_mt_vec. iFrame "⧖ Pc".
...@@ -146,7 +144,6 @@ Section vec_pushpop. ...@@ -146,7 +144,6 @@ Section vec_pushpop.
have ->: last_error (lapply aπl π) = Some (vlast aπl π). have ->: last_error (lapply aπl π) = Some (vlast aπl π).
{ inv_vec aπl=> + aπl'. by elim aπl'=>/= *. } { inv_vec aπl=> + aπl'. by elim aπl'=>/= *. }
have ->: removelast (lapply aπl π) = lapply (vinit aπl) π. have ->: removelast (lapply aπl π) = lapply (vinit aπl) π.
{ inv_vec aπl=> + aπl'. elim aπl'; [done|]=>/= *. by f_equal. } { inv_vec aπl=> + aπl'. elim aπl'; [done|]=>/= *. by f_equal. } done.
done.
Qed. Qed.
End vec_pushpop. End vec_pushpop.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment