Skip to content

Commit 0da5ba7

Browse files
authored
Proof that pred is right adjoint to suc on ℕ._≤_ (agda#2456)
* prove that `pred` is right adjoint to `suc` * add converse lemma for `NonZero n` * add converse lemma for `NonZero n` * rename lemmas
1 parent b6cf220 commit 0da5ba7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ Additions to existing modules
6565
++⁺ˡ : Reflexive R → ∀ zs → (_++ zs) Preserves (Pointwise R) ⟶ (Pointwise R)
6666
```
6767

68+
* New lemmas in `Data.Nat.Properties`: adjunction between `suc` and `pred`
69+
```agda
70+
suc[m]≤n⇒m≤pred[n] : suc m ≤ n → m ≤ pred n
71+
m≤pred[n]⇒suc[m]≤n : .{{NonZero n}} → m ≤ pred n → suc m ≤ n
72+
```
73+
6874
* New lemma in `Data.Vec.Properties`:
6975
```agda
7076
map-concat : map f (concat xss) ≡ concat (map (map f) xss)

src/Data/Nat/Properties.agda

+7-1
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,14 @@ _≥?_ = flip _≤?_
272272
s≤s-injective : {p q : m ≤ n} s≤s p ≡ s≤s q p ≡ q
273273
s≤s-injective refl = refl
274274

275+
suc[m]≤n⇒m≤pred[n] : suc m ≤ n m ≤ pred n
276+
suc[m]≤n⇒m≤pred[n] {n = suc _} = s≤s⁻¹
277+
278+
m≤pred[n]⇒suc[m]≤n : .{{NonZero n}} m ≤ pred n suc m ≤ n
279+
m≤pred[n]⇒suc[m]≤n {n = suc _} = s≤s
280+
275281
≤-pred : suc m ≤ suc n m ≤ n
276-
≤-pred = s≤s⁻¹
282+
≤-pred = suc[m]≤n⇒m≤pred[n]
277283

278284
m≤n⇒m≤1+n : m ≤ n m ≤ 1 + n
279285
m≤n⇒m≤1+n z≤n = z≤n

0 commit comments

Comments
 (0)