我想在 Coq 证明脚本中编写中间引理,例如,在 SCRIPTProof. SCRIPT Qed.
本身内部 - 类似于在 Isar 中所做的。如何在 Coq 中做到这一点?例如:
have Lemma using Lemma1, Lemma2 by auto.
我知道该exact
声明并想知道是否是这样...但是我也希望像在 Isar 中一样拥有该声明的证据,have by auto
或者using Proof. LEMMA_PROOF Qed.
为了使其具体化,我试图做这些非常简单的证明:
Module small_example.
Theorem add_easy_induct_1:
forall n:nat,
n + 0 = n.
Proof.
intros.
induction n as [| n' IH].
- simpl. reflexivity.
- simpl. rewrite -> IH. reflexivity.
Qed.
Theorem plus_n_Sm :
forall n m : nat,
S (n + m) = n + (S m).
Proof.
intros n m.
induction n as [| n' IH].
- simpl. reflexivity.
- simpl. rewrite -> IH. reflexivity.
Qed.
Theorem add_comm :
forall n m : nat,
n + m = m + n.
Proof.
intros.
induction n as [| n' IH].
- simpl. rewrite -> add_easy_induct_1. reflexivity.
- simpl. rewrite -> IH. simpl. rewrite <- plus_n_Sm. reflexivity.
Qed.
End small_example
但我不确定它是如何工作的,而且效果不太好。
有关的:
- 我知道 Czar ( https://coq.discourse.group/t/what-is-the-difference-between-ssreflect-and-czar/824 ) 但 Coq afaik 不再支持。