繁体   English   中英

如何在 Coq 中添加“假定为真”的语句

[英]How to add “assumed true” statements in Coq

我试图在 CoqIDE 中添加一个自然数的定义。

Inductive nat : Set :=
  | O: nat
  | S: nat -> nat.

但我无法将其添加为“假设为真”:

forall (n m: nat, S n = S m -> n = m).

我如何添加这个?

我不完全清楚你想做什么,但你的公式在语法上不正确。 我相信你的意思是forall (nm: nat), S n = S m -> n = m (注意括号的位置)。

您的陈述实际上是可证明的,无需假设:

Lemma S_inj : forall (n m: nat), S n = S m -> n = m.
Proof. intros n m [=]. assumption. Qed.

[=] 介绍模式表达了S构造函数的内置注入性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM