0

Is there an easy way to rename an existential variable in a hypothesis? Sometimes the variable names are confusing, because the same names are reused in unrelated hypotheses.

For example, I want to change H1 : exists p : nat, n0 = p * 2 to H1 : exists pminus1 : nat, n0 = pminus1 * 2.

Max Heiber
  • 14,346
  • 12
  • 59
  • 97

1 Answers1

2

Here is a piece of code that does it:

match goal with
  an_h : @ex _ (?f) |- _ =>
  let new_f := eval lazy beta in (fun pminus_one => f pminus_one) in
  assert (my_h : @ex _ new_f) by exact an_h; clear an_h
end.
Yves
  • 3,808
  • 12
  • 12