Skip to content

Commit

Permalink
Add ≤‴-irrelevant to Data.Nat.Properties (#2503)
Browse files Browse the repository at this point in the history
* Add `≤‴-irrelevant` to `Data.Nat.Properties`

* Add <‴-irrefl and refactor using cong

* Minor simplifications

* Add to CHANGELOG
  • Loading branch information
tsung-ju authored Dec 2, 2024
1 parent 23a00fd commit 7fd48d0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ Additions to existing modules
```agda
m≤n⇒m≤n*o : ∀ o .{{_ : NonZero o}} → m ≤ n → m ≤ n * o
m≤n⇒m≤o*n : ∀ o .{{_ : NonZero o}} → m ≤ n → m ≤ o * n
<‴-irrefl : Irreflexive _≡_ _<‴_
≤‴-irrelevant : Irrelevant {A = ℕ} _≤‴_
<‴-irrelevant : Irrelevant {A = ℕ} _<‴_
>‴-irrelevant : Irrelevant {A = ℕ} _>‴_
≥‴-irrelevant : Irrelevant {A = ℕ} _≥‴_
```

adjunction between `suc` and `pred`
Expand Down
21 changes: 21 additions & 0 deletions src/Data/Nat/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,27 @@ _>‴?_ = flip _<‴?_
≤‴⇒≤ : _≤‴_ ⇒ _≤_
≤‴⇒≤ = ≤″⇒≤ ∘ ≤‴⇒≤″

<‴-irrefl : Irreflexive _≡_ _<‴_
<‴-irrefl eq = <-irrefl eq ∘ ≤‴⇒≤

≤‴-irrelevant : Irrelevant {A = ℕ} _≤‴_
≤‴-irrelevant ≤‴-refl = lemma refl
where
lemma : {m n} (e : m ≡ n) (q : m ≤‴ n) subst (m ≤‴_) e ≤‴-refl ≡ q
lemma {m} e ≤‴-refl = cong (λ e subst (m ≤‴_) e ≤‴-refl) $ ≡-irrelevant e refl
lemma refl (≤‴-step m<m) with () <‴-irrefl refl m<m
≤‴-irrelevant (≤‴-step m<m) ≤‴-refl with () <‴-irrefl refl m<m
≤‴-irrelevant (≤‴-step p) (≤‴-step q) = cong ≤‴-step $ ≤‴-irrelevant p q

<‴-irrelevant : Irrelevant {A = ℕ} _<‴_
<‴-irrelevant = ≤‴-irrelevant

>‴-irrelevant : Irrelevant {A = ℕ} _>‴_
>‴-irrelevant = ≤‴-irrelevant

≥‴-irrelevant : Irrelevant {A = ℕ} _≥‴_
≥‴-irrelevant = ≤‴-irrelevant

------------------------------------------------------------------------
-- Other properties
------------------------------------------------------------------------
Expand Down

0 comments on commit 7fd48d0

Please sign in to comment.