Section bugFix.
Variable
PdivAux :
positive ->
positive -> Option positive * Option positive.
Fixpoint PdivlessAux (bound p base length : positive) {struct length}
: Option positive * Option positive * nat :=
match Pcompare bound p Datatypes.Eq with
| Datatypes.Gt => (Some _ p, None _, 0)
| _ =>
match PdivAux p base with
| (None, None) => (None _, None _, 1)
| (None, Some r1) => (None _, Some _ r1, 1)
| (Some q1, None) =>
match length with
| xH => (Some _ q1, None _, 0)
| xO length' =>
match PdivlessAux bound q1 base length' with
| (s2, None, n) => (s2, None _, S n)
| (s2, Some r2, n) =>
(s2,
Some _
((fun (x : positive)
(_ : positive -> positive)
(y : positive) => (x * y)%positive) r2
(fun x => x) base), S n)
end
| xI length' =>
match PdivlessAux bound q1 base length' with
| (s2, None, n) => (s2, None _, S n)
| (s2, Some r2, n) =>
(s2,
Some _
((fun (x : positive)
(_ : positive -> positive)
(y : positive) => (x * y)%positive) r2
(fun x => x) base), S n)
end
end
| (Some q1, Some r1) =>
match length with
| xH => (Some _ q1, None _, 0)
| xO length' =>
match PdivlessAux bound q1 base length' with
| (s2, None, n) => (s2, Some _ r1, S n)
| (s2, Some r2, n) =>
(s2,
Some _
((fun (x : positive)
(_ : positive -> positive)
(y : positive) => x * y) r2 (
fun x => x) base + r1)%positive,
S n)
end
| xI length' =>
match PdivlessAux bound q1 base length' with
| (s2, None, n) => (s2, Some _ r1, S n)
| (s2, Some r2, n) =>
(s2,
Some _
((fun (x : positive)
(_ : positive -> positive)
(y : positive) => x * y) r2 (
fun x => x) base + r1)%positive,
S n)
end
end
end
end.
End bugFix.
Definition Pdivless := PdivlessAux Pdiv.
intros bound p q base H; case q; simpl in |- *; auto; intros; rewrite H; auto.
Qed.
intros bound p length base; case length; simpl in |- *;
case (Pcompare bound p Datatypes.Eq); auto;
(intros H; case H; auto; fail) || (intros p' H; case H; auto).
Qed.
intros p q; case (Pcompare p q Datatypes.Eq); auto; right; red in |- *;
intros; discriminate.
Qed.
Hint Resolve lt_O_nat_of_P: arith.

Theorem odd_even_lem : forall p q, 2 * p + 1 <> 2 * q.