为什么不能用Coq中的抽象值计算固定定义的表达式?

为什么不能用Coq中的抽象值计算固定定义的表达式?,coq,Coq,我需要证明一个定理: Theorem t : forall x, (fix f (n : nat) : nat := n) x = x. 一个非正式的证明将像 f is an identity function. So the result is the same as the input. 如果在intro x之后使用siml,则不会有任何更改。Coq不会尝试使用抽象值x来计算fix函数。然而,如果我对x进行归纳分析,Coq将自动计算方程的左侧,并将其减少到0和sx 为什么Coq禁止我用抽

我需要证明一个定理:

Theorem t : forall x, (fix f (n : nat) : nat := n) x = x.
一个非正式的证明将像

f is an identity function. So the result is the same as the input.
如果在
intro x
之后使用
siml
,则不会有任何更改。Coq不会尝试使用抽象值x来计算fix函数。然而,如果我对x进行归纳分析,Coq将自动计算方程的左侧,并将其减少到
0
sx

为什么Coq禁止我用抽象值x来计算fix函数?

siml
(以及所有其他计算策略)应用转换规则。由于您的目标是平等,如果您的条款是可转换的,您可以直接使用
自反性。但是
(fix f(n:nat):nat:=n)x和
x不可转换

减少
fix
的规则是物联网转换。如(第4章“归纳构造演算”§4.5.5“不动点定义”,在“归约规则”下)所述。缩减规则要求参数以构造函数开头。一般来说,这是确保终止的必要条件。手册中有一个与您类似的示例:

以下不是转换,但可以通过案例证明 分析

Coq < Goal forall t:tree, sizet t = S (sizef (sont t)).
Coq < Coq < 1 subgoal

  ============================
   forall t : tree, sizet t = S (sizef (sont t))

Coq < reflexivity. (** this one fails **)
Toplevel input, characters 0-11:
> reflexivity.
> ^^^^^^^^^^^
Error: Impossible to unify "S (sizef (sont t))" with "sizet t".

Coq < destruct t.
1 subgoal

  f : forest
  ============================
   sizet (node f) = S (sizef (sont (node f)))

Coq < reflexivity.
No more subgoals.
Theorem t : forall x, (fix f (n : nat) : nat := n) x = x.
Proof.
  destruct x; reflexivity.
Qed.