37 lines
632 B
Coq
37 lines
632 B
Coq
Check {1=2} + {1<>2}.
|
|
Require Import List.
|
|
Import ListNotations.
|
|
|
|
Fixpoint fibo (n:nat):nat :=
|
|
match n with
|
|
| O => 0
|
|
| S n' =>
|
|
match n' with
|
|
| O => 1
|
|
| S n'' => (fibo n') + (fibo n'')
|
|
end
|
|
end.
|
|
|
|
Compute fold_right (fun x acc => (fibo x)::acc)
|
|
[] [0;1;2;3;4;5;6;7].
|
|
|
|
Theorem th: forall n0 n1 n2:nat,
|
|
n2 = S n1 -> n1 = S n0 ->
|
|
let n0n2 := (fibo n0)*(fibo n2) in
|
|
let fn1 := (fibo n1) in
|
|
{n0n2 = (fn1*fn1)+1} + {n0n2 = (fn1*fn1)-1}.
|
|
Proof.
|
|
intros.
|
|
unfold n0n2.
|
|
unfold fn1.
|
|
right.
|
|
induction n0.
|
|
- simpl.
|
|
induction n1.
|
|
+ reflexivity.
|
|
+
|
|
|
|
left.
|
|
induction n1.
|
|
- simpl.
|