我想出了以下玩具证明脚本:
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.
Run Code Online (Sandbox Code Playgroud)
为什么我需要在myValue
这里手动展开?提示是否足够?
这是因为(请参阅refman)
此[
Hint Unfold <qualid>
]将策略添加unfold qualid
到提示列表中,该列表仅在标识目标的开头常量时才使用。
而目标myProp myValue
具有myProp
在头部位置,不会myValue
。
有几种解决方法:
Hint Extern 4 => constructor. (* change 4 with a cost of your choice *)
Run Code Online (Sandbox Code Playgroud)
要么
Hint Extern 4 => unfold myValue.
Run Code Online (Sandbox Code Playgroud)
甚至
Hint Extern 1 =>
match goal with
| [ |- context [myValue]] => unfold myValue
end.
Run Code Online (Sandbox Code Playgroud)