-
Notifications
You must be signed in to change notification settings - Fork 245
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
[ add ] well-foundedness of the lifting of a relation to Maybe
?
#2682
Comments
I would buy that for length-lexicographic - else, |
Oh... it may be that I need to go back to school, but my understanding of data Lex {A : Set a} (P : Set)
(_≈_ : Rel A ℓ₁) (_≺_ : Rel A ℓ₂) :
Rel (List A) (a ⊔ ℓ₁ ⊔ ℓ₂) where
base : P → Lex P _≈_ _≺_ [] []
halt : ∀ {y ys} → Lex P _≈_ _≺_ [] (y ∷ ys)
this : ∀ {x xs y ys} (x≺y : x ≺ y) → Lex P _≈_ _≺_ (x ∷ xs) (y ∷ ys)
next : ∀ {x xs y ys} (x≈y : x ≈ y)
(xs<ys : Lex P _≈_ _≺_ xs ys) → Lex P _≈_ _≺_ (x ∷ xs) (y ∷ ys) (with This suggest that there might very well be some dissonance between rewriting conventions regarding |
@jamesmckinna I don't think we have One reasonable restriction I know is that the lexicographic order is wellfounded if we restrict to strictly decreasing lists, which in particular rules out @jwaldmann's counterexample above. |
@fredrikNordvallForsberg oops! 🤦 |
the definition of if we turn around the chain I mentioned, we get Using |
Thanks everyone for the (re)schooling! In an attempt to reverse out of this cul-de-sac, and cover my shame, let me loop back to the OP and ask: do we have the 'lifting monad' on pre-/partial orders defined anywhere? And: does it 'lift' the wellfoundedness property, or am I similarly mistaken as above? |
This "lifting" is a special case of disjoint sum: well-founded M1 + well-founded M2, |
Hmm I was a bit hasty closing the issue, as the 'better' version of lifting via union also does not seem present in the library, IIUC. But given that I'm not currently about what I do and don't understand, I'd be happy to be pointed to it if it exists, or else for a PR which contributes it... ;-) Finally: |
Modulo:
the following should actually work (?), by analogy with module _ (≈-trans : Transitive _≈_) (≺-respʳ : _≺_ Respectsʳ _≈_ ) (≺-wf : WellFounded _≺_)
where
private
_≺×ₗₑₓ<′_ : Rel (A × List A) _
_≺×ₗₑₓ<′_ = ×-Lex _≈_ _≺_ _<_
_≺×ₗₑₓ<_ : Rel (List A) _
_≺×ₗₑₓ<_ = _<₋_ _≺×ₗₑₓ<′_ on uncons
<⇒≺×ₗₑₓ< : _<_ ⇒ _≺×ₗₑₓ<_
<⇒≺×ₗₑₓ< halt = ⊥₋<[ _ , _ ]
<⇒≺×ₗₑₓ< (this x≺y) = [ inj₁ x≺y ]
<⇒≺×ₗₑₓ< (next x≈y y<x) = [ inj₂ (x≈y , y<x) ]
<-wellFounded : WellFounded _<_
≺×ₗₑₓ<-wellFounded : WellFounded _≺×ₗₑₓ<_
<-wellFounded [] = acc λ ys<[] → contradiction ys<[] xs≮[]
<-wellFounded xs@(_ ∷ _) = Subrelation.wellFounded <⇒≺×ₗₑₓ< ≺×ₗₑₓ<-wellFounded xs
≺×ₗₑₓ<-wellFounded = On.wellFounded uncons (<₋-wellFounded _≺×ₗₑₓ<′_ (×-wellFounded' ≈-trans ≺-respʳ ≺-wf <-wellFounded)) Comments welcome. |
Do we have anywhere:
_<_ {A : Set a} (R : Rel A ℓ) : Rel (Maybe A) (a ⊔ ℓ)
(naming?) defined bynothing < just x
x R y → just x < just y
WellFounded R → WellFounded _<_
If not:
Elsewhere, this is the
(_)⊥
lifting in (C)POs, but I don't seem to be able to find it.Application: wellfoundedness of
Strict
lexicographic ordering onList
, viauncons
, mimicking/extending the corresponding argument forVec
.The text was updated successfully, but these errors were encountered: