Zulip Chat Archive
Stream: mathlib4
Topic: !4#3360 OrderDual
Jon Eugster (May 01 2023 at 12:21):
Could somebody look at my hack here:
This changes seemingly
↑toDual s.toProd.fst ≤ ↑toDual b.toProd.fst
to
↑toDual b.toProd.fst ≤ ↑toDual s.toProd.fst
and while this works as it changes some hidden OrderDual α
to α
(and the corresponding LE
instance), I think there is a lot of potential for improvement with the current OrderDual
API. Maybe somebody who knows OrderDual
better could try to golf that hack and give an educated opinion on what would need to be done here to make working with OrderDual
more pleasant.
Yaël Dillies (May 01 2023 at 12:23):
What exactly is the problem? Is it that Lean unifies things wrongly?
Yaël Dillies (May 01 2023 at 12:24):
Have you tried doing @lemma αᵒᵈ (_) _ _
(with some combination of _
and (_)
to be figured out)?
Yaël Dillies (May 01 2023 at 12:30):
The API for OrderDual
is pretty much optimal with regards to Lean 3. It seems that Lean 4's new unification algorithm is throwing a massive wrench in the gears by preventing us from using our type synonyms to dualise lemmas. The better solution would be a dedicated dualisation tactic, but that's yet to be written.
Yaël Dillies (May 01 2023 at 12:31):
What are you finding sketchy about the API?
Jon Eugster (May 01 2023 at 12:49):
I think it's just the problems caused by the new lean 4 unification algorithm I experienced here.
The porting comment saying "sketchy" was before I realized what's happening and a.toProd ≤ b.toProd → b.toProd ≤ a.toProd
seemed quite odd. I'll change that comment.
Jon Eugster (May 01 2023 at 12:56):
The lean3 proof here had basically the following three assumptions (in lean4 names)
h₁: (NonemptyInterval.toDualProd s).fst ≤ (NonemptyInterval.toDualProd b).fst
h₂: (NonemptyInterval.toDualProd s).snd ≤ (NonemptyInterval.toDualProd c).snd
h₃: s.toProd.fst ≤ s.toProd.snd
and then h₁.trans (h₃.trans h₂)
was a proof of type b.toProd.fst ≤ c.toProd.snd
, so there were a lot of implicit things going on there that don't work anymore now. It took me a while to figure out what steps where supposed to happen.
Yaël Dillies (May 01 2023 at 12:58):
Have you tried inserting docs4#OrderDual.toDual_le_toDual or docs4#OrderDual.ofDual_le_ofDual in the correct places?
Yaël Dillies (May 01 2023 at 12:59):
Those are type-correct versions of your OrderDual.le_def
Eric Wieser (May 01 2023 at 13:08):
The general rule in lean 3 was never to use defeq abuse in lemma statements, but to allow it in super-golfed proofs
Jon Eugster (May 01 2023 at 13:57):
Thanks @Yaël Dillies ! That'sthe lemma I was missing
Kevin Buzzard (May 01 2023 at 16:39):
Yes, porting sometimes indicates Lean 3 proofs which strictly speaking shoudln't typecheck, and only do because of definitional abuse.
Last updated: Dec 20 2023 at 11:08 UTC