Skip to content

Commit fa1eb25

Browse files
gallaisMatthewDaggitt
authored andcommitted
[ new ] proofs that various orders are connex (#702)
1 parent 06d78af commit fa1eb25

File tree

4 files changed

+55
-6
lines changed

4 files changed

+55
-6
lines changed

CHANGELOG.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ New modules
5353
Deprecated features
5454
-------------------
5555

56+
* Renamed `Relation.Binary.Core`'s `Conn` to `Connex`.
57+
5658
* Renamed a few `-identity` lemmas in `Codata.Stream.Properties` as they were
5759
proving two streams bisimilar rather than propositionally equal.
5860
```agda
@@ -157,6 +159,11 @@ Other minor additions
157159

158160
* Added new proofs to `Data.Nat.Properties`:
159161
```agda
162+
≤-<-connex : Connex _≤_ _<_
163+
≥->-connex : Connex _≥_ _>_
164+
<-≤-connex : Connex _<_ _≤_
165+
>-≥-connex : Connex _>_ _≥_
166+
160167
1+n≢0 : suc n ≢ 0
161168
<ᵇ⇒< : T (m <ᵇ n) → m < n
162169
<⇒<ᵇ : m < n → T (m <ᵇ n)
@@ -192,7 +199,7 @@ Other minor additions
192199

193200
* Added new proof to `Relation.Binary.PropositionalEquality.Core`:
194201
```agda
195-
≢-sym : Symmetric {A = A} _≢_
202+
≢-sym : Symmetric _≢_
196203
```
197204

198205
* Added new names, functions and shorthand to `Reflection`:
@@ -232,7 +239,11 @@ Other minor additions
232239
iΠ[_∶_]_ s a ty = Π[ s ∶ (iArg a) ] ty
233240
```
234241

242+
* Added new proofs to `Relation.Binary.Consequences`:
243+
```agda
244+
flip-Connex : Connex P Q → Connex Q P
245+
```
246+
235247
* The relation `_≅_` in `Relation.Binary.HeterogeneousEquality` has
236248
been generalised so that the types of the two equal elements need not
237249
be at the same universe level.
238-

src/Data/Nat/Properties.agda

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ open import Function
2626
open import Function.Injection using (_↣_)
2727
open import Level using (0ℓ)
2828
open import Relation.Binary
29+
open import Relation.Binary.Consequences using (flip-Connex)
2930
open import Relation.Binary.PropositionalEquality
3031
open import Relation.Nullary
3132
open import Relation.Nullary.Decidable using (True; via-injection; map′)
@@ -263,6 +264,20 @@ n≤0⇒n≡0 z≤n = refl
263264
≤∧≢⇒< {_} {suc n} (s≤s m≤n) 1+m≢1+n =
264265
s≤s (≤∧≢⇒< m≤n (1+m≢1+n ∘ cong suc))
265266

267+
≤-<-connex : Connex _≤_ _<_
268+
≤-<-connex m n with m ≤? n
269+
... | yes m≤n = inj₁ m≤n
270+
... | no ¬m≤n = inj₂ (≰⇒> ¬m≤n)
271+
272+
≥->-connex : Connex _≥_ _>_
273+
≥->-connex = flip ≤-<-connex
274+
275+
<-≤-connex : Connex _<_ _≤_
276+
<-≤-connex = flip-Connex ≤-<-connex
277+
278+
>-≥-connex : Connex _>_ _≥_
279+
>-≥-connex = flip-Connex ≥->-connex
280+
266281
------------------------------------------------------------------------
267282
-- Relational properties of _<_
268283

src/Relation/Binary/Consequences.agda

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ open import Relation.Nullary using (yes; no)
1313
open import Relation.Unary using (∁)
1414
open import Function using (_∘_; flip)
1515
open import Data.Maybe.Base using (just; nothing)
16-
open import Data.Sum using (inj₁; inj₂)
16+
open import Data.Sum as Sum using (inj₁; inj₂)
1717
open import Data.Product using (_,_)
1818
open import Data.Empty using (⊥-elim)
1919

@@ -154,3 +154,10 @@ module _ {a b p q} {A : Set a} {B : Set b }
154154

155155
map-NonEmpty : P ⇒ Q NonEmpty P NonEmpty Q
156156
map-NonEmpty f x = nonEmpty (f (NonEmpty.proof x))
157+
158+
module _ {a b p q} {A : Set a} {B : Set b }
159+
{P : REL A B p} {Q : REL B A q}
160+
where
161+
162+
flip-Connex : Connex P Q Connex Q P
163+
flip-Connex f x y = Sum.swap (f y x)

src/Relation/Binary/Core.agda

+19-3
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ Asymmetric _<_ = ∀ {x y} → x < y → ¬ (y < x)
113113

114114
-- Generalised connex.
115115

116-
Conn : {a b p q} {A : Set a} {B : Set b} REL A B p REL B A q Set _
117-
Conn P Q = x y P x y ⊎ Q y x
116+
Connex : {a b p q} {A : Set a} {B : Set b} REL A B p REL B A q Set _
117+
Connex P Q = x y P x y ⊎ Q y x
118118

119119
Total : {a ℓ} {A : Set a} Rel A ℓ Set _
120-
Total _∼_ = Conn _∼_ _∼_
120+
Total _∼_ = Connex _∼_ _∼_
121121

122122
data Tri {a b c} (A : Set a) (B : Set b) (C : Set c) :
123123
Set (a ⊔ b ⊔ c) where
@@ -194,3 +194,19 @@ record IsEquivalence {a ℓ} {A : Set a}
194194

195195
reflexive : _≡_ ⇒ _≈_
196196
reflexive ≡-refl = refl
197+
198+
199+
200+
------------------------------------------------------------------------
201+
-- DEPRECATED NAMES
202+
------------------------------------------------------------------------
203+
-- Please use the new names as continuing support for the old names is
204+
-- not guaranteed.
205+
206+
-- Version 1.1
207+
208+
Conn = Connex
209+
{-# WARNING_ON_USAGE Conn
210+
"Warning: Conn was deprecated in v1.1.
211+
Please use Connex instead."
212+
#-}

0 commit comments

Comments
 (0)