是否有一种策略可以使用而不是replace在下面的示例中来简化此表达式?
Require Import Vector.
Goal forall (n b:nat) (x:t nat n), (map (fun a => plus b a) x) = x.
Proof.
intros n b x.
replace (fun a => plus b a) with (plus b) by auto.
...
Run Code Online (Sandbox Code Playgroud)
您可能正在寻找以下内容:
repeat change (fun x => ?h x) with h.
Run Code Online (Sandbox Code Playgroud)
它允许你eta减少任意 arity的功能.该解决方案使用change了处理模式的能力(?h在上面的代码中).
让我们给这个策略一个更具启发性的名字:
(* h is a dummy argument to make Coq happy, it gets shadowed with `?h` *)
Ltac eta_reduce_all_private h := repeat change (fun x => ?h x) with h.
Ltac eta_reduce_all := eta_reduce_all_private idtac.
Run Code Online (Sandbox Code Playgroud)
如果我们尝试定义eta_reduce_all如下
Ltac eta_reduce_all := repeat change (fun x => ?h x) with h.
Run Code Online (Sandbox Code Playgroud)
Coq会抱怨"无界" h.