How do I easily rewrite nat.succ (nat.succ 0) as 2?

Viewed 114

Say my proof goal includes nat.succ (nat.succ 0), and I want to quickly rewrite it to say 2; I can define a whole new theorem:

theorem succ_succ_zero_eq_two : nat.succ (nat.succ 0) = 2 := rfl

then use that theorem with rw, but this seems very clunky. Is there any way to do this in a single line in my proof?

2 Answers

A simpler solution would use the change tactic:

change 2

See also ac_change, which can rearrange sums and products as well.

Use rw (show nat.succ (nat.succ 0) = 2, by refl),

Related