我想通过添加一个定理来扩展 Coq'Art 中的练习 6.10,即对于所有非一月的月份,is_January 将等于 false。
我对月份的定义如下:
Inductive month : Set :=
| January : month
| February : month
| March : month
| April : month
| May : month
| June : month
| July : month
| August : month
| September : month
| October : month
| November : month
| December : month
.
Check month_rect.
我对 is_January 的定义如下:
Definition is_January (m : month) : Prop :=
match m with
| January => True
| other => False
end.
我正在执行以下操作以测试它是否正确。
Eval compute in (is_January January).
Eval compute in (is_January December).
Theorem is_January_eq_January :
forall m : month, m = January -> is_January m = True.
Proof.
intros m H.
rewrite H.
compute; reflexivity.
Qed.
我对这个定理的证明不是很满意。
Theorem is_January_neq_not_January :
forall m : month, m <> January -> is_January m = False.
Proof.
induction m.
- contradiction.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
- intro H; simpl; reflexivity.
Qed.
无论如何,Coq 中是否有在- intro H; simpl; reflexivity.
非 1 月份重复案例证明(所以我只有两个 - 或类似的东西,所以我不必重复自己)?还是我只是以错误的方式完全解决这个证明?