@@ -9,6 +9,7 @@ public import Iris.BI.Classes
99public import Iris.BI.Extensions
1010public import Iris.BI.BI
1111public import Iris.Std.Nat
12+ public import Iris.Std.Classes
1213public import Iris.Std.Rewrite
1314public import Iris.Std.TC
1415import Iris.Std.RocqPorting
@@ -23,7 +24,8 @@ open Iris.Std BI
2324/- Necessary for `calc`-style proofs. -/
2425instance entails_trans' [BI PROP] : Trans (α := PROP) Entails Entails Entails where
2526 trans h1 h2 := h1.trans h2
26-
27+ instance entails_antisymm [BI PROP] : Antisymmetric (α := PROP) BiEntails Entails where
28+ antisymm h1 h2 := ⟨h1, h2⟩
2729#rocq_ignore bi.entails_proper "Derivable from _ne with NonExpansive.eqv."
2830
2931instance equiv_trans [BI PROP] : Trans (α := PROP) BiEntails BiEntails BiEntails where
@@ -207,11 +209,13 @@ theorem exists_mono [BI PROP] {Φ Ψ : α → PROP} (h : ∀ a, Φ a ⊢ Ψ a) :
207209theorem exists_congr [BI PROP] {Φ Ψ : α → PROP} (h : ∀ a, Φ a ⊣⊢ Ψ a) : (∃ a, Φ a) ⊣⊢ ∃ a, Ψ a :=
208210 ⟨exists_mono fun a => (h a).1 , exists_mono fun a => (h a).2 ⟩
209211
210- @ [rocq_alias bi.and_idem]
211212theorem and_self [BI PROP] {P : PROP} : P ∧ P ⊣⊢ P := ⟨and_elim_l, and_intro .rfl .rfl⟩
213+ @ [rocq_alias bi.and_idem]
214+ instance [BI PROP] : Idempotent (α := PROP) BiEntails and := ⟨and_self⟩
212215
213- @ [rocq_alias bi.or_idem]
214216theorem or_self [BI PROP] {P : PROP} : P ∨ P ⊣⊢ P := ⟨or_elim .rfl .rfl, or_intro_l⟩
217+ @ [rocq_alias bi.or_idem]
218+ instance [BI PROP] : Idempotent (α := PROP) BiEntails or := ⟨or_self⟩
215219
216220#rocq_ignore bi.and_mono' "Use and_mono"
217221#rocq_ignore bi.and_flip_mono' "Use and_mono"
@@ -226,48 +230,61 @@ theorem or_self [BI PROP] {P : PROP} : P ∨ P ⊣⊢ P := ⟨or_elim .rfl .rfl,
226230
227231@ [rocq_alias bi.and_comm]
228232theorem and_comm [BI PROP] {P Q : PROP} : P ∧ Q ⊣⊢ Q ∧ P := ⟨and_symm, and_symm⟩
233+ instance [BI PROP] : Commutative (α := PROP) BiEntails and := ⟨and_comm⟩
229234
230235@ [rocq_alias bi.or_comm]
231236theorem or_comm [BI PROP] {P Q : PROP} : P ∨ Q ⊣⊢ Q ∨ P := ⟨or_symm, or_symm⟩
237+ instance [BI PROP] : Commutative (α := PROP) BiEntails or := ⟨or_comm⟩
232238
233239@ [rocq_alias bi.True_and]
234240theorem true_and [BI PROP] {P : PROP} : True ∧ P ⊣⊢ P :=
235241 ⟨and_elim_r, and_intro (pure_intro trivial) .rfl⟩
242+ instance [BI PROP] : LeftId (· ⊣⊢@{PROP} ·) iprop(True) and := ⟨true_and⟩
236243
237244@ [rocq_alias bi.and_True]
238245theorem and_true [BI PROP] {P : PROP} : P ∧ True ⊣⊢ P := and_comm.trans true_and
246+ instance [BI PROP] : RightId (· ⊣⊢@{PROP} ·) iprop(True) and := ⟨and_true⟩
239247
240248@ [rocq_alias bi.False_and]
241249theorem false_and [BI PROP] {P : PROP} : False ∧ P ⊣⊢ False := ⟨and_elim_l, false_elim⟩
250+ instance [BI PROP] : LeftAbsorb (· ⊣⊢@{PROP} ·) iprop(False) and := ⟨false_and⟩
242251
243252@ [rocq_alias bi.and_False]
244253theorem and_false [BI PROP] {P : PROP} : P ∧ False ⊣⊢ False := and_comm.trans false_and
254+ instance [BI PROP] : RightAbsorb (· ⊣⊢@{PROP} ·) iprop(False) and := ⟨and_false⟩
245255
246256@ [rocq_alias bi.True_or]
247257theorem true_or [BI PROP] {P : PROP} : True ∨ P ⊣⊢ True := ⟨true_intro, or_intro_l⟩
258+ instance [BI PROP] : LeftAbsorb (· ⊣⊢@{PROP} ·) iprop(True) or := ⟨true_or⟩
248259
249260@ [rocq_alias bi.or_True]
250261theorem or_true [BI PROP] {P : PROP} : P ∨ True ⊣⊢ True := or_comm.trans true_or
262+ instance [BI PROP] : RightAbsorb (· ⊣⊢@{PROP} ·) iprop(True) or := ⟨or_true⟩
251263
252264@ [rocq_alias bi.False_or]
253265theorem false_or [BI PROP] {P : PROP} : False ∨ P ⊣⊢ P := ⟨or_elim false_elim .rfl, or_intro_r⟩
266+ instance [BI PROP] : LeftId (α := PROP) BiEntails iprop(False) or := ⟨false_or⟩
254267
255268@ [rocq_alias bi.or_False]
256269theorem or_false [BI PROP] {P : PROP} : P ∨ False ⊣⊢ P := or_comm.trans false_or
270+ instance [BI PROP] : RightId (α := PROP) BiEntails iprop(False) or := ⟨or_false⟩
257271
258272@ [rocq_alias bi.and_assoc]
259273theorem and_assoc [BI PROP] {P Q R : PROP} : (P ∧ Q) ∧ R ⊣⊢ P ∧ Q ∧ R :=
260274 ⟨and_intro (and_elim_left_trans and_elim_l) (and_mono_left and_elim_r),
261275 and_intro (and_mono_right and_elim_l) (and_elim_right_trans and_elim_r)⟩
276+ instance [BI PROP] : Associative (α := PROP) BiEntails and := ⟨and_assoc⟩
262277
263278@ [rocq_alias bi.or_assoc]
264279theorem or_assoc [BI PROP] {P Q R : PROP} : (P ∨ Q) ∨ R ⊣⊢ P ∨ Q ∨ R :=
265280 ⟨or_elim (or_mono_right or_intro_l) (or_intro_right_trans or_intro_r),
266281 or_elim (or_intro_left_trans or_intro_l) (or_mono_left or_intro_r)⟩
282+ instance [BI PROP] : Associative (α := PROP) BiEntails or := ⟨or_assoc⟩
267283
268284@ [rocq_alias bi.True_impl]
269285theorem true_imp [BI PROP] {P : PROP} : (True → P) ⊣⊢ P :=
270286 ⟨and_true.2 .trans imp_elim_left, imp_intro and_elim_l⟩
287+ instance [BI PROP] : LeftId (· ⊣⊢@{PROP} ·) iprop(True) imp := ⟨true_imp⟩
271288
272289@ [rocq_alias bi.impl_refl]
273290theorem imp_self [BI PROP] {P Q : PROP} : Q ⊢ P → P := imp_intro and_elim_r
@@ -373,7 +390,7 @@ instance bi_and_monoid [BI PROP] : LawfulBigOp and (iprop(True) : PROP) BiEntail
373390 trans h1 h2 := h1.trans h2
374391 comm := and_comm
375392 assoc := and_assoc
376- left_id := true_and
393+ left_id := left_id
377394 congr_l := and_congr_left
378395
379396/-! # BI -/
@@ -418,11 +435,13 @@ theorem wand_congr_right [BI PROP] {P Q Q' : PROP} (h : Q ⊣⊢ Q') : (P -∗ Q
418435
419436@ [rocq_alias bi.sep_comm]
420437theorem sep_comm [BI PROP] {P Q : PROP} : P ∗ Q ⊣⊢ Q ∗ P := ⟨sep_symm, sep_symm⟩
438+ instance [BI PROP] : Commutative (α := PROP) BiEntails sep := ⟨sep_comm⟩
421439
422440@ [rocq_alias bi.sep_assoc]
423441theorem sep_assoc [BI PROP] {P Q R : PROP} : (P ∗ Q) ∗ R ⊣⊢ P ∗ Q ∗ R :=
424442 ⟨sep_assoc_l, (sep_comm.trans <| sep_congr_left sep_comm).1 .trans <|
425443 sep_assoc_l.trans (sep_comm.trans <| sep_congr_right sep_comm).2 ⟩
444+ instance [BI PROP] : Associative (α := PROP) BiEntails sep := ⟨sep_assoc⟩
426445
427446theorem sep_left_comm [BI PROP] {P Q R : PROP} : P ∗ Q ∗ R ⊣⊢ Q ∗ P ∗ R :=
428447 sep_assoc.symm.trans <| (sep_congr_left sep_comm).trans sep_assoc
@@ -433,10 +452,12 @@ theorem sep_right_comm [BI PROP] {P Q R : PROP} : (P ∗ Q) ∗ R ⊣⊢ (P ∗
433452theorem sep_sep_sep_comm [BI PROP] {P Q R S : PROP} : (P ∗ Q) ∗ (R ∗ S) ⊣⊢ (P ∗ R) ∗ (Q ∗ S) :=
434453 sep_assoc.trans <| (sep_congr_right sep_left_comm).trans sep_assoc.symm
435454
436- #rocq_ignore bi.emp_sep "The type class LeftId in Lean is not general enough"
455+ @ [rocq_alias bi.emp_sep]
456+ instance [BI PROP] : LeftId (α := PROP) BiEntails emp sep := ⟨emp_sep⟩
437457
438- @ [rocq_alias bi.sep_emp]
439458theorem sep_emp [BI PROP] {P : PROP} : P ∗ emp ⊣⊢ P := sep_comm.trans emp_sep
459+ @ [rocq_alias bi.sep_emp]
460+ instance [BI PROP] : RightId (α := PROP) BiEntails emp sep := ⟨sep_emp⟩
440461
441462@ [rocq_alias bi.bi_sep_monoid]
442463instance bi_sep_monoid [BI PROP] : LawfulBigOp sep (emp : PROP) BiEntails where
@@ -445,7 +466,7 @@ instance bi_sep_monoid [BI PROP] : LawfulBigOp sep (emp : PROP) BiEntails where
445466 trans h1 h2 := h1.trans h2
446467 comm := sep_comm
447468 assoc := sep_assoc
448- left_id := emp_sep
469+ left_id := left_id
449470 congr_l := sep_congr_left
450471
451472@ [rocq_alias bi.True_sep_2]
@@ -466,12 +487,16 @@ theorem wand_elim_swap [BI PROP] {P Q R : PROP} (h : Q ⊢ P -∗ R) : P ∗ Q
466487@ [rocq_alias bi.wand_elim_l]
467488theorem wand_elim_left [BI PROP] {P Q : PROP} : (P -∗ Q) ∗ P ⊢ Q := wand_elim .rfl
468489
469- @ [rocq_alias bi.False_sep]
470490theorem false_sep [BI PROP] {P : PROP} : False ∗ P ⊣⊢ False :=
471491 ⟨(sep_mono_left (P' := iprop(P -∗ False)) false_elim).trans wand_elim_left, false_elim⟩
492+ @ [rocq_alias bi.False_sep]
493+ instance [BI PROP] : LeftAbsorb (· ⊣⊢@{PROP} ·) iprop(False) sep where
494+ left_absorb := false_sep
472495
473- @ [rocq_alias bi.sep_False]
474496theorem sep_false [BI PROP] {P : PROP} : P ∗ False ⊣⊢ False := sep_comm.trans false_sep
497+ @ [rocq_alias bi.sep_False]
498+ instance [BI PROP] : RightAbsorb (· ⊣⊢@{PROP} ·) iprop(False) sep where
499+ right_absorb := sep_false
475500
476501@ [rocq_alias bi.wand_elim_r]
477502theorem wand_elim_right [BI PROP] {P Q : PROP} : P ∗ (P -∗ Q) ⊢ Q := wand_elim_swap .rfl
@@ -1002,13 +1027,13 @@ theorem affinely_intro [BI PROP] {P Q : PROP} [Affine P] (h : P ⊢ Q) : P ⊢ <
10021027@ [rocq_alias bi.emp_and]
10031028theorem emp_and [BI PROP] {P : PROP} [Affine P] : emp ∧ P ⊣⊢ P :=
10041029 ⟨and_elim_r, and_intro affine .rfl⟩
1005-
1006- #rocq_ignore bi.emp_and' "The type class LeftId in Lean is not general enough"
1030+ @ [ rocq_alias bi.emp_and']
1031+ instance emp_and_biaffine [BI PROP] [BIAffine PROP] : LeftId (α := PROP) BiEntails emp and := ⟨emp_and⟩
10071032
10081033@ [rocq_alias bi.and_emp]
10091034theorem and_emp [BI PROP] {P : PROP} [Affine P] : P ∧ emp ⊣⊢ P := and_comm.trans emp_and
1010-
1011- #rocq_ignore bi.and_emp' "The type class RightId in Lean is not general enough"
1035+ @ [ rocq_alias bi.and_emp']
1036+ instance and_emp_biaffine [BI PROP] [BIAffine PROP] : RightId (α := PROP) BiEntails emp and := ⟨and_emp⟩
10121037
10131038@ [rocq_alias bi.emp_or]
10141039theorem emp_or [BI PROP] {P : PROP} [Affine P] : emp ∨ P ⊣⊢ emp := ⟨or_elim .rfl affine, or_intro_l⟩
@@ -1033,12 +1058,14 @@ instance [BI PROP] [BIAffine PROP] (P : PROP) : Absorbing P where
10331058
10341059@ [rocq_alias bi.True_sep]
10351060theorem true_sep [BI PROP] {P : PROP} [Absorbing P] : True ∗ P ⊣⊢ P := ⟨absorbing, true_sep_mpr⟩
1061+ instance [BI PROP] [BIAffine PROP] : LeftId (α := PROP) BiEntails iprop(True) sep := ⟨true_sep⟩
10361062
10371063@ [rocq_alias bi.True_sep']
10381064theorem true_sep_flip [BI PROP] {P : PROP} [Absorbing P] : P ⊣⊢ True ∗ P := true_sep.symm
10391065
10401066@ [rocq_alias bi.sep_True]
10411067theorem sep_true [BI PROP] {P : PROP} [Absorbing P] : P ∗ True ⊣⊢ P := sep_comm.trans true_sep
1068+ instance [BI PROP] [BIAffine PROP] : RightId (α := PROP) BiEntails iprop(True) sep := ⟨sep_true⟩
10421069
10431070@ [rocq_alias bi.sep_True']
10441071theorem sep_true_flip [BI PROP] {P : PROP} [Absorbing P] : P ⊣⊢ P ∗ True :=
0 commit comments