Skip to content

[ add ] wellfoundedness of Relation.Binary.Construct.Add.Infimum.Strict #2683

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

Merged
merged 4 commits into from
Mar 27, 2025
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ Additions to existing modules
filter-↭ : ∀ (P? : Pred.Decidable P) → xs ↭ ys → filter P? xs ↭ filter P? ys
```

* In `Relation.Binary.Construct.Add.Infimum.Strict`:
```agda
<₋-accessible-⊥₋ : Acc _<₋_ ⊥₋
<₋-accessible[_] : Acc _<_ x → Acc _<₋_ [ x ]
<₋-wellFounded : WellFounded _<_ → WellFounded _<₋_
```

* In `Relation.Nullary.Decidable.Core`:
```agda
⊤-dec : Dec {a} ⊤
Expand Down
26 changes: 21 additions & 5 deletions src/Relation/Binary/Construct/Add/Infimum/Strict.agda
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
------------------------------------------------------------------------
-- The Agda standard library
--
-- The lifting of a non-strict order to incorporate a new infimum
-- The lifting of a strict order to incorporate a new infimum
------------------------------------------------------------------------

{-# OPTIONS --cubical-compatible --safe #-}
Expand All @@ -17,6 +17,7 @@ module Relation.Binary.Construct.Add.Infimum.Strict
open import Level using (_⊔_)
open import Data.Product.Base using (_,_; map)
open import Function.Base using (_∘_)
open import Induction.WellFounded using (WfRec; Acc; acc; WellFounded)
open import Relation.Binary.PropositionalEquality.Core
using (_≡_; refl; cong; subst)
import Relation.Binary.PropositionalEquality.Properties as ≡
Expand All @@ -35,6 +36,7 @@ open import Relation.Nullary.Construct.Add.Infimum
using (⊥₋; [_]; _₋; ≡-dec; []-injective)
import Relation.Nullary.Decidable.Core as Dec using (map′)


------------------------------------------------------------------------
-- Definition

Expand Down Expand Up @@ -72,14 +74,28 @@ module _ {r} {_≤_ : Rel A r} where
open NonStrict _≤_

<₋-transʳ : Trans _≤_ _<_ _<_ → Trans _≤₋_ _<₋_ _<₋_
<₋-transʳ <-transʳ (⊥₋≤ .⊥₋) (⊥₋<[ l ]) = ⊥₋<[ l ]
<₋-transʳ <-transʳ (⊥₋≤ l) [ q ] = ⊥₋<[ _ ]
<₋-transʳ <-transʳ [ p ] [ q ] = [ <-transʳ p q ]
<₋-transʳ <-transʳ (⊥₋≤ ⊥₋) q = q
<₋-transʳ <-transʳ (⊥₋≤ _) [ q ] = ⊥₋<[ _ ]
<₋-transʳ <-transʳ [ p ] [ q ] = [ <-transʳ p q ]

<₋-transˡ : Trans _<_ _≤_ _<_ → Trans _<₋_ _≤₋_ _<₋_
<₋-transˡ <-transˡ ⊥₋<[ l ] [ q ] = ⊥₋<[ _ ]
<₋-transˡ <-transˡ ⊥₋<[ _ ] [ q ] = ⊥₋<[ _ ]
<₋-transˡ <-transˡ [ p ] [ q ] = [ <-transˡ p q ]

<₋-accessible-⊥₋ : Acc _<₋_ ⊥₋
<₋-accessible-⊥₋ = acc λ()

<₋-accessible[_] : ∀ {x} → Acc _<_ x → Acc _<₋_ [ x ]
<₋-accessible[_] = acc ∘ wf-acc
where
wf-acc : ∀ {x} → Acc _<_ x → WfRec _<₋_ (Acc _<₋_) [ x ]
wf-acc _ ⊥₋<[ _ ] = <₋-accessible-⊥₋
wf-acc (acc ih) [ y<x ] = <₋-accessible[ ih y<x ]

<₋-wellFounded : WellFounded _<_ → WellFounded _<₋_
<₋-wellFounded wf ⊥₋ = <₋-accessible-⊥₋
<₋-wellFounded wf [ x ] = <₋-accessible[ wf x ]

------------------------------------------------------------------------
-- Relational properties + propositional equality

Expand Down