Zulip Chat Archive

Stream: mathlib4

Topic: recursive ext in Lean 4?


Arien Malec (Jan 17 2023 at 19:50):

I'm working on the last issue for Data.Prod.TProd & the Lean 3 mathlib code is

@[ext] lemma ext :  {l : list ι} (hl : l.nodup) {v w : tprod α l}
  (hvw :  i (hi : i  l), v.elim hi = w.elim hi), v = w
| []        hl v w hvw := punit.ext
| (i :: is) hl v w hvw := begin
    ext, rw [ elim_self v, hvw, elim_self],
    refine ext (nodup_cons.mp hl).2 (λ j hj, _),
    rw [ elim_of_mem hl, hvw, elim_of_mem hl]
  end

& when I step through in the infoview, I see an ext hypothesis inserted that gets applied.

When Lean 4 sees ext it fails with no applicable extensionality lemma found for TProd α (i :: is)

How is this supposed to work in Lean 4?

Arien Malec (Jan 17 2023 at 19:58):

apply Prod.ext was the answer.

Yury G. Kudryashov (Jan 17 2023 at 22:55):

In Lean 3, ext unfolded definitions. Probably, in Lean 4 it doesn't.

Gabriel Ebner (Jan 17 2023 at 22:58):

I'd add TProd.ext_nil and TProd.ext_cons lemmas.

Yury G. Kudryashov (Jan 17 2023 at 23:16):

Am I right that we only need tprod for measure.pi?

Yury G. Kudryashov (Jan 17 2023 at 23:16):

If yes, then I have an idea how to redefine (and generalize) measure.pi without tprod.

Arien Malec (Jan 17 2023 at 23:17):

TProd has landed :-)

Arien Malec (Jan 17 2023 at 23:21):

oh, mostly landed.


Last updated: Dec 20 2023 at 11:08 UTC