|
8 | 8 |
|
9 | 9 | module Induction.WellFounded where
|
10 | 10 |
|
11 |
| -open import Data.Product.Base using (Σ; _,_; proj₁) |
| 11 | +open import Data.Product.Base using (Σ; _,_; proj₁; proj₂) |
12 | 12 | open import Function.Base using (_∘_; flip; _on_)
|
13 | 13 | open import Induction
|
14 | 14 | open import Level using (Level; _⊔_)
|
15 | 15 | open import Relation.Binary.Core using (Rel)
|
16 | 16 | open import Relation.Binary.Definitions
|
17 |
| - using (Symmetric; _Respectsʳ_; _Respects_) |
| 17 | + using (Symmetric; Asymmetric; Irreflexive; _Respects₂_; |
| 18 | + _Respectsʳ_; _Respects_) |
18 | 19 | open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl)
|
| 20 | +open import Relation.Binary.Consequences using (asym⇒irr) |
19 | 21 | open import Relation.Unary
|
| 22 | +open import Relation.Nullary.Negation.Core using (¬_) |
20 | 23 |
|
21 | 24 | private
|
22 | 25 | variable
|
@@ -116,6 +119,21 @@ module FixPoint
|
116 | 119 | unfold-wfRec : ∀ {x} → wfRec P f x ≡ f x λ _ → wfRec P f _
|
117 | 120 | unfold-wfRec {x} = f-ext x wfRecBuilder-wfRec
|
118 | 121 |
|
| 122 | +------------------------------------------------------------------------ |
| 123 | +-- Well-founded relations are asymmetric and irreflexive. |
| 124 | + |
| 125 | +module _ {_<_ : Rel A r} where |
| 126 | + acc⇒asym : ∀ {x y} → Acc _<_ x → x < y → ¬ (y < x) |
| 127 | + acc⇒asym {x} hx = |
| 128 | + Some.wfRec (λ x → ∀ {y} → x < y → ¬ (y < x)) (λ _ hx x<y y<x → hx y<x y<x x<y) _ hx |
| 129 | + |
| 130 | + wf⇒asym : WellFounded _<_ → Asymmetric _<_ |
| 131 | + wf⇒asym wf = acc⇒asym (wf _) |
| 132 | + |
| 133 | + wf⇒irrefl : {_≈_ : Rel A ℓ} → _<_ Respects₂ _≈_ → |
| 134 | + Symmetric _≈_ → WellFounded _<_ → Irreflexive _≈_ _<_ |
| 135 | + wf⇒irrefl r s wf = asym⇒irr r s (wf⇒asym wf) |
| 136 | + |
119 | 137 | ------------------------------------------------------------------------
|
120 | 138 | -- It might be useful to establish proofs of Acc or Well-founded using
|
121 | 139 | -- combinators such as the ones below (see, for instance,
|
|
0 commit comments