I've come up with the following toy proof script:
Inductive myType : Type :=
| c : unit -> myType.
Inductive myProp : myType -> Type :=
| d : forall t, myProp (c t).
Hint Constructors myProp.
Definition myValue : myType := c tt.
Hint Unfold myValue.
Example test: myProp myValue.
Proof.
auto 1000. (* does nothing *)
unfold myValue.
trivial.
Qed.
Why do I need to manually unfold myValue
here? Shouldn't the hint suffice?
auto generally either completely solves the goal or leaves it unchanged. Use solve [ auto ] if you want a failure when they don't solve the goal. auto will fail if fail or gfail are invoked directly or indirectly, in which case setting the Ltac Debug may help you debug the failure.
This tactic applies to any goal. The argument term is a term well-formed in the local context. The tactic apply tries to match the current goal against the conclusion of the type of term . If it succeeds, then the tactic returns as many subgoals as the number of non-dependent premises of the type of term.
reflexivity. Use reflexivity when your goal is to prove that something equals itself. In this example we will prove that any term x of type Set is equal to itself.
That's because (see refman)
This [
Hint Unfold <qualid>
] adds the tacticunfold qualid
to the hint list that will only be used when the head constant of the goal is ident.
And the goal myProp myValue
has myProp
in the head position, not myValue
.
There are several ways of dealing with this:
Hint Extern 4 => constructor. (* change 4 with a cost of your choice *)
or
Hint Extern 4 => unfold myValue.
or even
Hint Extern 1 =>
match goal with
| [ |- context [myValue]] => unfold myValue
end.
@AntonTrunov is correct in his explanation on why Hint Unfold
is not used here. There is the alternative Hint Transparent
that makes the application work modulo delta for some specific constants. It seems not to be yet supported by trivial
and auto
but is supported by eauto
as you can see in the following:
Inductive myType : Type :=
| c : unit -> myType.
Inductive myProp : myType -> Type :=
| d : forall t, myProp (c t).
Hint Constructors myProp.
Definition myValue : myType := c tt.
Hint Transparent myValue.
Example test: myProp myValue.
Proof.
eauto.
Qed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With