Commit c2e7d39b authored by Jacques-Henri Jourdan's avatar Jacques-Henri Jourdan

Merge branch 'gen_proofmode' into jh/exist_plainly

parents edae2dc1 ca0996a8
......@@ -26,7 +26,8 @@ theories/algebra/coPset.v
theories/algebra/deprecated.v
theories/algebra/proofmode_classes.v
theories/bi/interface.v
theories/bi/derived.v
theories/bi/derived_connectives.v
theories/bi/derived_laws.v
theories/bi/big_op.v
theories/bi/bi.v
theories/bi/tactics.v
......
From iris.base_logic Require Export upred.
From iris.bi Require Export interface derived.
From iris.bi Require Export derived_laws.
Set Default Proof Using "Type".
Import upred.uPred.
Import interface.bi derived.bi.
Import interface.bi derived_laws.bi.
Module uPred.
Section derived.
......@@ -31,10 +31,6 @@ Proof.
apply limit_preserving_and; by apply limit_preserving_entails.
Qed.
(* Affine *)
Global Instance uPred_affine : AffineBI (uPredI M) | 0.
Proof. intros P. rewrite /Affine. by apply bi.pure_intro. Qed.
(* Own and valid derived *)
Lemma persistently_cmra_valid_1 {A : cmraT} (a : A) :
a bi_persistently ( a : uPred M).
......@@ -131,6 +127,6 @@ Proof. split; [split; try apply _|]. apply ownM_op. apply ownM_unit'. Qed.
End derived.
(* Also add this to the global hint database, otherwise [eauto] won't work for
many lemmas that have [AffineBI] as a premise. *)
many lemmas that have [BiAffine] as a premise. *)
Hint Immediate uPred_affine.
End uPred.
From iris.algebra Require Export cmra updates.
From iris.bi Require Export interface.
From iris.bi Require Export derived_connectives.
From stdpp Require Import finite.
Set Default Proof Using "Type".
Local Hint Extern 1 (_ _) => etrans; [eassumption|].
......@@ -608,10 +608,13 @@ Proof.
Qed.
Global Instance bupd_proper : Proper (() ==> ()) (@uPred_bupd M) := ne_proper _.
(** PlainlyExist1BI *)
(** BI instances *)
Global Instance uPred_plainly_exist_1 : PlainlyExist1BI (uPredI M).
Proof. unfold PlainlyExist1BI. by unseal. Qed.
Global Instance uPred_affine : BiAffine (uPredI M) | 0.
Proof. intros P. rewrite /Affine. by apply bi.pure_intro. Qed.
Global Instance uPred_plainly_exist_1 : BiPlainlyExist (uPredI M).
Proof. unfold BiPlainlyExist. by unseal. Qed.
(** Limits *)
Lemma entails_lim (cP cQ : chain (uPredC M)) :
......
From iris.bi Require Export interface derived big_op.
From iris.bi Require Export derived_laws big_op.
Set Default Proof Using "Type".
Module Import bi.
Export bi.interface.bi.
Export bi.derived.bi.
Export bi.derived_laws.bi.
Export bi.big_op.bi.
End bi.
......
This diff is collapsed.
......@@ -5,7 +5,7 @@ Set Default Proof Using "Type*".
(** This proves that we need the ▷ in a "Saved Proposition" construction with
name-dependent allocation. *)
Module savedprop. Section savedprop.
Context `{AffineBI PROP}.
Context `{BiAffine PROP}.
Notation "¬ P" := ( (P False))%I : bi_scope.
Implicit Types P : PROP.
......@@ -65,7 +65,7 @@ End savedprop. End savedprop.
(** This proves that we need the ▷ when opening invariants. *)
Module inv. Section inv.
Context `{AffineBI PROP}.
Context `{BiAffine PROP}.
Implicit Types P : PROP.
(** Assumptions *)
......
From iris.bi Require Export interface.
From iris.algebra Require Import monoid.
From stdpp Require Import hlist.
Definition bi_iff {PROP : bi} (P Q : PROP) : PROP := ((P Q) (Q P))%I.
Arguments bi_iff {_} _%I _%I : simpl never.
Instance: Params (@bi_iff) 1.
Infix "↔" := bi_iff : bi_scope.
Definition bi_wand_iff {PROP : bi} (P Q : PROP) : PROP :=
((P - Q) (Q - P))%I.
Arguments bi_wand_iff {_} _%I _%I : simpl never.
Instance: Params (@bi_wand_iff) 1.
Infix "∗-∗" := bi_wand_iff (at level 95, no associativity) : bi_scope.
Class Plain {PROP : bi} (P : PROP) := plain : P bi_plainly P.
Arguments Plain {_} _%I : simpl never.
Arguments plain {_} _%I {_}.
Hint Mode Plain + ! : typeclass_instances.
Instance: Params (@Plain) 1.
Class Persistent {PROP : bi} (P : PROP) := persistent : P bi_persistently P.
Arguments Persistent {_} _%I : simpl never.
Arguments persistent {_} _%I {_}.
Hint Mode Persistent + ! : typeclass_instances.
Instance: Params (@Persistent) 1.
Definition bi_affinely {PROP : bi} (P : PROP) : PROP := (emp P)%I.
Arguments bi_affinely {_} _%I : simpl never.
Instance: Params (@bi_affinely) 1.
Typeclasses Opaque bi_affinely.
Notation "□ P" := (bi_affinely (bi_persistently P))%I
(at level 20, right associativity) : bi_scope.
Notation "■ P" := (bi_affinely (bi_plainly P))%I
(at level 20, right associativity) : bi_scope.
Class Affine {PROP : bi} (Q : PROP) := affine : Q emp.
Arguments Affine {_} _%I : simpl never.
Arguments affine {_} _%I {_}.
Hint Mode Affine + ! : typeclass_instances.
Class BiAffine (PROP : bi) := absorbing_bi (Q : PROP) : Affine Q.
Existing Instance absorbing_bi | 0.
Class BiPositive (PROP : bi) :=
bi_positive (P Q : PROP) : bi_affinely (P Q) bi_affinely P Q.
Class BiPlainlyExist (PROP : bi) :=
plainly_exist_1 A (Ψ : A PROP) :
bi_plainly ( a, Ψ a) a, bi_plainly (Ψ a).
Arguments plainly_exist_1 _ {_ _} _.
Definition bi_absorbingly {PROP : bi} (P : PROP) : PROP := (True P)%I.
Arguments bi_absorbingly {_} _%I : simpl never.
Instance: Params (@bi_absorbingly) 1.
Typeclasses Opaque bi_absorbingly.
Class Absorbing {PROP : bi} (P : PROP) := absorbing : bi_absorbingly P P.
Arguments Absorbing {_} _%I : simpl never.
Arguments absorbing {_} _%I.
Definition bi_plainly_if {PROP : bi} (p : bool) (P : PROP) : PROP :=
(if p then bi_plainly P else P)%I.
Arguments bi_plainly_if {_} !_ _%I /.
Instance: Params (@bi_plainly_if) 2.
Typeclasses Opaque bi_plainly_if.
Definition bi_persistently_if {PROP : bi} (p : bool) (P : PROP) : PROP :=
(if p then bi_persistently P else P)%I.
Arguments bi_persistently_if {_} !_ _%I /.
Instance: Params (@bi_persistently_if) 2.
Typeclasses Opaque bi_persistently_if.
Definition bi_affinely_if {PROP : bi} (p : bool) (P : PROP) : PROP :=
(if p then bi_affinely P else P)%I.
Arguments bi_affinely_if {_} !_ _%I /.
Instance: Params (@bi_affinely_if) 2.
Typeclasses Opaque bi_affinely_if.
Notation "□? p P" := (bi_affinely_if p (bi_persistently_if p P))%I
(at level 20, p at level 9, P at level 20,
right associativity, format "□? p P") : bi_scope.
Notation "■? p P" := (bi_affinely_if p (bi_plainly_if p P))%I
(at level 20, p at level 9, P at level 20,
right associativity, format "■? p P") : bi_scope.
Fixpoint bi_hexist {PROP : bi} {As} : himpl As PROP PROP :=
match As return himpl As PROP PROP with
| tnil => id
| tcons A As => λ Φ, x, bi_hexist (Φ x)
end%I.
Fixpoint bi_hforall {PROP : bi} {As} : himpl As PROP PROP :=
match As return himpl As PROP PROP with
| tnil => id
| tcons A As => λ Φ, x, bi_hforall (Φ x)
end%I.
Definition bi_laterN {PROP : sbi} (n : nat) (P : PROP) : PROP :=
Nat.iter n bi_later P.
Arguments bi_laterN {_} !_%nat_scope _%I.
Instance: Params (@bi_laterN) 2.
Notation "▷^ n P" := (bi_laterN n P)
(at level 20, n at level 9, P at level 20, format "▷^ n P") : bi_scope.
Notation "▷? p P" := (bi_laterN (Nat.b2n p) P)
(at level 20, p at level 9, P at level 20, format "▷? p P") : bi_scope.
Definition bi_except_0 {PROP : sbi} (P : PROP) : PROP := ( False P)%I.
Arguments bi_except_0 {_} _%I : simpl never.
Notation "◇ P" := (bi_except_0 P) (at level 20, right associativity) : bi_scope.
Instance: Params (@bi_except_0) 1.
Typeclasses Opaque bi_except_0.
Class Timeless {PROP : sbi} (P : PROP) := timeless : P P.
Arguments Timeless {_} _%I : simpl never.
Arguments timeless {_} _%I {_}.
Hint Mode Timeless + ! : typeclass_instances.
Instance: Params (@Timeless) 1.
......@@ -329,10 +329,6 @@ Coercion sbi_valid {PROP : sbi} : PROP → Prop := bi_valid.
Arguments bi_valid {_} _%I : simpl never.
Typeclasses Opaque bi_valid.
Class PlainlyExist1BI (PROP : bi) :=
plainly_exist_1 A (Ψ : A PROP) : bi_plainly ( a, Ψ a) a, bi_plainly (Ψ a).
Arguments plainly_exist_1 {_ _ _} _.
Module bi.
Section bi_laws.
Context {PROP : bi}.
......
......@@ -32,7 +32,7 @@ Module bi_reflection. Section bi_reflection.
Qed.
(* Can be related to the RHS being affine *)
Lemma flatten_entails `{AffineBI PROP} Σ e1 e2 :
Lemma flatten_entails `{BiAffine PROP} Σ e1 e2 :
flatten e2 + flatten e1 eval Σ e1 eval Σ e2.
Proof. intros. rewrite !eval_flatten. by apply big_sepL_submseteq. Qed.
Lemma flatten_equiv Σ e1 e2 :
......
......@@ -50,7 +50,7 @@ Proof.
rewrite /FromAssumption /= =><-.
by rewrite persistently_elim plainly_elim_persistently.
Qed.
Global Instance from_assumption_plainly_l_false `{AffineBI PROP} P Q :
Global Instance from_assumption_plainly_l_false `{BiAffine PROP} P Q :
FromAssumption true P Q FromAssumption false (bi_plainly P) Q.
Proof.
rewrite /FromAssumption /= =><-.
......@@ -62,7 +62,7 @@ Proof. rewrite /FromAssumption /= =><-. by rewrite affinely_persistently_if_elim
Global Instance from_assumption_persistently_l_true P Q :
FromAssumption true P Q FromAssumption true (bi_persistently P) Q.
Proof. rewrite /FromAssumption /= =><-. by rewrite persistently_idemp. Qed.
Global Instance from_assumption_persistently_l_false `{AffineBI PROP} P Q :
Global Instance from_assumption_persistently_l_false `{BiAffine PROP} P Q :
FromAssumption true P Q FromAssumption false (bi_persistently P) Q.
Proof. rewrite /FromAssumption /= =><-. by rewrite affine_affinely. Qed.
Global Instance from_assumption_affinely_l_true p P Q :
......@@ -224,7 +224,7 @@ Proof.
rewrite /FromAssumption /IntoWand=> HP. by rewrite HP affinely_persistently_if_elim.
Qed.
Global Instance into_wand_impl_false_false `{!AffineBI PROP} P Q P' :
Global Instance into_wand_impl_false_false `{!BiAffine PROP} P Q P' :
FromAssumption false P P' IntoWand false false (P' Q) P Q.
Proof.
rewrite /FromAssumption /IntoWand /= => ->. apply wand_intro_r.
......@@ -274,7 +274,7 @@ Proof. by rewrite /IntoWand affinely_plainly_elim. Qed.
Global Instance into_wand_plainly_true q R P Q :
IntoWand true q R P Q IntoWand true q (bi_plainly R) P Q.
Proof. by rewrite /IntoWand /= persistently_plainly plainly_elim_persistently. Qed.
Global Instance into_wand_plainly_false `{!AffineBI PROP} q R P Q :
Global Instance into_wand_plainly_false `{!BiAffine PROP} q R P Q :
IntoWand false q R P Q IntoWand false q (bi_plainly R) P Q.
Proof. by rewrite /IntoWand plainly_elim. Qed.
......@@ -284,7 +284,7 @@ Proof. by rewrite /IntoWand affinely_persistently_elim. Qed.
Global Instance into_wand_persistently_true q R P Q :
IntoWand true q R P Q IntoWand true q (bi_persistently R) P Q.
Proof. by rewrite /IntoWand /= persistently_idemp. Qed.
Global Instance into_wand_persistently_false `{!AffineBI PROP} q R P Q :
Global Instance into_wand_persistently_false `{!BiAffine PROP} q R P Q :
IntoWand false q R P Q IntoWand false q (bi_persistently R) P Q.
Proof. by rewrite /IntoWand persistently_elim. Qed.
......@@ -388,7 +388,7 @@ Proof.
by rewrite -(affine_affinely Q) affinely_and_r affinely_and (from_affinely P').
Qed.
Global Instance into_and_sep `{PositiveBI PROP} P Q : IntoAnd true (P Q) P Q.
Global Instance into_and_sep `{BiPositive PROP} P Q : IntoAnd true (P Q) P Q.
Proof.
by rewrite /IntoAnd /= persistently_sep -and_sep_persistently persistently_and.
Qed.
......@@ -460,10 +460,10 @@ Global Instance into_sep_affinely P Q1 Q2 :
IntoSep P Q1 Q2 IntoSep (bi_affinely P) Q1 Q2 | 20.
Proof. rewrite /IntoSep /= => ->. by rewrite affinely_elim. Qed.
Global Instance into_sep_plainly `{PositiveBI PROP} P Q1 Q2 :
Global Instance into_sep_plainly `{BiPositive PROP} P Q1 Q2 :
IntoSep P Q1 Q2 IntoSep (bi_plainly P) (bi_plainly Q1) (bi_plainly Q2).
Proof. rewrite /IntoSep /= => ->. by rewrite plainly_sep. Qed.
Global Instance into_sep_persistently `{PositiveBI PROP} P Q1 Q2 :
Global Instance into_sep_persistently `{BiPositive PROP} P Q1 Q2 :
IntoSep P Q1 Q2
IntoSep (bi_persistently P) (bi_persistently Q1) (bi_persistently Q2).
Proof. rewrite /IntoSep /= => ->. by rewrite persistently_sep. Qed.
......@@ -512,7 +512,7 @@ Proof. rewrite /IntoOr=>->. by rewrite affinely_or. Qed.
Global Instance into_or_absorbingly P Q1 Q2 :
IntoOr P Q1 Q2 IntoOr (bi_absorbingly P) (bi_absorbingly Q1) (bi_absorbingly Q2).
Proof. rewrite /IntoOr=>->. by rewrite absorbingly_or. Qed.
Global Instance into_or_plainly `{PlainlyExist1BI PROP} P Q1 Q2 :
Global Instance into_or_plainly `{BiPlainlyExist PROP} P Q1 Q2 :
IntoOr P Q1 Q2 IntoOr (bi_plainly P) (bi_plainly Q1) (bi_plainly Q2).
Proof. rewrite /IntoOr=>->. by rewrite plainly_or. Qed.
Global Instance into_or_persistently P Q1 Q2 :
......@@ -564,7 +564,7 @@ Qed.
Global Instance into_exist_absorbingly {A} P (Φ : A PROP) :
IntoExist P Φ IntoExist (bi_absorbingly P) (λ a, bi_absorbingly (Φ a))%I.
Proof. rewrite /IntoExist=> HP. by rewrite HP absorbingly_exist. Qed.
Global Instance into_exist_plainly `{PlainlyExist1BI PROP} {A} P (Φ : A PROP) :
Global Instance into_exist_plainly `{BiPlainlyExist PROP} {A} P (Φ : A PROP) :
IntoExist P Φ IntoExist (bi_plainly P) (λ a, bi_plainly (Φ a))%I.
Proof. rewrite /IntoExist=> HP. by rewrite HP plainly_exist. Qed.
Global Instance into_exist_persistently {A} P (Φ : A PROP) :
......@@ -609,7 +609,7 @@ Proof.
- by rewrite (into_pure P) -pure_wand_forall wand_elim_l.
Qed.
Global Instance from_forall_affinely `{AffineBI PROP} {A} P (Φ : A PROP) :
Global Instance from_forall_affinely `{BiAffine PROP} {A} P (Φ : A PROP) :
FromForall P Φ FromForall (bi_affinely P)%I (λ a, bi_affinely (Φ a))%I.
Proof.
rewrite /FromForall=> <-. rewrite affine_affinely. by setoid_rewrite affinely_elim.
......@@ -1051,7 +1051,7 @@ Proof. rewrite /IntoExcept0=> ->. by rewrite except_0_affinely_2. Qed.
Global Instance into_except_0_absorbingly P Q :
IntoExcept0 P Q IntoExcept0 (bi_absorbingly P) (bi_absorbingly Q).
Proof. rewrite /IntoExcept0=> ->. by rewrite except_0_absorbingly. Qed.
Global Instance into_except_0_plainly `{PlainlyExist1BI PROP} P Q :
Global Instance into_except_0_plainly `{BiPlainlyExist PROP} P Q :
IntoExcept0 P Q IntoExcept0 (bi_plainly P) (bi_plainly Q).
Proof. rewrite /IntoExcept0=> ->. by rewrite except_0_plainly. Qed.
Global Instance into_except_0_persistently P Q :
......@@ -1234,7 +1234,7 @@ Global Instance from_later_sep n P1 P2 Q1 Q2 :
FromLaterN n P1 Q1 FromLaterN n P2 Q2 FromLaterN n (P1 P2) (Q1 Q2).
Proof. intros ??; red. by rewrite laterN_sep; apply sep_mono. Qed.
Global Instance from_later_affinely n P Q `{AffineBI PROP} :
Global Instance from_later_affinely n P Q `{BiAffine PROP} :
FromLaterN n P Q FromLaterN n (bi_affinely P) (bi_affinely Q).
Proof. rewrite /FromLaterN=><-. by rewrite affinely_elim affine_affinely. Qed.
Global Instance from_later_plainly n P Q :
......
......@@ -458,7 +458,7 @@ Global Instance affine_env_snoc Γ i P :
Proof. by constructor. Qed.
(* If the BI is affine, no need to walk on the whole environment. *)
Global Instance affine_env_bi `(AffineBI PROP) Γ : AffineEnv Γ | 0.
Global Instance affine_env_bi `(BiAffine PROP) Γ : AffineEnv Γ | 0.
Proof. induction Γ; apply _. Qed.
Instance affine_env_spatial Δ :
......@@ -800,7 +800,7 @@ Lemma tac_specialize_persistent_helper Δ Δ'' j q P R R' Q :
envs_lookup j Δ = Some (q,P)
envs_entails Δ (bi_absorbingly R)
IntoPersistent false R R'
(if q then TCTrue else AffineBI PROP)
(if q then TCTrue else BiAffine PROP)
envs_replace j q true (Esnoc Enil j R') Δ = Some Δ''
envs_entails Δ'' Q envs_entails Δ Q.
Proof.
......
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