1

Consider the following partial proof:

Theorem test : forall (n m : nat),
  n = m -> S n = S m.
Proof.
  intros n m H.

Executing until this point gives me the following:

1 subgoal
n, m : nat
H : n = m
______________________________________(1/1)
S n = S m

I would like to remove the Ss from the goal, obtaining the goal n = m. Is there a tactic that does this?

Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
  • The current question seems to be a duplicate of [this](http://stackoverflow.com/q/37490891/2747511) question and [this one](http://stackoverflow.com/q/13749403/2747511). – Anton Trunov May 12 '17 at 20:25
  • 2
    Eventually you might find it interesting to note that this essentially is just a `match` statement, but an advanced form that uses a `return` annotation to let Coq's type system "cast" the type `S n = S n` to `S n = S m` . Try `apply (match H in (_ = n2) return (S _ = S n2) with eq_refl => eq_refl end).` – larsr May 14 '17 at 09:16

1 Answers1

6

You are looking for the f_equal tactic.

Vinz
  • 5,997
  • 1
  • 31
  • 52