Skip to content
Snippets Groups Projects
Commit 228f3a2e authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

A tactic `wp_simpl_subst` that only simplifies in the `e` of `WP e @ E {{ Φ }}`.

parent 074339d3
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,18 @@ Ltac wp_simpl :=
let e' := eval simpl in e in change (envs_entails Δ (wp E e' Q))
end.
Lemma tac_wp_simpl_subst `{heapG Σ} Δ E Φ e e' :
e = e'
envs_entails Δ (WP e' @ E {{ Φ }}) envs_entails Δ (WP e @ E {{ Φ }}).
Proof. by intros ->. Qed.
Ltac wp_simpl_subst :=
try iStartProof;
try lazymatch goal with
| |- envs_entails (wp ?E ?e ?Q) =>
eapply tac_wp_simpl_subst; [simpl_subst; reflexivity|]
end.
Lemma tac_wp_pure `{heapG Σ} Δ Δ' E e1 e2 φ Φ :
PureExec φ e1 e2
φ
......@@ -41,7 +53,7 @@ Tactic Notation "wp_pure" open_constr(efoc) :=
[apply _ (* PureExec *)
|try fast_done (* The pure condition for PureExec *)
|apply _ (* IntoLaters *)
|simpl_subst; try wp_value_head (* new goal *)
|wp_simpl_subst; try wp_value_head (* new goal *)
])
|| fail "wp_pure: cannot find" efoc "in" e "or" efoc "is not a reduct"
| _ => fail "wp_pure: not a 'wp'"
......
......@@ -40,7 +40,7 @@ Lemma sum_loop_wp `{!heapG Σ} v t l (n : Z) :
{{{ RET #(); l #(sum t + n) is_tree v t }}}.
Proof.
iIntros (Φ) "[Hl Ht] HΦ".
iInduction t as [n'|tl ? tr] "IH" forall (v l n Φ); wp_rec; wp_let.
iInduction t as [n'|tl ? tr] "IH" forall (v l n Φ); simpl; wp_rec; wp_let.
- iDestruct "Ht" as "%"; subst.
wp_match. wp_load. wp_op. wp_store.
by iApply ("HΦ" with "[$Hl]").
......
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