Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Coq, is there a way to get rid of "useless" preconditions in a hypothesis?

Tags:

coq

Sometimes due to a combination of the remember and induction tactics, I end up with hypothesis that look like a bit like this:

Heqa: a = Foo b
IH1: a = Foo b -> bla_bla_bla
IH2: a = Foo b -> ble_ble_ble

Is there a quick way to get those useless a = Foo b preconditions in IH1 and IH2 out of the way? The only way to do that that I can think of is very verbose and repetitive:

assert (IH1': a = Foo b). { apply Heqa. }
apply IH1 in IH1'. clear IH1. rename IH1' into IH1.

assert (IH2': a = Foo b). { apply Heqa. }
apply IH2 in IH2'. clear IH2. rename IH2' into IH2.
like image 595
hugomg Avatar asked Jan 06 '23 06:01

hugomg


1 Answers

You can use the specialize tactic:

specialize (IH1 Heqa).
specialize (IH2 Heqa).

will get you

Heqa: a = Foo b
IH1: bla_bla_bla
IH2: ble_ble_ble

which seems is what you want.

specialize applies some arguments to a hypothesis and rewrites it.

By the way, using a somewhat similar tactic pose proof we can keep the original hypothesis intact. More details can be found here.

like image 101
Anton Trunov Avatar answered May 16 '23 04:05

Anton Trunov