Can someone explain to me what the following coq tactic is doing? case x : fun H => [|[]] // _. How would I rewrite this using destruct?
Even better, can anyone point me to somewhere in the coq documentation where the above syntax is explained?
Can someone explain to me what the following coq tactic is doing? case x : fun H => [|[]] // _. How would I rewrite this using destruct?
Even better, can anyone point me to somewhere in the coq documentation where the above syntax is explained?
The example given in the initial posting does not parse, so here is an attempt to produce a similar
casecommand, but without the syntax error.case :is part of thessreflectidiom.casename:value.does approximately the same thing asdestructvalueeqn:name. The=>is about making intro patterns in each case.Here, I will explain the behavior of the following line:
This does a destruct on
x(we expectxto be in a type with two constructors, the second constructor having an argument which is itself in an inductive type; ifxis in typenatthis will work).Now there is a subtlety from the fact that
Happears betweenxand=>. This means that theHhypothesis will be reverted to the conclusion of the goal before thecasecommand is performed.The
try easyis here to represent the//used in the ssreflect idiom. Theintros _is here to represent the_present at the end of the ssreflect line: it gets rid of the corresponding instance ofHin the remaining case, probably because this contains a useless truth.This explanation is not an exact match, because
case ... : ...performs no modifications in the goal hypotheses (except the one that was reverted), whiledestructmodifies any hypothesis wherexoccurs.Here is an example of session where both tactics behave the same: