coq - 在 Coq 中正确地进行双重归纳
问题描述
我正在尝试从软件基础的归纳章节证明 plus_n_Sm 定理
Theorem succ_is_plus_1: forall n: nat, S n = n + 1.
Proof.
induction n as [| n' ind_hyp].
- simpl. reflexivity.
- simpl. rewrite <- ind_hyp. reflexivity.
Qed.
Theorem plus_n_Sm : forall n m : nat,
S (n + m) = n + (S m).
Proof.
induction n as [| n' ind_hyp ].
- induction m as [| m' ind_m ].
+ simpl. reflexivity.
+ simpl. reflexivity.
- induction m as [| m' ind_m2 ].
+ rewrite -> succ_is_plus_1 . rewrite <- plus_n_O. reflexivity.
+ rewrite -> succ_is_plus_1. rewrite <- ind_m2.
此时的输出是
1 subgoal
n' : nat
ind_hyp : forall m : nat, S (n' + m) = n' + S m
m' : nat
ind_m2 : S (S n' + m') = S n' + S m'
______________________________________(1/1)
S (S n' + m') + 1 = S n' + S (S m')
我被困在这里。我究竟做错了什么?找到两个变量的归纳证明的正确思维方式是什么?
解决方案
正如第一条评论所说,关键是对 n 的归纳就足够了, m 可以是一个常数。那么证明就很简单了。
推荐阅读
- java - 当前平台不支持系统托盘?
- java - 我的 netbeans 没有显示我的 gui
- node.js - Firebase 管理员:admin.auth().delete(uid) 未在 AVA test.after() 中解析
- ios - UISegmentedControl 的编程约束不起作用
- angular - 角材料表在列/图标上展开行单击
- python - 无法在字符串中查找子字符串的所有位置并将位置附加到列表中
- google-sheets - 如何转换此内容?
- rust - 如何禁用 proc-macros 上的警告?
- java - 数据源中的 Wildfly 12 错误
- api - 了解 openweather api 响应