Zulip Chat Archive

Stream: mathlib4

Topic: Proof equalities


Violeta Hernández (Jan 19 2025 at 16:35):

There's a few other things about Logic.Basic that perplex me

Violeta Hernández (Jan 19 2025 at 16:36):

What's going on with docs#congr_refl_left and co? Surely a lemma that states two proofs are equal is entirely useless in Lean?

Violeta Hernández (Jan 19 2025 at 16:37):

And it's not like the proof of these equalities are hiding any interesting mathematical reasoning either, they're all just rfl

Eric Wieser (Jan 19 2025 at 16:38):

In theory such lemmas are useful for constructing a rfl with the correct LHS and RHS

Eric Wieser (Jan 19 2025 at 16:38):

Probably these are inherited from Lean 3 core, perhaps where they were used internally by tactics

Eric Wieser (Jan 19 2025 at 16:38):

Or even from the HoTT mode in Lean 2

Eric Wieser (Jan 19 2025 at 16:38):

(I think this probably is deserving of its own thread with a better title, feel free to move these last few messages)

Notification Bot (Jan 19 2025 at 16:40):

7 messages were moved here from #mathlib4 > Decidable namespace by Violeta Hernández.

Violeta Hernández (Jan 19 2025 at 16:41):

These lemmas were added by @Kim Morrison here: https://github.com/leanprover-community/mathlib3/commit/8b8a5a27094f80607f7ee48c91d3bb899e95342c

Violeta Hernández (Jan 19 2025 at 16:43):

I don't really understand the reasoning, but I think they might be logical versions of categorical theorems?

Violeta Hernández (Jan 19 2025 at 16:45):

Also worth mentioning that they were originally tagged simp, but simp doesn't do proof rewrites so they didn't do anything

Eric Wieser (Jan 19 2025 at 16:54):

Can simp be told to do proof rewrites via an option?

Eric Wieser (Jan 19 2025 at 16:55):

I think the argument is that these simp lemmas (if applied) let Eq.mpr h reduce, because they convert h into a rfl term.

Violeta Hernández (Jan 19 2025 at 17:02):

Arguably in most real-world scenarios, if you have h : α = β with α and β def-eq, simp should be able to reduce both to the same expression

Violeta Hernández (Jan 19 2025 at 17:04):

Though actually! It seems like simp might be able to see through def-eqs like this

Violeta Hernández (Jan 19 2025 at 17:04):

def id' (x : α) := x

example (x : α) : x = id' x := by simp -- simp doesn't know this!
example (h : α = id' α) (x : α) : x = cast h x := by simp -- still works

Violeta Hernández (Jan 19 2025 at 17:08):

I really can't see any possible use for these theorems
#20849

Yakov Pechersky (Jan 19 2025 at 17:57):

Not sure why you claim they aren't useful. They specify the behavior of congr_fun and congr_arg.

Yakov Pechersky (Jan 19 2025 at 17:58):

And this could be useful in an expression construction metaprogram.

Violeta Hernández (Jan 19 2025 at 21:37):

Well, these theorems are currently entirely unused. So at the very least they're not useful in current Mathlib.

Violeta Hernández (Jan 19 2025 at 21:39):

I concede that there might be very niche use cases with Eq.rec and such that warrant equalities between proofs, but maybe we shouldn't go around adding them unless we actually need them

Eric Wieser (Jan 20 2025 at 01:13):

When you're in DTT hell, the last thing you want is missing lemmas

Eric Wieser (Jan 20 2025 at 01:13):

Lemmas can be useful even if they never actually end up in proofs committed to mathlib; you might use them while searching for a proof or correcting a statement

Kent Van Vels (Jan 29 2025 at 06:07):

@Violeta Hernández wrote,

theorems are currently entirely unused.

How do you know that? I am not arguing, I am genuinely curious to know how to know that. Did you comment them out and build mathlib? I am interested to know. Thanks.

Violeta Hernández (Jan 29 2025 at 07:06):

I made a PR deprecating them, and it builds with no warnings

Yury G. Kudryashov (Feb 13 2025 at 06:02):

@Eric Wieser Do you have any example of a proof that can actually use a proof-rewriting lemma (one of these or another one)?


Last updated: May 02 2025 at 03:31 UTC