Commit d70b62f6 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Use new class `IntoFUpd` in tactic `wp_value_head`.

parent 0571115a
...@@ -59,31 +59,26 @@ Lemma tac_twp_value_nofupd `{!heapG Σ} Δ s E Φ v : ...@@ -59,31 +59,26 @@ Lemma tac_twp_value_nofupd `{!heapG Σ} Δ s E Φ v :
envs_entails Δ (Φ v) envs_entails Δ (WP (Val v) @ s; E [{ Φ }]). envs_entails Δ (Φ v) envs_entails Δ (WP (Val v) @ s; E [{ Φ }]).
Proof. rewrite envs_entails_eq=> ->. by apply twp_value. Qed. Proof. rewrite envs_entails_eq=> ->. by apply twp_value. Qed.
Lemma tac_wp_value `{!heapG Σ} Δ s E (Φ : val iPropI Σ) v : Lemma tac_wp_value `{!heapG Σ} Δ s E P (Φ : val iPropI Σ) v :
envs_entails Δ (|={E}=> Φ v) envs_entails Δ (WP (Val v) @ s; E {{ Φ }}). IntoFUpd E P (Φ v)
Proof. rewrite envs_entails_eq=> ->. by rewrite wp_value_fupd. Qed. envs_entails Δ P envs_entails Δ (WP (Val v) @ s; E {{ Φ }}).
Lemma tac_twp_value `{!heapG Σ} Δ s E (Φ : val iPropI Σ) v : Proof. rewrite /IntoFUpd envs_entails_eq=> -> ->. by rewrite wp_value_fupd. Qed.
envs_entails Δ (|={E}=> Φ v) envs_entails Δ (WP (Val v) @ s; E [{ Φ }]). Lemma tac_twp_value `{!heapG Σ} Δ s E P (Φ : val iPropI Σ) v :
Proof. rewrite envs_entails_eq=> ->. by rewrite twp_value_fupd. Qed. IntoFUpd E P (Φ v)
envs_entails Δ P envs_entails Δ (WP (Val v) @ s; E [{ Φ }]).
Proof. rewrite /IntoFUpd envs_entails_eq=> -> ->. by rewrite twp_value_fupd. Qed.
(** Simplify the goal if it is [WP] of a value. (** Simplify the goal if it is [WP] of a value.
If the postcondition already allows a fupd, do not add a second one. The [IntoFUpd] class in the above tactics ensures that if the postcondition
But otherwise, *do* add a fupd. This ensures that all the lemmas applied already allows a fupd, no second one is added.
But otherwise, an fupd *is* added. This ensures that all the lemmas applied
here are bidirectional, so we never will make a goal unprovable. *) here are bidirectional, so we never will make a goal unprovable. *)
Ltac wp_value_head := Ltac wp_value_head :=
lazymatch goal with lazymatch goal with
| |- envs_entails _ (wp ?s ?E (Val _) (λ _, fupd ?E _ _)) =>
eapply tac_wp_value_nofupd
| |- envs_entails _ (wp ?s ?E (Val _) (λ _, wp _ ?E _ _)) =>
eapply tac_wp_value_nofupd
| |- envs_entails _ (wp ?s ?E (Val _) _) => | |- envs_entails _ (wp ?s ?E (Val _) _) =>
eapply tac_wp_value notypeclasses refine (tac_wp_value _ _ _ _ _ _ _ _); [iSolveTC|]
| |- envs_entails _ (twp ?s ?E (Val _) (λ _, fupd ?E _ _)) =>
eapply tac_twp_value_nofupd
| |- envs_entails _ (twp ?s ?E (Val _) (λ _, twp _ ?E _ _)) =>
eapply tac_twp_value_nofupd
| |- envs_entails _ (twp ?s ?E (Val _) _) => | |- envs_entails _ (twp ?s ?E (Val _) _) =>
eapply tac_twp_value notypeclasses refine (tac_twp_value _ _ _ _ _ _ _ _); [iSolveTC|]
end. end.
Ltac wp_finish := Ltac wp_finish :=
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment