[英]Is it possible to prove oddb 0 = true?? coq
I have define an odd like this:我已经定义了一个像这样的奇数:
Inductive odd : nat -> Prop :=
| odd_1 : odd 1
| odd_S : forall n:nat, odd n -> odd (n + 1).
And below is testing if a number is odd or not.下面是测试一个数字是否为奇数。
Fixpoint oddb (n : nat) { struct n } : bool :=
match n with
| 0 => false
| 1 => true
| S (S n) => oddb n
end.
I am trying to prove this:我试图证明这一点:
Theorem odd_is_odd:
forall n, (oddb n = true) -> odd n.
Proof.
intros n. induction n.
- simpl. intro H. exfalso. inversion H.
- intro H. rewrite s_is_plus_one. constructor. apply IHn. destruct n.
*
But i got stuck here... it needs me prove oddb 0 = true which is false = true.. is it possible???但我被困在这里......它需要我证明oddb 0 = true 这是false = true ..有可能吗?
1 subgoal
IHn : oddb 0 = true -> odd 0
H : oddb 1 = true
______________________________________(1/1)
oddb 0 = true
Below is the lemma I used下面是我使用的引理
Lemma s_is_plus_one : forall n:nat, S n = n + 1.
Proof.
intros. induction n.
- reflexivity.
- simpl. rewrite <- IHn. reflexivity.
Qed.
Your definition of odd
seems wrong.您对odd
的定义似乎是错误的。 Is it not n+2
.不是n+2
吗? Anyway our problem is related to How to prove a odd number is the successor of double of nat in coq?无论如何,我们的问题与如何证明奇数是 coq 中 nat 的 double 的后继有关?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.