我目前正在尝试编写一种策略,该策略使用可以轻松生成的术语(在此特定示例中, from tauto
)实例化存在量词。我的第一次尝试:
Ltac mytac :=
match goal with
| |- (exists (_ : ?X), _) => cut X;
[ let t := fresh "t" in intro t ; exists t; firstorder
| tauto ]
end.
这种策略将适用于一个简单的问题,例如
Lemma obv1(X : Set) : exists f : X -> X, f = f.
mytac.
Qed.
但是它不适用于像这样的目标
Lemma obv2(X : Set) : exists f : X -> X, forall x, f x = x.
mytac. (* goal becomes t x = x for arbitrary t,x *)
在这里,我想使用这种策略,相信f
which tauto
finds 将是 just fun x => x
,从而替换特定证明(应该是身份函数),而不仅仅是t
我当前脚本中的泛型。我该如何编写这样的策略?