Zulip Chat Archive
Stream: mathlib4
Topic: Missaligned type between Lean 3 and Lean 4 with ∃
Arien Malec (Feb 24 2023 at 23:17):
I remember reading a Zulip thread about this, but can't find it...
In Lean 4, the following:
theorem signBijAux_surj {n : ℕ} {f : Perm (Fin n)} :
∀ a ∈ finPairsLT n, ∃ b ∈ finPairsLT n, a = signBijAux f b
is being typed as {n : ℕ} {f : Perm (Fin n)} (a : (_ : Fin n) × Fin n) (a✝ : a ∈ finPairsLT n) : ∃ b, b ∈ finPairsLT n ∧ a = signBijAux f b
with an ∧
but previously was typed as:
{n : ℕ} {f : perm (fin n)} (a : Σ (a : fin n), fin n), a ∈ fin_pairs_lt n → (∃ (b : Σ (a : fin n), fin n) (H : b ∈ fin_pairs_lt n), a = f.sign_bij_aux b)
Arien Malec (Feb 24 2023 at 23:18):
I assume there's a simple fix here to make the desired types align....
Eric Wieser (Feb 24 2023 at 23:20):
Writing ∃
twice might achieve the lean 3 behavior
Eric Wieser (Feb 24 2023 at 23:20):
Though I think maybe the port is intended to make us switch to the new spelling?
Arien Malec (Feb 24 2023 at 23:47):
Maybe, but there's an upstream dependency on the signature. I fixed this by typing the exact equivalent of the Lean 3 type:
theorem signBijAux_surj {n : ℕ} {f : Perm (Fin n)} :
∀ a ∈ finPairsLT n, ∃ (b: Σ (_: Fin n), Fin n) (_H: b ∈ finPairsLT n), a = signBijAux f b
Yury G. Kudryashov (Feb 25 2023 at 04:59):
I usually change ∃ i, ∃ h : p i, _
to ∃ i, p i ∧ _
while porting.
Yaël Dillies (Feb 25 2023 at 07:03):
This sounds quite breaking, Yury. Some proofs shuffle the ∃
around.
Yury G. Kudryashov (Feb 25 2023 at 16:33):
Quite often we do this change without noticing because ∃ x ∈ s, p x
changed its meaning.
Yaël Dillies (Feb 25 2023 at 17:22):
I know, and I think we should work against it, although this will of course look much uglier :frown:
Johan Commelin (Feb 25 2023 at 17:25):
@Yaël Dillies It doesn't really seem to be a problem in practice.
Yury G. Kudryashov (Feb 25 2023 at 19:47):
If we work against it now, then we'll have to revert it back to ∃ x ∈ s, p x
later. I think that it's less work if we do it now.
Last updated: Dec 20 2023 at 11:08 UTC