Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Irreflexivity and Asymmetry of WellFounded Relations #2119

Merged
merged 6 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3745,6 +3745,11 @@ This is a full list of proofs that have changed form to use irrelevant instance
* Added new proof to `Induction.WellFounded`
```agda
Acc-resp-flip-≈ : _<_ Respectsʳ (flip _≈_) → (Acc _<_) Respects _≈_

acc⇒asym : Acc _<_ x → x < y → ¬ (y < x)
wf⇒asym : WellFounded _<_ → Asymmetric _<_
wf⇒irrefl : _<_ Respects₂ _≈_ → Symmetric _≈_ →
WellFounded _<_ → Irreflexive _≈_ _<_
```

* Added new file `Relation.Binary.Reasoning.Base.Apartness`
Expand Down
22 changes: 20 additions & 2 deletions src/Induction/WellFounded.agda
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@

module Induction.WellFounded where

open import Data.Product.Base using (Σ; _,_; proj₁)
open import Data.Product.Base using (Σ; _,_; proj₁; proj₂)
open import Function.Base using (_∘_; flip; _on_)
open import Induction
open import Level using (Level; _⊔_)
open import Relation.Binary.Core using (Rel)
open import Relation.Binary.Definitions
using (Symmetric; _Respectsʳ_; _Respects_)
using (Symmetric; Asymmetric; Irreflexive; _Respects₂_;
_Respectsʳ_; _Respects_)
open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl)
open import Relation.Binary.Consequences using (asym⇒irr)
open import Relation.Unary
open import Relation.Nullary.Negation.Core using (¬_)

private
variable
Expand Down Expand Up @@ -116,6 +119,21 @@ module FixPoint
unfold-wfRec : ∀ {x} → wfRec P f x ≡ f x λ _ → wfRec P f _
unfold-wfRec {x} = f-ext x wfRecBuilder-wfRec

------------------------------------------------------------------------
-- Well-founded relations are asymmetric and irreflexive.

module _ {_<_ : Rel A r} where
acc⇒asym : ∀ {x y} → Acc _<_ x → x < y → ¬ (y < x)
acc⇒asym {x} hx =
Some.wfRec (λ x → ∀ {y} → x < y → ¬ (y < x)) (λ _ hx x<y y<x → hx y<x y<x x<y) _ hx

wf⇒asym : WellFounded _<_ → Asymmetric _<_
wf⇒asym wf = acc⇒asym (wf _)

wf⇒irrefl : {_≈_ : Rel A ℓ} → _<_ Respects₂ _≈_ →
Symmetric _≈_ → WellFounded _<_ → Irreflexive _≈_ _<_
wf⇒irrefl r s wf = asym⇒irr r s (wf⇒asym wf)

------------------------------------------------------------------------
-- It might be useful to establish proofs of Acc or Well-founded using
-- combinators such as the ones below (see, for instance,
Expand Down