Commit e059aa12 authored by Robbert Krebbers's avatar Robbert Krebbers

Better implementation of iPoseProof.

The new implementation ensures that type class arguments are only infered
in the very end. This avoids the need for the inG hack in a0348d7c.
parent 7e477f28
...@@ -28,7 +28,6 @@ Class inG (Λ : language) (Σ : gFunctors) (A : cmraT) := InG { ...@@ -28,7 +28,6 @@ Class inG (Λ : language) (Σ : gFunctors) (A : cmraT) := InG {
inG_prf : A = projT2 Σ inG_id (iPreProp Λ (globalF Σ)) inG_prf : A = projT2 Σ inG_id (iPreProp Λ (globalF Σ))
}. }.
Arguments inG_id {_ _ _} _. Arguments inG_id {_ _ _} _.
Hint Mode inG - - + : typeclass_instances.
Definition to_globalF `{i : inG Λ Σ A} (γ : gname) (a : A) : iGst Λ (globalF Σ) := Definition to_globalF `{i : inG Λ Σ A} (γ : gname) (a : A) : iGst Λ (globalF Σ) :=
iprod_singleton (inG_id i) {[ γ := cmra_transport inG_prf a ]}. iprod_singleton (inG_id i) {[ γ := cmra_transport inG_prf a ]}.
......
...@@ -43,7 +43,7 @@ Lemma inv_open E N P : ...@@ -43,7 +43,7 @@ Lemma inv_open E N P :
|={E,E'}=> P ( P ={E',E}= True). |={E,E'}=> P ( P ={E',E}= True).
Proof. Proof.
rewrite inv_eq /inv. iDestruct 1 as (i) "[% #Hi]". rewrite inv_eq /inv. iDestruct 1 as (i) "[% #Hi]".
iExists (E {[ i ]}). iSplit. { iPureIntro. set_solver. } iExists (E {[ i ]}). iSplit; first (iPureIntro; set_solver).
iPvs (pvs_openI' with "Hi") as "HP"; [set_solver..|]. iPvs (pvs_openI' with "Hi") as "HP"; [set_solver..|].
iPvsIntro. iSplitL "HP"; first done. iIntros "HP". iPvsIntro. iSplitL "HP"; first done. iIntros "HP".
iPvs (pvs_closeI' _ _ P with "[HP]"); [set_solver|iSplit; done|set_solver|]. iPvs (pvs_closeI' _ _ P with "[HP]"); [set_solver|iSplit; done|set_solver|].
......
...@@ -549,25 +549,13 @@ Proof. ...@@ -549,25 +549,13 @@ Proof.
by rewrite right_id {1}(persistentP P) always_and_sep_l wand_elim_r. by rewrite right_id {1}(persistentP P) always_and_sep_l wand_elim_r.
Qed. Qed.
(** Whenever posing [lem : True ⊢ Q] as [H] we want it to appear as [H : Q] and Lemma tac_pose_proof Δ Δ' j P Q :
not as [H : True -★ Q]. The class [IntoPosedProof] is used to strip off the (True P)
[True]. Note that [to_posed_proof_True] is declared using a [Hint Extern] to envs_app true (Esnoc Enil j P) Δ = Some Δ'
make sure it is not used while posing [lem : ?P ⊢ Q] with [?P] an evar. *)
Class IntoPosedProof (P1 P2 R : uPred M) :=
into_pose_proof : (P1 P2) True R.
Arguments into_pose_proof : clear implicits.
Instance to_posed_proof_True P : IntoPosedProof True P P.
Proof. by rewrite /IntoPosedProof. Qed.
Global Instance to_posed_proof_wand P Q : IntoPosedProof P Q (P - Q).
Proof. rewrite /IntoPosedProof. apply entails_wand. Qed.
Lemma tac_pose_proof Δ Δ' j P1 P2 R Q :
(P1 P2) IntoPosedProof P1 P2 R
envs_app true (Esnoc Enil j R) Δ = Some Δ'
(Δ' Q) Δ Q. (Δ' Q) Δ Q.
Proof. Proof.
intros HP ?? <-. rewrite envs_app_sound //; simpl. intros HP ? <-. rewrite envs_app_sound //; simpl.
by rewrite right_id -(into_pose_proof P1 P2 R) // always_pure wand_True. by rewrite right_id -HP always_pure wand_True.
Qed. Qed.
Lemma tac_pose_proof_hyp Δ Δ' Δ'' i p j P Q : Lemma tac_pose_proof_hyp Δ Δ' Δ'' i p j P Q :
...@@ -745,6 +733,3 @@ Proof. ...@@ -745,6 +733,3 @@ Proof.
rewrite envs_simple_replace_sound' //; simpl. by rewrite right_id wand_elim_r. rewrite envs_simple_replace_sound' //; simpl. by rewrite right_id wand_elim_r.
Qed. Qed.
End tactics. End tactics.
Hint Extern 0 (IntoPosedProof True _ _) =>
class_apply @to_posed_proof_True : typeclass_instances.
...@@ -112,45 +112,45 @@ Tactic Notation "iPvsCore" constr(H) := ...@@ -112,45 +112,45 @@ Tactic Notation "iPvsCore" constr(H) :=
|env_cbv; reflexivity|simpl] |env_cbv; reflexivity|simpl]
end. end.
Tactic Notation "iPvs" open_constr(H) := Tactic Notation "iPvs" open_constr(lem) :=
iDestructHelp H as (fun H => iPvsCore H; last iDestruct H as "?"). iDestructCore lem as (fun H => iPvsCore H; last iDestruct H as "?").
Tactic Notation "iPvs" open_constr(H) "as" constr(pat) := Tactic Notation "iPvs" open_constr(lem) "as" constr(pat) :=
iDestructHelp H as (fun H => iPvsCore H; last iDestruct H as pat). iDestructCore lem as (fun H => iPvsCore H; last iDestruct H as pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) ")" Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1) ")"
constr(pat) := constr(pat) :=
iDestructHelp H as (fun H => iPvsCore H; last iDestruct H as ( x1 ) pat). iDestructCore lem as (fun H => iPvsCore H; last iDestruct H as ( x1 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) ")" constr(pat) := simple_intropattern(x2) ")" constr(pat) :=
iDestructHelp H as (fun H => iPvsCore H; last iDestruct H as ( x1 x2 ) pat). iDestructCore lem as (fun H => iPvsCore H; last iDestruct H as ( x1 x2 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) simple_intropattern(x3) ")" constr(pat) := simple_intropattern(x2) simple_intropattern(x3) ")" constr(pat) :=
iDestructHelp H as (fun H => iPvsCore H; last iDestruct H as ( x1 x2 x3 ) pat). iDestructCore lem as (fun H => iPvsCore H; last iDestruct H as ( x1 x2 x3 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4) ")" simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4) ")"
constr(pat) := constr(pat) :=
iDestructHelp H as (fun H => iDestructCore lem as (fun H =>
iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 ) pat). iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4) simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4)
simple_intropattern(x5) ")" constr(pat) := simple_intropattern(x5) ")" constr(pat) :=
iDestructHelp H as (fun H => iDestructCore lem as (fun H =>
iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 ) pat). iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4) simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4)
simple_intropattern(x5) simple_intropattern(x6) ")" constr(pat) := simple_intropattern(x5) simple_intropattern(x6) ")" constr(pat) :=
iDestructHelp H as (fun H => iDestructCore lem as (fun H =>
iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 x6 ) pat). iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 x6 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4) simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4)
simple_intropattern(x5) simple_intropattern(x6) simple_intropattern(x7) ")" simple_intropattern(x5) simple_intropattern(x6) simple_intropattern(x7) ")"
constr(pat) := constr(pat) :=
iDestructHelp H as (fun H => iDestructCore lem as (fun H =>
iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 x6 x7 ) pat). iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 x6 x7 ) pat).
Tactic Notation "iPvs" open_constr(H) "as" "(" simple_intropattern(x1) Tactic Notation "iPvs" open_constr(lem) "as" "(" simple_intropattern(x1)
simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4) simple_intropattern(x2) simple_intropattern(x3) simple_intropattern(x4)
simple_intropattern(x5) simple_intropattern(x6) simple_intropattern(x7) simple_intropattern(x5) simple_intropattern(x6) simple_intropattern(x7)
simple_intropattern(x8) ")" constr(pat) := simple_intropattern(x8) ")" constr(pat) :=
iDestructHelp H as (fun H => iDestructCore lem as (fun H =>
iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 x6 x7 x8 ) pat). iPvsCore H; last iDestruct H as ( x1 x2 x3 x4 x5 x6 x7 x8 ) pat).
Hint Extern 2 (of_envs _ _) => Hint Extern 2 (of_envs _ _) =>
......
This diff is collapsed.
Markdown is supported
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