I am learning coq and am trying to prove equalities in peano arithmetic.
(我正在学习coq,并试图证明Peano算术中的相等性。)
I got stuck on a simple fraction law.
(我陷入了简单的分数定律。)
We know that (n + m) / 2 = n / 2 + m / 2 from primary school.
(我们从小学知道(n + m)/ 2 = n / 2 + m / 2。)
In peano arithmetic this does only hold if n and m are even (because then division produces correct results). (在Peano算术中,仅当n和m为偶数时才成立(因为除法会产生正确的结果)。)
Compute (3 / 2) + (5 / 2). (*3*)
Compute (3 + 5) / 2. (*4*)
So we define:
(因此我们定义:)
Theorem fraction_addition: forall n m: nat ,
even n -> even m -> Nat.div2 n + Nat.div2 m = Nat.div2 (n + m).
From my understanding this is a correct and provable theorem.
(据我了解,这是一个正确且可证明的定理。)
I tried an inductive proof, eg (我尝试了归纳证明,例如)
intros n m en em.
induction n.
- reflexivity.
- ???
Which gets me into the situation that
(这使我陷入这种情况)
en = even (S n)
and IHn : even n -> Nat.div2 n + Nat.div2 m = Nat.div2 (n + m)
, so i don't find a way to apply the induction hypothesis.
(en = even (S n)
和IHn : even n -> Nat.div2 n + Nat.div2 m = Nat.div2 (n + m)
,所以我没有找到适用归纳假设的方法。)
After long research of the standard library and documentation, i don't find an answer.
(经过对标准库和文档的长期研究,我没有找到答案。)
ask by Falco Winkler translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…