Zulip Chat Archive
Stream: new members
Topic: Unaddressable names
Adam Langley (Nov 16 2022 at 23:54):
Newly in Lean 4 (I think?) automatically-named values because unaddressable. (E.g. x:cross: in tactic mode.) How does one give them names, for example when using the induction tactic?
Adam Langley (Nov 16 2022 at 23:55):
(have : type := by assumption
will find things by type, but it doesn't make sense when the type is Nat
.)
Moritz Doll (Nov 16 2022 at 23:57):
For induction it is the with
keyword: induction n with k hk,
Adam Langley (Nov 16 2022 at 23:58):
I tried induction ... with
, but Lean 4 says unknown tactic
.
Adam Langley (Nov 17 2022 at 00:01):
Ah, perhaps:
induction n with
| zero => ...
| succ n ih =>
Adam Langley (Nov 17 2022 at 00:04):
Hmm, split
creates many unaddressable names too.
Moritz Doll (Nov 17 2022 at 00:05):
oh sorry I was thinking Lean 3
Moritz Doll (Nov 17 2022 at 00:05):
in Lean 4 you can use
example (n : ℕ) : n = n := by
induction' n with k hk
· sorry
· sorry
Adam Langley (Nov 17 2022 at 00:06):
induction'
gives unknown tactic
for me. Is that part of math lib?
Moritz Doll (Nov 17 2022 at 00:06):
yes
Moritz Doll (Nov 17 2022 at 00:10):
ah the version you wrote seems to be prefered: https://leanprover-community.github.io/mathlib4_docs/Mathlib/Tactic/Cases.html
Adam Langley (Nov 17 2022 at 00:12):
Ah, thank you. Similar tricks don't seem to work with the unaddressable names coming from a split
, however.
Mario Carneiro (Nov 17 2022 at 01:52):
for split
, you can either use rename_i a b c
or next a b c =>
to name the variables produced by the split
Last updated: Dec 20 2023 at 11:08 UTC