derived_connectives.v 4.21 KB
 Jacques-Henri Jourdan committed Dec 04, 2017 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ``````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. `````` Robbert Krebbers committed Mar 04, 2018 16 ``````Class Persistent {PROP : bi} (P : PROP) := persistent : P ⊢ P. `````` Jacques-Henri Jourdan committed Dec 04, 2017 17 18 19 20 21 22 23 24 25 ``````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. `````` Robbert Krebbers committed Mar 04, 2018 26 27 28 29 ``````Notation "'' P" := (bi_affinely P) (at level 20, right associativity) : bi_scope. Notation "□ P" := ( P)%I `````` Jacques-Henri Jourdan committed Dec 04, 2017 30 31 32 33 34 35 36 37 `````` (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. `````` Jacques-Henri Jourdan committed Mar 04, 2018 38 ``````Hint Mode BiAffine ! : typeclass_instances. `````` Jacques-Henri Jourdan committed Dec 04, 2017 39 40 41 ``````Existing Instance absorbing_bi | 0. Class BiPositive (PROP : bi) := `````` Robbert Krebbers committed Mar 04, 2018 42 `````` bi_positive (P Q : PROP) : (P ∗ Q) ⊢ P ∗ Q. `````` Jacques-Henri Jourdan committed Mar 04, 2018 43 ``````Hint Mode BiPositive ! : typeclass_instances. `````` Jacques-Henri Jourdan committed Dec 04, 2017 44 45 46 47 48 `````` 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. `````` Robbert Krebbers committed Mar 04, 2018 49 50 ``````Notation "'' P" := (bi_absorbingly P) (at level 20, right associativity) : bi_scope. `````` Jacques-Henri Jourdan committed Dec 04, 2017 51 `````` `````` Robbert Krebbers committed Mar 04, 2018 52 ``````Class Absorbing {PROP : bi} (P : PROP) := absorbing : P ⊢ P. `````` Jacques-Henri Jourdan committed Dec 04, 2017 53 54 ``````Arguments Absorbing {_} _%I : simpl never. Arguments absorbing {_} _%I. `````` Jacques-Henri Jourdan committed Mar 04, 2018 55 ``````Hint Mode Absorbing + ! : typeclass_instances. `````` Jacques-Henri Jourdan committed Dec 04, 2017 56 57 `````` Definition bi_persistently_if {PROP : bi} (p : bool) (P : PROP) : PROP := `````` Robbert Krebbers committed Mar 04, 2018 58 `````` (if p then P else P)%I. `````` Jacques-Henri Jourdan committed Dec 04, 2017 59 60 61 ``````Arguments bi_persistently_if {_} !_ _%I /. Instance: Params (@bi_persistently_if) 2. Typeclasses Opaque bi_persistently_if. `````` Robbert Krebbers committed Mar 04, 2018 62 63 64 ``````Notation "'?' p P" := (bi_persistently_if p P) (at level 20, p at level 9, P at level 20, right associativity, format "'?' p P") : bi_scope. `````` Jacques-Henri Jourdan committed Dec 04, 2017 65 66 `````` Definition bi_affinely_if {PROP : bi} (p : bool) (P : PROP) : PROP := `````` Robbert Krebbers committed Mar 04, 2018 67 `````` (if p then P else P)%I. `````` Jacques-Henri Jourdan committed Dec 04, 2017 68 69 70 ``````Arguments bi_affinely_if {_} !_ _%I /. Instance: Params (@bi_affinely_if) 2. Typeclasses Opaque bi_affinely_if. `````` Robbert Krebbers committed Mar 04, 2018 71 72 73 74 75 ``````Notation "'?' p P" := (bi_affinely_if p P) (at level 20, p at level 9, P at level 20, right associativity, format "'?' p P") : bi_scope. Notation "□? p P" := (?p ?p P)%I `````` Jacques-Henri Jourdan committed Dec 04, 2017 76 77 78 79 80 81 82 83 84 85 86 87 88 89 `````` (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. `````` Jacques-Henri Jourdan committed Dec 04, 2017 90 91 92 93 94 ``````Definition sbi_laterN {PROP : sbi} (n : nat) (P : PROP) : PROP := Nat.iter n sbi_later P. Arguments sbi_laterN {_} !_%nat_scope _%I. Instance: Params (@sbi_laterN) 2. Notation "▷^ n P" := (sbi_laterN n P) `````` Jacques-Henri Jourdan committed Dec 04, 2017 95 `````` (at level 20, n at level 9, P at level 20, format "▷^ n P") : bi_scope. `````` Jacques-Henri Jourdan committed Dec 04, 2017 96 ``````Notation "▷? p P" := (sbi_laterN (Nat.b2n p) P) `````` Jacques-Henri Jourdan committed Dec 04, 2017 97 98 `````` (at level 20, p at level 9, P at level 20, format "▷? p P") : bi_scope. `````` Jacques-Henri Jourdan committed Dec 04, 2017 99 100 101 102 103 ``````Definition sbi_except_0 {PROP : sbi} (P : PROP) : PROP := (▷ False ∨ P)%I. Arguments sbi_except_0 {_} _%I : simpl never. Notation "◇ P" := (sbi_except_0 P) (at level 20, right associativity) : bi_scope. Instance: Params (@sbi_except_0) 1. Typeclasses Opaque sbi_except_0. `````` Jacques-Henri Jourdan committed Dec 04, 2017 104 105 106 107 108 109 `````` 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.``````