Zulip Chat Archive
Stream: lean4
Topic: a stupid question
Hallon (Jan 18 2024 at 12:39):
A stupid question. I am a beginner of Lean.
Why can "rw [pow_two]" be omitted?
Code as follows:
example : x ∣ x ^ 2 := by
-- rw [pow_two]
apply dvd_mul_left
Mario Carneiro (Jan 18 2024 at 12:40):
because x ^ 2
and x * x
are definitionally equal, although this is not obvious
Mario Carneiro (Jan 18 2024 at 12:41):
x ^ 2
= x * (x ^ 1)
= x * (x * (x ^ 0))
= x * (x * 1)
= x * (x + x * 0)
= x * (x + 0)
= x * x
Mario Carneiro (Jan 18 2024 at 12:42):
where at each stage I just unfolded the recursive definition of ^
, *
or +
Hallon (Jan 18 2024 at 12:44):
I know it is definitional equal. So all equation which is definitonal equal dont need explain?
Mario Carneiro (Jan 18 2024 at 12:44):
lean will unfold definitions if required to make a theorem application typecheck
Mario Carneiro (Jan 18 2024 at 12:45):
so yes, in some circumstances
Hallon (Jan 18 2024 at 12:45):
got. thanks! :grinning:
Mario Carneiro (Jan 18 2024 at 12:46):
Many tactics like rw
are more picky about the form of the input though, which is why theorems like pow_two
exist so that you can control what the goal looks like more precisely
Hallon (Jan 18 2024 at 12:47):
uh-huh
Hallon (Jan 18 2024 at 12:48):
May I ask where you are from?
Kevin Buzzard (Jan 18 2024 at 23:34):
normally we stick to Lean questions on this forum
Yury G. Kudryashov (Jan 18 2024 at 23:42):
You can find Mario's current affiliation at this webpage. Also, his Zulip user profile has geographic coordinates which adds him to this map.
Last updated: May 02 2025 at 03:31 UTC