Zulip Chat Archive
Stream: new members
Topic: Let tactic and replace
Julia Scheaffer (Oct 04 2025 at 21:25):
Is there a way use the let tactic to make a declaration and then replace all instances of that expression in the context with the new name?
I have written a short example below.
example {a b i : Nat} (f : Nat -> Nat -> Nat) : f i a < f i b := by
let g := f i
-- I would like this to happen automatically in the goal and all context items
change g a < g b
sorry -- The rest of the proof doesn't matter
Aaron Liu (Oct 04 2025 at 21:27):
set g := f i
Julia Scheaffer (Oct 04 2025 at 21:29):
:woman_facepalming:
Julia Scheaffer (Oct 04 2025 at 21:29):
thank you
Alfredo Moreira-Rosa (Oct 05 2025 at 09:47):
and you can retain the proposition using with :
example {a b i : Nat} (f : Nat -> Nat -> Nat) : f i a < f i b := by
set g := f i with hg
sorry
Robin Arnez (Oct 05 2025 at 15:59):
Just going to note this but this is also in core under:
let (eq := hg) +generalize g := f i
Last updated: Dec 20 2025 at 21:32 UTC