Coq 使用笔记
Coq中可分三部分:
1、vernacular:用来处理定义,使用大写字母开头,例如Theorem、Proof、Qed
2、tactics:用作证明过程,以小写字母开头,例如intros、exact
3、Gallina:用来描述定理,例如(forall A : Prop, A -> A)
基本形式
Theorem ident body: type.
Proof.
Tactics
Qed.
- 解释:
- Theorem是Coq中的一个命令,它声明了一个应该被证明的新定理;
- ident是新定理的名称;
- body是新定理的主体;
- type为类型;
- Proof开始定理的证明。在此之后需要给出完整的定理证明;
- Tactics为策略类型,接下来主要会介绍:intros, apply, inversion, split, right and left.
- Qed命令证明结尾符,表示证明完成;
- 每个Coq命令都要加上.表示结束;
- (* COMMENTS HERE *)表示注释;
1.Tactics:intros & apply
- 范例1:
1 Theorem example1: forall P:Prop,