Skip to content

Commit

Permalink
Separate tactics file + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Nardino committed Feb 28, 2024
1 parent af4b964 commit 2bf052b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
26 changes: 1 addition & 25 deletions theories/examples/delim_lang/example.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From gitrees Require Import gitree lang_generic.
From gitrees.examples.delim_lang Require Import lang interp.
From gitrees.examples.delim_lang Require Import lang interp tactics.
From iris.proofmode Require Import base classes tactics environments.
From iris.base_logic Require Import algebra.

Expand All @@ -9,8 +9,6 @@ Example p : expr Empty_set :=
((#1) + (reset ((#3) + (shift/cc ((($0) @k #5) + (($0) @k #6)))))).

Local Definition rs : gReifiers _ _ := gReifiers_cons reify_delim gReifiers_nil.
(* Local Definition Hrs : subReifier reify_delim rs. *)
(* Proof. unfold rs. apply subReifier_here. Qed. *)

Notation F := (gReifiers_ops rs).
Context {R} `{!Cofe R}.
Expand All @@ -28,28 +26,6 @@ Context `{!invGS Σ, !stateG rs R Σ, !heapG rs R Σ}.
Notation iProp := (iProp Σ).


Ltac wp_ctx :=
match goal with
| |- envs_entails _ (wp _ (ofe_mor_car _ _ (λne x, ?k1 x)
(ofe_mor_car _ _ (?k2 ?t) ?e)) _ _ _) =>
assert (AsVal e) by apply _;
assert ((ofe_mor_car _ _ (λne x, k1 x) (k2 t e)) ≡ (λne x, k1 (k2 x e)) t) as -> by done
| |- envs_entails _ (wp _ (ofe_mor_car _ _ (λne x, ?k1 x) (?k2 ?t)) _ _ _) =>
assert ((ofe_mor_car _ _ (λne x, k1 x) (k2 t)) ≡ (λne x, k1 (k2 x)) t) as -> by done
| |- envs_entails _ (wp _ (ofe_mor_car _ _ (?k ?t) ?e) _ _ _) =>
assert (AsVal e) by apply _;
assert (k t e ≡ (λne x, k x e) t) as -> by done
| |- envs_entails _ (wp _ (?k ?t) _ _ _) =>
assert (k t ≡ (λne x, k x) t) as -> by done
end.

Ltac name_ctx k :=
match goal with
| |- envs_entails _ (wp _ (ofe_mor_car _ _ ?k1 _) _ _ _) =>
remember k1 as k
end.


Lemma wp_t (s : gitree.weakestpre.stuckness) :
has_substate σ -∗
WP@{rs} t @ s {{βv, βv ≡ RetV 18}}.
Expand Down
32 changes: 32 additions & 0 deletions theories/examples/delim_lang/tactics.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From gitrees Require Import gitree lang_generic.
From iris.proofmode Require Import base classes tactics environments.
From iris.base_logic Require Import algebra.

(* TODO: doc *)
Ltac reshape_term α tac :=
match α with
| (ofe_mor_car _ _ (λne x, ?k1 x) (ofe_mor_car _ _ (?k2 ?t) ?e)) =>
assert (AsVal e) by apply _;
tac ((λne x, k1 (k2 x e)) t)
| (ofe_mor_car _ _ (λne x, ?k1 x) (?k2 ?t)) =>
tac ((λne x, k1 (k2 x)) t)
| (ofe_mor_car _ _ (?k ?t) ?e) =>
assert (AsVal e) by apply _;
tac ((λne x, k x e) t)
| (?k ?t) =>
tac ((λne x, k x) t)
end.

(* TODO: doc *)
Ltac wp_ctx :=
match goal with
|- envs_entails _ (wp _ ?e _ _ _) =>
reshape_term e ltac:(fun x => assert (e ≡ x) as -> by done)
end.

(* TODO: doc *)
Ltac name_ctx k :=
match goal with
|- envs_entails _ (wp _ (ofe_mor_car _ _ ?k1 _) _ _ _) =>
remember k1 as k
end.

0 comments on commit 2bf052b

Please sign in to comment.