diff --git a/src/Relations.lagda b/src/Relations.lagda index 2becc014..05907e97 100644 --- a/src/Relations.lagda +++ b/src/Relations.lagda @@ -24,11 +24,11 @@ open import Data.Nat.Properties using (+-comm; +-suc) The relation *less than or equal* has an infinite number of instances. Here are a few of them: - 0 ≤ 0 0 ≤ 1 0 ≤ 2 0 ≤ 3 ... - 1 ≤ 1 1 ≤ 2 1 ≤ 3 ... - 2 ≤ 2 2 ≤ 3 ... - 3 ≤ 3 ... - ... + 0 ≤ 0 0 ≤ 1 0 ≤ 2 0 ≤ 3 ... + 1 ≤ 1 1 ≤ 2 1 ≤ 3 ... + 2 ≤ 2 2 ≤ 3 ... + 3 ≤ 3 ... + ... And yet, we can write a finite definition that encompasses all of these instances in just a few lines. Here is the diff --git a/src/RelationsAns.lagda b/src/RelationsAns.lagda index fe44765d..0c76bcb0 100644 --- a/src/RelationsAns.lagda +++ b/src/RelationsAns.lagda @@ -7,7 +7,7 @@ permalink : /RelationsAns ## Imports \begin{code} -open import Relations using (_≤_; _<_; even; odd; e+e≡e) +open import Relations using (_≤_; _<_; even; odd; e+e≡e; ≤-refl; ≤-trans; +-mono-≤) import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; cong; sym) open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _≡⟨_⟩_; _∎) @@ -20,7 +20,15 @@ open even open odd \end{code} -*Trichotomy* +### Transitivity + +\begin{code} +<-trans : ∀ {m n p} → m < n → n < p → m < p +<-trans z_ : ℕ → ℕ → Set @@ -41,16 +49,39 @@ trichotomy (suc m) (suc n) with trichotomy m n ... | more m>n = more (sn) \end{code} -*Relate strict inequality to equality* +### Monotonicity \begin{code} -<-implies-≤ : ∀ {m n : ℕ} → m < n → suc m ≤ n -<-implies-≤ z