(****************************************************************************
                                                                             
          IEEE754  :  Paux                                                     
                                                                             
          Laurent Thery                                                      
                                                                             
  ******************************************************************************)

Require Export Digit.
Require Export Option.
Require Export Inverse_Image.
Require Export Wf_nat.
Require Import BinPos.
 
Fixpoint exp (n m : nat) {struct m} : nat :=
  match m with
  | O => 1
  | S m' => n * exp n m'
  end.
 
Theorem expPlus : forall n p q : nat, exp n (p + q) = exp n p * exp n q.
(* Goal: forall n p q : nat, @eq nat (exp n (Init.Nat.add p q)) (Init.Nat.mul (exp n p) (exp n q)) *)
intros n p; elim p; simpl in |- *; auto with arith.
(* Goal: forall (n0 : nat) (_ : forall q : nat, @eq nat (exp n (Init.Nat.add n0 q)) (Init.Nat.mul (exp n n0) (exp n q))) (q : nat), @eq nat (Init.Nat.mul n (exp n (Init.Nat.add n0 q))) (Init.Nat.mul (Init.Nat.mul n (exp n n0)) (exp n q)) *)
intros n0 H' q; rewrite mult_assoc_reverse; rewrite <- H'; auto.
Qed.
 
Fixpoint positive_exp (p n : positive) {struct n} : positive :=
  match n with
  | xH => p
  | xO n1 =>
      match positive_exp p n1 with
      | r =>
          (fun (x : positive) (_ : positive -> positive)
             (y : positive) => (x * y)%positive) r (
            fun x => x) r
      end
  | xI n1 =>
      match positive_exp p n1 with
      | r =>
          (fun (x : positive) (_ : positive -> positive)
             (y : positive) => (x * y)%positive) p (
            fun x => x)
            ((fun (x : positive)
                (_ : positive -> positive)
                (y : positive) => (x * y)%positive) r (
               fun x => x) r)
      end
  end.
 
Theorem positive_exp_correct :
 forall p n : positive,
 nat_of_P (positive_exp p n) =
 exp (nat_of_P p) (nat_of_P n).
(* Goal: forall p n : positive, @eq nat (Pos.to_nat (positive_exp p n)) (exp (Pos.to_nat p) (Pos.to_nat n)) *)
intros p n; elim n; simpl in |- *; auto.
(* Goal: forall (p0 : positive) (_ : @eq nat (Pos.to_nat (positive_exp p p0)) (exp (Pos.to_nat p) (Pos.to_nat p0))), @eq nat (Pos.to_nat (Pos.mul (positive_exp p p0) (positive_exp p p0))) (exp (Pos.to_nat p) (Pos.to_nat (xO p0))) *)
(* Goal: @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat p) (S O)) *)
intros p0 H.
repeat
 rewrite
  (fun (x y : positive) (_ : positive -> positive) =>
   nat_of_P_mult_morphism x y); simpl in |- *; 
 auto.
(* Goal: @eq nat (Init.Nat.mul (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat (positive_exp p p0)) (Pos.to_nat (positive_exp p p0)))) (Init.Nat.mul (Pos.to_nat p) (exp (Pos.to_nat p) (Pos.iter_op nat Init.Nat.add p0 (S (S O))))) *)
(* Goal: forall (p0 : positive) (_ : @eq nat (Pos.to_nat (positive_exp p p0)) (exp (Pos.to_nat p) (Pos.to_nat p0))), @eq nat (Pos.to_nat (Pos.mul (positive_exp p p0) (positive_exp p p0))) (exp (Pos.to_nat p) (Pos.to_nat (xO p0))) *)
(* Goal: @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat p) (S O)) *)
rewrite ZL6; rewrite expPlus; rewrite H; auto.
(* Goal: forall (p0 : positive) (_ : @eq nat (Pos.to_nat (positive_exp p p0)) (exp (Pos.to_nat p) (Pos.to_nat p0))), @eq nat (Pos.to_nat (Pos.mul (positive_exp p p0) (positive_exp p p0))) (exp (Pos.to_nat p) (Pos.to_nat (xO p0))) *)
(* Goal: @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat p) (S O)) *)
intros p0 H.
repeat
 rewrite
  (fun (x y : positive) (_ : positive -> positive) =>
   nat_of_P_mult_morphism x y); simpl in |- *; 
 auto.
(* Goal: @eq nat (Init.Nat.mul (Pos.to_nat (positive_exp p p0)) (Pos.to_nat (positive_exp p p0))) (exp (Pos.to_nat p) (Pos.to_nat (xO p0))) *)
(* Goal: @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat p) (S O)) *)
rewrite H; rewrite <- expPlus; rewrite <- ZL6; auto.
(* Goal: forall _ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O), le (Pos.to_nat base) (Pos.to_nat p) *)
(* Goal: forall (n : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (S n))), le (Pos.to_nat base) (Pos.to_nat p) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto.
Qed.
 
Fixpoint Pdiv (p q : positive) {struct p} :
 Option positive * Option positive :=
  match p with
  | xH =>
      match q with
      | xH => (Some _ 1%positive, None _)
      | xO r => (None _, Some _ p)
      | xI r => (None _, Some _ p)
      end
  | xI p' =>
      match Pdiv p' q with
      | (None, None) =>
          match (1 - Zpos q)%Z with
          | Z0 => (Some _ 1%positive, None _)
          | Zpos r' => (Some _ 1%positive, Some _ r')
          | Zneg r' => (None _, Some _ 1%positive)
          end
      | (None, Some r1) =>
          match (Zpos (xI r1) - Zpos q)%Z with
          | Z0 => (Some _ 1%positive, None _)
          | Zpos r' => (Some _ 1%positive, Some _ r')
          | Zneg r' => (None _, Some _ (xI r1))
          end
      | (Some q1, None) =>
          match (1 - Zpos q)%Z with
          | Z0 => (Some _ (xI q1), None _)
          | Zpos r' => (Some _ (xI q1), Some _ r')
          | Zneg r' => (Some _ (xO q1), Some _ 1%positive)
          end
      | (Some q1, Some r1) =>
          match (Zpos (xI r1) - Zpos q)%Z with
          | Z0 => (Some _ (xI q1), None _)
          | Zpos r' => (Some _ (xI q1), Some _ r')
          | Zneg r' => (Some _ (xO q1), Some _ (xI r1))
          end
      end
  | xO p' =>
      match Pdiv p' q with
      | (None, None) => (None _, None _)
      | (None, Some r1) =>
          match (Zpos (xO r1) - Zpos q)%Z with
          | Z0 => (Some _ 1%positive, None _)
          | Zpos r' => (Some _ 1%positive, Some _ r')
          | Zneg r' => (None _, Some _ (xO r1))
          end
      | (Some q1, None) => (Some _ (xO q1), None _)
      | (Some q1, Some r1) =>
          match (Zpos (xO r1) - Zpos q)%Z with
          | Z0 => (Some _ (xI q1), None _)
          | Zpos r' => (Some _ (xI q1), Some _ r')
          | Zneg r' => (Some _ (xO q1), Some _ (xO r1))
          end
      end
  end.
 
Definition oZ h := match h with
                   | None => 0
                   | Some p => nat_of_P p
                   end.
 
Theorem Pdiv_correct :
 forall p q,
 nat_of_P p =
 oZ (fst (Pdiv p q)) * nat_of_P q + oZ (snd (Pdiv p q)) /\
 oZ (snd (Pdiv p q)) < nat_of_P q.
intros p q; elim p; simpl in |- *; auto.
3: case q; simpl in |- *; try intros q1; split; auto;
    unfold nat_of_P in |- *; simpl in |- *; 
    auto with arith.
intros p'; simpl in |- *; case (Pdiv p' q); simpl in |- *;
 intros q1 r1 (H1, H2); split.
unfold nat_of_P in |- *; simpl in |- *.
rewrite ZL6; rewrite H1.
case q1; case r1; simpl in |- *.
intros r2 q2. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xI r2) q Datatypes.Eq);
 simpl in |- *; auto.
intros H3; rewrite <- (Pcompare_Eq_eq _ _ H3); simpl in |- *;
 unfold nat_of_P in |- *; simpl in |- *.
apply f_equal with (f := S); repeat rewrite (fun x y => mult_comm x (S y));
 repeat rewrite ZL6; unfold nat_of_P in |- *; 
 simpl in |- *; ring.
intros H3; unfold nat_of_P in |- *; simpl in |- *;
 repeat rewrite ZL6; unfold nat_of_P in |- *;
 repeat rewrite (fun x y => plus_comm x (S y)); simpl in |- *;
 apply f_equal with (f := S); ring.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4.
apply
 trans_equal
  with
    (nat_of_P q + nat_of_P h +
     Pmult_nat q2 2 * Pmult_nat q 1);
 [ rewrite <- nat_of_P_plus_morphism; rewrite H5; simpl in |- *;
    repeat rewrite ZL6; unfold nat_of_P in |- *;
    apply f_equal with (f := S)
 | unfold nat_of_P in |- * ]; ring.
intros r2. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare 1 q Datatypes.Eq); simpl in |- *; auto.
intros H3; rewrite <- (Pcompare_Eq_eq _ _ H3); simpl in |- *;
 repeat rewrite ZL6; unfold nat_of_P in |- *; simpl in |- *; 
 apply f_equal with (f := S);ring.
intros H3; unfold nat_of_P in |- *; simpl in |- *;
 repeat rewrite (fun x y => plus_comm x (S y));
 simpl in |- *; apply f_equal with (f := S); repeat rewrite ZL6; 
   unfold nat_of_P in |- *; simpl in |- *; ring.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply
  trans_equal
   with
     (nat_of_P q + nat_of_P h +
      Pmult_nat r2 2 * Pmult_nat q 1);
 [ rewrite <- nat_of_P_plus_morphism; rewrite H5; simpl in |- *;
    repeat rewrite ZL6; unfold nat_of_P in |- *;
    apply f_equal with (f := S)
 | unfold nat_of_P in |- * ]; ring.
intros r2. rewrite Z.pos_sub_spec; unfold Pos.compare.
 CaseEq (Pcompare (xI r2) q Datatypes.Eq); simpl in |- *;
 auto.
intros H3; rewrite <- (Pcompare_Eq_eq _ _ H3); simpl in |- *;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *; apply f_equal with (f := S); 
 ring.
intros H3; unfold nat_of_P in |- *; simpl in |- *;
 repeat rewrite ZL6; unfold nat_of_P in |- *;
 apply f_equal with (f := S); ring.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply trans_equal with (nat_of_P q + nat_of_P h);
 [ rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
    unfold nat_of_P in |- *; simpl in |- *; 
    repeat rewrite ZL6; unfold nat_of_P in |- *;
    apply f_equal with (f := S)
 | unfold nat_of_P in |- * ]; ring.
case q; simpl in |- *; auto.
generalize H2; case q1; case r1; simpl in |- *; auto.
intros r2 q2. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xI r2) q Datatypes.Eq);
 simpl in |- *; auto.
intros; apply lt_O_nat_of_P; auto.
intros H H0; apply nat_of_P_lt_Lt_compare_morphism; auto.
intros H3 H7; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply plus_lt_reg_l with (p := nat_of_P q);
 rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *;
 apply le_lt_trans with (Pmult_nat r2 1 + Pmult_nat q 1);
 auto with arith.
intros r2 HH; case q; simpl in |- *; auto.
intros p2; case p2; unfold nat_of_P in |- *; simpl in |- *;
 auto with arith.
intros p2; case p2; unfold nat_of_P in |- *; simpl in |- *;
 auto with arith.
intros r2 HH. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xI r2) q Datatypes.Eq);
 simpl in |- *.
intros; apply lt_O_nat_of_P; auto.
intros H3; apply nat_of_P_lt_Lt_compare_morphism; auto.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply plus_lt_reg_l with (p := nat_of_P q);
 rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *;
 apply le_lt_trans with (Pmult_nat r2 1 + Pmult_nat q 1);
 auto with arith.
intros HH; case q; simpl in |- *; auto.
intros p2; case p2; unfold nat_of_P in |- *; simpl in |- *;
 auto with arith.
intros p2; case p2; unfold nat_of_P in |- *; simpl in |- *;
 auto with arith.
intros p'; simpl in |- *; case (Pdiv p' q); simpl in |- *;
 intros q1 r1 (H1, H2); split.
unfold nat_of_P in |- *; simpl in |- *; rewrite ZL6; rewrite H1.
case q1; case r1; simpl in |- *; auto.
intros r2 q2. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xO r2) q Datatypes.Eq);
 simpl in |- *; auto.
intros H3; rewrite <- (Pcompare_Eq_eq _ _ H3); simpl in |- *;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *; ring.
intros H3; unfold nat_of_P in |- *; simpl in |- *;
 repeat rewrite ZL6; unfold nat_of_P in |- *; 
 ring.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply
  trans_equal
   with
     (nat_of_P q + nat_of_P h +
      Pmult_nat q2 2 * Pmult_nat q 1);
 [ rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
    unfold nat_of_P in |- *; simpl in |- *; 
    repeat rewrite ZL6; unfold nat_of_P in |- *
 | unfold nat_of_P in |- * ]; ring.
intros H3; unfold nat_of_P in |- *; simpl in |- *;
 repeat rewrite ZL6; unfold nat_of_P in |- *; 
 ring.
intros r2. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xO r2) q Datatypes.Eq); simpl in |- *;
 auto.
intros H3; rewrite <- (Pcompare_Eq_eq _ _ H3); simpl in |- *;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *; ring.
intros H3; unfold nat_of_P in |- *; simpl in |- *;
 repeat rewrite ZL6; unfold nat_of_P in |- *; 
 ring.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply trans_equal with (nat_of_P q + nat_of_P h);
 [ rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
    unfold nat_of_P in |- *; simpl in |- *; 
    repeat rewrite ZL6; unfold nat_of_P in |- *
 | unfold nat_of_P in |- * ]; ring.
generalize H2; case q1; case r1; simpl in |- *.
intros r2 q2. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xO r2) q Datatypes.Eq);
 simpl in |- *; auto.
intros; apply lt_O_nat_of_P; auto.
intros H H0; apply nat_of_P_lt_Lt_compare_morphism; auto.
intros H3 H7; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply plus_lt_reg_l with (p := nat_of_P q);
 rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
 unfold nat_of_P in |- *; simpl in |- *;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *;
 apply lt_trans with (Pmult_nat r2 1 + Pmult_nat q 1);
 auto with arith.
intros; apply lt_O_nat_of_P; auto.
intros r2 HH. rewrite Z.pos_sub_spec; unfold Pos.compare.
CaseEq (Pcompare (xO r2) q Datatypes.Eq);
 simpl in |- *.
intros; apply lt_O_nat_of_P; auto.
intros H3; apply nat_of_P_lt_Lt_compare_morphism; auto.
intros H3; case (Pminus_mask_Gt _ _ H3); intros h (H4, (H5, H6));
 unfold Pminus in |- *; rewrite H4;
 apply plus_lt_reg_l with (p := nat_of_P q);
 rewrite <- (nat_of_P_plus_morphism q); rewrite H5;
 unfold nat_of_P in |- *; simpl in |- *; repeat rewrite ZL6;
 unfold nat_of_P in |- *;
 apply lt_trans with (Pmult_nat r2 1 + Pmult_nat q 1);
 auto with arith.
auto.
Qed.
 
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.
 
Theorem Pdivless1 :
 forall bound p q base,
 Pcompare bound p Datatypes.Eq = Datatypes.Gt ->
 Pdivless bound p base q = (Some _ p, None _, 0).
intros bound p q base H; case q; simpl in |- *; auto; intros; rewrite H; auto.
Qed.
 
Theorem Pdivless2 :
 forall bound p length base,
 Pcompare bound p Datatypes.Eq <> Datatypes.Gt ->
 Pdivless bound p base length =
 match Pdiv 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 Pdivless 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 Pdivless 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 Pdivless 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 Pdivless 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.
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.
 
Theorem compare_SUP_dec :
 forall p q : positive,
 Pcompare p q Datatypes.Eq = Datatypes.Gt \/
 Pcompare p q Datatypes.Eq <> Datatypes.Gt.
intros p q; case (Pcompare p q Datatypes.Eq); auto; right; red in |- *;
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
 intros; discriminate.
Qed.
Hint Resolve lt_O_nat_of_P: arith.
 
Theorem odd_even_lem : forall p q, 2 * p + 1 <> 2 * q.
intros p; elim p; auto.
(* Goal: forall q : nat, not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) O) (S O)) (Init.Nat.mul (S (S O)) q)) *)
(* Goal: forall (n : nat) (_ : forall q : nat, not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) n) (S O)) (Init.Nat.mul (S (S O)) q))) (q : nat), not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (S n)) (S O)) (Init.Nat.mul (S (S O)) q)) *)
intros q; case q; simpl in |- *.
(* Goal: not (@eq nat (S O) O) *)
(* Goal: forall n : nat, not (@eq nat (S O) (S (Init.Nat.add n (S (Init.Nat.add n O))))) *)
(* Goal: forall (n : nat) (_ : forall q : nat, not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) n) (S O)) (Init.Nat.mul (S (S O)) q))) (q : nat), not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (S n)) (S O)) (Init.Nat.mul (S (S O)) q)) *)
red in |- *; intros; discriminate.
intros q'; rewrite (fun x y => plus_comm x (S y)); simpl in |- *; red in |- *;
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
 intros; discriminate.
(* Goal: forall (n : nat) (_ : forall q : nat, not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) n) (S O)) (Init.Nat.mul (S (S O)) q))) (q : nat), not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (S n)) (S O)) (Init.Nat.mul (S (S O)) q)) *)
intros p' H q; case q.
(* Goal: not (@eq nat (S O) O) *)
(* Goal: forall n : nat, not (@eq nat (S O) (S (Init.Nat.add n (S (Init.Nat.add n O))))) *)
(* Goal: forall (n : nat) (_ : forall q : nat, not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) n) (S O)) (Init.Nat.mul (S (S O)) q))) (q : nat), not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (S n)) (S O)) (Init.Nat.mul (S (S O)) q)) *)
simpl in |- *; red in |- *; intros; discriminate.
(* Goal: forall n : nat, not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (S p')) (S O)) (Init.Nat.mul (S (S O)) (S n))) *)
intros q'; red in |- *; intros H0; case (H q').
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) p') (S O)) (Init.Nat.mul (S (S O)) q') *)
replace (2 * q') with (2 * S q' - 2).
rewrite <- H0; simpl in |- *; auto.
repeat rewrite (fun x y => plus_comm x (S y)); simpl in |- *; auto.
simpl in |- *; repeat rewrite (fun x y => plus_comm x (S y)); simpl in |- *;
 auto.
case q'; simpl in |- *; auto.
Qed.
 
Theorem Pdivless_correct :
 forall bound p q base,
 1 < nat_of_P base ->
 nat_of_P p <= nat_of_P q ->
 nat_of_P p =
 oZ (fst (fst (Pdivless bound p base q))) *
 exp (nat_of_P base) (snd (Pdivless bound p base q)) +
 oZ (snd (fst (Pdivless bound p base q))) /\
 (oZ (fst (fst (Pdivless bound p base q))) < nat_of_P bound /\
  oZ (snd (fst (Pdivless bound p base q))) <
  exp (nat_of_P base) (snd (Pdivless bound p base q))) /\
 (forall bound',
  nat_of_P bound = nat_of_P base * bound' ->
  nat_of_P bound <= nat_of_P p ->
  nat_of_P bound <=
  nat_of_P base * oZ (fst (fst (Pdivless bound p base q)))).
intros bound p q base Hb; generalize q; pattern p in |- *;
 apply
  well_founded_ind
   with (R := fun a b => nat_of_P a < nat_of_P b); 
 auto; clear p q.
apply wf_inverse_image with (R := lt); auto.
exact lt_wf; auto.
(* Goal: forall (x : positive) (_ : forall (y : positive) (_ : lt (Pos.to_nat y) (Pos.to_nat x)) (q : positive) (_ : le (Pos.to_nat y) (Pos.to_nat q)), and (@eq nat (Pos.to_nat y) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound y base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound y base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound y base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound y base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound y base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound y base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat y)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound y base q)))))))) (q : positive) (_ : le (Pos.to_nat x) (Pos.to_nat q)), and (@eq nat (Pos.to_nat x) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound x base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound x base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound x base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound x base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound x base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound x base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat x)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound x base q))))))) *)
intros p Rec q Hq.
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))))) *)
case (compare_SUP_dec bound p); intros H1.
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))))) *)
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))))) *)
rewrite Pdivless1; auto; simpl in |- *.
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat p) (S O)) O)) (and (and (lt (Pos.to_nat p) (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p)))) *)
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))))) *)
repeat (split; auto with arith).
ring; auto.
apply nat_of_P_lt_Lt_compare_morphism; apply ZC1; auto.
intros bound' H'1 H2; Contradict H2; apply lt_not_le;
 apply nat_of_P_lt_Lt_compare_morphism; apply ZC1; 
 auto.
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))))) *)
rewrite Pdivless2; auto; simpl in |- *.
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (o, o0) := Pdiv p base in match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))))))) *)
generalize (Pdiv_correct p base); case (Pdiv p base); simpl in |- *.
(* Goal: forall (o o0 : Option positive) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ o) (Pos.to_nat base)) (oZ o0))) (lt (oZ o0) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ q1 => match o0 with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound q1 base length' in let (s2, o1) := p in match o1 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive q1) (None positive)) O end end | @None _ => match o0 with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end end)))))) *)
intros o1; case o1; simpl in |- *.
(* Goal: forall (x : positive) (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat x) (Pos.to_nat base)) (oZ o))) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) r1))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive r1)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end | @None _ => match q with | xI length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound x base length' in let (s2, o0) := p in match o0 with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive x) (None positive)) O end end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o1' o2; case o2; simpl in |- *.
(* Goal: forall (x : positive) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Pos.to_nat x))) (lt (Pos.to_nat x) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.add (Pos.mul r2 base) x))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive x)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o2' (Ho1, Ho2).
generalize Hq; case q; simpl in |- *; auto.
intros p0 Hq0;
 (cut (nat_of_P o1' <= nat_of_P p0); [ intros Hrec | idtac ]).
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
cut (nat_of_P o1' < nat_of_P p); [ intros Hrec1 | idtac ].
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
generalize (Rec _ Hrec1 _ Hrec).
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
CaseEq (Pdivless bound o1' base p0); simpl in |- *.
(* Goal: forall (p1 : prod (Option positive) (Option positive)) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat p1 n)) (_ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n)) (oZ (@snd (Option positive) (Option positive) p1)))) (and (and (lt (oZ (@fst (Option positive) (Option positive) p1)) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) p1)))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros p1; case p1; simpl in |- *.
intros o3; case o3; simpl in |- *; auto.
intros o3' o4; case o4; simpl in |- *; auto.
intros o4' n Eq1; rewrite nat_of_P_plus_morphism;
 rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Pos.to_nat o2')) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat o2')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o2') (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (S (nat_of_P o4') * nat_of_P base).
simpl in |- *; rewrite (fun x y => plus_comm x (nat_of_P y));
 auto with arith.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (nat_of_P base * 1); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
inversion Eq1.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- H0.
case (le_or_lt bound' (nat_of_P o1')); intros H'8; auto.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
Contradict H'6; auto.
apply lt_not_le; rewrite Ho1; auto.
apply
 lt_le_trans
  with
    (nat_of_P o1' * nat_of_P base + 1 * nat_of_P base);
 auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
simpl in |- *; auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- mult_plus_distr_r.
replace (nat_of_P o1' + 1) with (S (nat_of_P o1'));
 auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) bound') *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- (fun x y => mult_comm (nat_of_P x) y); auto with arith.
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite plus_comm; auto with arith.
(* Goal: @eq comparison (Pos.compare_cont Eq bound p) Gt *)
apply nat_of_P_gt_Gt_compare_complement_morphism; auto with arith.
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4; case o4; simpl in |- *.
intros o4' n Eq1; rewrite nat_of_P_plus_morphism;
 rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Pos.to_nat o2')) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat o2')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o2') (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (S (nat_of_P o4') * nat_of_P base).
simpl in |- *; rewrite (fun x y => plus_comm x (nat_of_P y));
 auto with arith.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H H0; apply (H'4 bound'); auto.
case (le_or_lt (nat_of_P bound) (nat_of_P o1')); intros H'8;
 auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (nat_of_P base * 1); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
intros bound' H H0; apply (H'4 bound'); auto.
case (le_or_lt (nat_of_P bound) (nat_of_P o1')); intros H'8;
 auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
rewrite Ho1; auto.
apply lt_le_trans with (nat_of_P o1' * 1 + nat_of_P o2');
 auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
(* Goal: lt (Pos.to_nat o1') (Init.Nat.add (Nat.add (Pos.to_nat o1') O) (Pos.to_nat o2')) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) (Pos.to_nat o2')) (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_lt_trans with (nat_of_P o1' + 0); auto with arith.
(* Goal: lt (Init.Nat.add (Pos.to_nat o1') O) (Init.Nat.add (Nat.add (Pos.to_nat o1') O) (Pos.to_nat o2')) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) (Pos.to_nat o2')) (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply plus_le_lt_compat; auto with arith.
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply mult_S_le_reg_l with (n := pred (nat_of_P base)).
(* Goal: le (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat o1')) (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat p0)) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace (S (pred (nat_of_P base))) with (nat_of_P base).
apply
 (fun p n m : nat => plus_le_reg_l n m p) with (p := nat_of_P o2').
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (plus_comm (nat_of_P o2')); simpl in |- *; auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (mult_comm (nat_of_P base)); simpl in |- *; auto with arith.
(* Goal: le (Nat.add (Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Pos.to_nat o2')) (Init.Nat.add (Pos.to_nat o2') (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0))) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- Ho1; auto with arith.
(* Goal: le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_trans with (1 := Hq0); auto with arith.
replace (nat_of_P (xI p0)) with (1 + 2 * nat_of_P p0);
 auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Init.Nat.add (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) (Pos.to_nat p0)) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) (Pos.to_nat p0)) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply plus_le_compat; auto with arith.
(* Goal: @eq nat (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (Pos.to_nat (xO p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
unfold nat_of_P in |- *; simpl in |- *; (rewrite ZL6; auto).
generalize (lt_O_nat_of_P base); case (nat_of_P base);
 simpl in |- *; auto; intros tmp; inversion tmp.
intros p0 Hq0;
 (cut (nat_of_P o1' <= nat_of_P p0); [ intros Hrec | idtac ]).
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
cut (nat_of_P o1' < nat_of_P p); [ intros Hrec1 | idtac ].
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
generalize (Rec _ Hrec1 _ Hrec).
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
CaseEq (Pdivless bound o1' base p0); simpl in |- *.
(* Goal: forall (p1 : prod (Option positive) (Option positive)) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat p1 n)) (_ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n)) (oZ (@snd (Option positive) (Option positive) p1)))) (and (and (lt (oZ (@fst (Option positive) (Option positive) p1)) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) p1)))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros p1; case p1; simpl in |- *.
intros o3; case o3; simpl in |- *; auto.
intros o3' o4; case o4; simpl in |- *; auto.
intros o4' n Eq1; rewrite nat_of_P_plus_morphism;
 rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Pos.to_nat o2')) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat o2')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o2') (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (S (nat_of_P o4') * nat_of_P base).
simpl in |- *; rewrite (fun x y => plus_comm x (nat_of_P y));
 auto with arith.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (nat_of_P base * 1); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
inversion Eq1.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- H0.
case (le_or_lt bound' (nat_of_P o1')); intros H'8; auto.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
Contradict H'6; auto.
apply lt_not_le; rewrite Ho1; auto.
apply
 lt_le_trans
  with
    (nat_of_P o1' * nat_of_P base + 1 * nat_of_P base);
 auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
simpl in |- *; auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- mult_plus_distr_r.
replace (nat_of_P o1' + 1) with (S (nat_of_P o1'));
 auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) bound') *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- (fun x y => mult_comm (nat_of_P x) y); auto with arith.
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite plus_comm; auto with arith.
(* Goal: @eq comparison (Pos.compare_cont Eq bound p) Gt *)
apply nat_of_P_gt_Gt_compare_complement_morphism; auto with arith.
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4; case o4; simpl in |- *.
intros o4' n Eq1; rewrite nat_of_P_plus_morphism;
 rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Pos.to_nat o2')) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat o2')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o2') (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (S (nat_of_P o4') * nat_of_P base).
simpl in |- *; rewrite (fun x y => plus_comm x (nat_of_P y));
 auto with arith.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H H0; apply (H'4 bound'); auto.
case (le_or_lt (nat_of_P bound) (nat_of_P o1')); intros H'8;
 auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (nat_of_P base * 1); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
rewrite Ho1; auto.
intros bound' H H0; apply (H'4 bound'); auto.
case (le_or_lt (nat_of_P bound) (nat_of_P o1')); intros H'8;
 auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
apply lt_le_trans with (nat_of_P o1' * 1 + nat_of_P o2');
 auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
(* Goal: lt (Pos.to_nat o1') (Init.Nat.add (Nat.add (Pos.to_nat o1') O) (Pos.to_nat o2')) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) (Pos.to_nat o2')) (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_lt_trans with (nat_of_P o1' + 0); auto with arith.
(* Goal: lt (Init.Nat.add (Pos.to_nat o1') O) (Init.Nat.add (Nat.add (Pos.to_nat o1') O) (Pos.to_nat o2')) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) (Pos.to_nat o2')) (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply plus_le_lt_compat; auto with arith.
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; auto with arith.
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply mult_S_le_reg_l with (n := pred (nat_of_P base)).
(* Goal: le (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat o1')) (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat p0)) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace (S (pred (nat_of_P base))) with (nat_of_P base).
apply
 (fun p n m : nat => plus_le_reg_l n m p) with (p := nat_of_P o2').
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (plus_comm (nat_of_P o2')); simpl in |- *; auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (mult_comm (nat_of_P base)); simpl in |- *; auto with arith.
(* Goal: le (Nat.add (Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Pos.to_nat o2')) (Init.Nat.add (Pos.to_nat o2') (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0))) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall _ : le (Pos.to_nat p) (Pos.to_nat xH), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match q with | xI length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xO length' => let (p, n) := Pdivless bound o1' base length' in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end | xH => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive o1') (None positive)) O end)))))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- Ho1; auto with arith.
(* Goal: le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_trans with (1 := Hq0); auto with arith.
replace (nat_of_P (xO p0)) with (0 + 2 * nat_of_P p0);
 auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Init.Nat.add (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) (Pos.to_nat p0)) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) (Pos.to_nat p0)) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply plus_le_compat; auto with arith.
(* Goal: @eq nat (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (Pos.to_nat (xO p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
unfold nat_of_P in |- *; simpl in |- *; (rewrite ZL6; auto).
generalize (lt_O_nat_of_P base); case (nat_of_P base);
 simpl in |- *; auto; intros tmp; inversion tmp.
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace (nat_of_P 1) with 1; auto with arith.
rewrite Ho1; generalize (lt_O_nat_of_P o2');
 (case (nat_of_P o2'); simpl in |- *).
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
generalize (lt_O_nat_of_P o1');
 (case (nat_of_P o1'); simpl in |- *).
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
generalize (lt_O_nat_of_P base);
 (case (nat_of_P base); simpl in |- *).
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
intros n H n0 H0 n1 H01; rewrite (fun x y => plus_comm x (S y));
 simpl in |- *.
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
generalize Hq; case q; simpl in |- *; auto.
intros p0 Hq0 (Ho1, Ho2);
 (cut (nat_of_P o1' <= nat_of_P p0); [ intros Hrec | idtac ]).
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
cut (nat_of_P o1' < nat_of_P p); [ intros Hrec1 | idtac ].
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
generalize (Rec _ Hrec1 _ Hrec).
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
CaseEq (Pdivless bound o1' base p0); simpl in |- *.
(* Goal: forall (p1 : prod (Option positive) (Option positive)) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat p1 n)) (_ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n)) (oZ (@snd (Option positive) (Option positive) p1)))) (and (and (lt (oZ (@fst (Option positive) (Option positive) p1)) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) p1)))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros p1; case p1; simpl in |- *.
intros o3; case o3; simpl in |- *; auto.
intros o3' o4; case o4; simpl in |- *; auto.
(* Goal: forall (x : positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive x)) n)) (_ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat x)) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat x) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat (Pos.mul x base))) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat (Pos.mul x base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4' n Eq1; rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_le_trans with (nat_of_P base * 1); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
inversion Eq1.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- H0.
case (le_or_lt bound' (nat_of_P o1')); intros H'8; auto.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
Contradict H'6; auto.
apply lt_not_le; rewrite Ho1; auto.
apply
 lt_le_trans
  with
    (nat_of_P o1' * nat_of_P base + 1 * nat_of_P base);
 auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
simpl in |- *; auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- mult_plus_distr_r.
replace (nat_of_P o1' + 1) with (S (nat_of_P o1'));
 auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) bound') *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- (fun x y => mult_comm (nat_of_P x) y); auto with arith.
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite plus_comm; auto with arith.
(* Goal: @eq comparison (Pos.compare_cont Eq bound p) Gt *)
apply nat_of_P_gt_Gt_compare_complement_morphism; auto with arith.
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4; case o4; simpl in |- *.
(* Goal: forall (x : positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive x)) n)) (_ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat x)) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat x) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat (Pos.mul x base))) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat (Pos.mul x base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4' n Eq1; rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H H0; apply (H'4 bound'); auto.
case (le_or_lt (nat_of_P bound) (nat_of_P o1')); intros H'8;
 auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, (H'2, H'3)).
(* Goal: and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
generalize (lt_O_nat_of_P o1'); rewrite H'1; intros tmp; inversion tmp.
rewrite Ho1; auto.
(* Goal: lt (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_lt_trans with (nat_of_P o1' * 1 + 0); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
repeat rewrite (fun x => plus_comm x 0); simpl in |- *; auto with arith.
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply mult_S_le_reg_l with (n := pred (nat_of_P base)).
(* Goal: le (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat o1')) (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat p0)) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace (S (pred (nat_of_P base))) with (nat_of_P base).
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (mult_comm (nat_of_P base)); simpl in |- *; auto with arith.
(* Goal: le (Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x => plus_comm x 0) in Ho1; simpl in Ho1; rewrite <- Ho1.
generalize Hq0; clear Hq0;
 replace (nat_of_P (xI p0)) with (2 * nat_of_P p0 + 1);
 try intros Hq0.
case (le_lt_or_eq _ _ Hq0); auto.
(* Goal: forall _ : lt (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)), le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: forall _ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)), le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => plus_comm x (S y)); intros Hl1.
(* Goal: le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: forall _ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)), le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_trans with (2 * nat_of_P p0); auto with arith.
generalize Hb Ho1; case (nat_of_P base); auto.
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
(* Goal: forall (n : nat) (_ : lt (S O) (S n)) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S n))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S n) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros base'; case base'.
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
(* Goal: forall (n : nat) (_ : lt (S O) (S (S n))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S n)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros base''; case base''.
replace (nat_of_P (xI p0)) with (1 + 2 * nat_of_P p0);
 auto with arith.
(* Goal: forall (_ : lt (S O) (S (S O))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S O)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (S O) (Init.Nat.mul (S (S O)) (Pos.to_nat p0))) (Pos.to_nat (xI p0)) *)
(* Goal: forall (n : nat) (_ : lt (S O) (S (S (S n)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S (S n))))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros Hb0 Ho0 H; Contradict H; rewrite Ho0.
(* Goal: not (@eq nat (Init.Nat.mul (Pos.to_nat o1') (S (S O))) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))) *)
(* Goal: @eq nat (Init.Nat.add (S O) (Init.Nat.mul (S (S O)) (Pos.to_nat p0))) (Pos.to_nat (xI p0)) *)
(* Goal: forall (n : nat) (_ : lt (S O) (S (S (S n)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S (S n))))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (S y)).
(* Goal: not (@eq nat (Nat.mul (S (S O)) (Pos.to_nat o1')) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))) *)
(* Goal: @eq nat (Init.Nat.add (S O) (Init.Nat.mul (S (S O)) (Pos.to_nat p0))) (Pos.to_nat (xI p0)) *)
(* Goal: forall (n : nat) (_ : lt (S O) (S (S (S n)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S (S n))))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply Compare.not_eq_sym.
(* Goal: not (@eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Nat.mul (S (S O)) (Pos.to_nat o1'))) *)
(* Goal: @eq nat (Init.Nat.add (S O) (Init.Nat.mul (S (S O)) (Pos.to_nat p0))) (Pos.to_nat (xI p0)) *)
(* Goal: forall (n : nat) (_ : lt (S O) (S (S (S n)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S (S n))))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply odd_even_lem.
(* Goal: @eq nat (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (Pos.to_nat (xO p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
unfold nat_of_P in |- *; simpl in |- *; (rewrite ZL6; auto).
(* Goal: forall (n : nat) (_ : lt (S O) (S (S (S n)))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o1') (S (S (S n))))) (_ : @eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O))), le (Pos.to_nat p) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Hb0 Ho0 H; rewrite H.
apply le_trans with (S (S n) * nat_of_P p0 + nat_of_P p0);
 auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Init.Nat.add (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) (Pos.to_nat p0)) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (S (S n)) (Pos.to_nat p0)) (Pos.to_nat p0)) (Init.Nat.mul (S (S (S n))) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Init.Nat.add (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (S O)) (Pos.to_nat (xI p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (p0 : positive) (_ : le (Pos.to_nat p) (Pos.to_nat (xO p0))) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply plus_le_compat; auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite plus_comm; simpl in |- *; auto with arith.
rewrite plus_comm; unfold nat_of_P in |- *; simpl in |- *;
 (rewrite ZL6; unfold nat_of_P in |- *; auto).
generalize (lt_O_nat_of_P base); case (nat_of_P base);
 simpl in |- *; auto; intros tmp; inversion tmp.
intros p0 Hq0 (Ho1, Ho2);
 (cut (nat_of_P o1' <= nat_of_P p0); [ intros Hrec | idtac ]).
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
cut (nat_of_P o1' < nat_of_P p); [ intros Hrec1 | idtac ].
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
generalize (Rec _ Hrec1 _ Hrec).
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound o1' base p0))))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (p, n) := Pdivless bound o1' base p0 in let (s2, o) := p in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
CaseEq (Pdivless bound o1' base p0); simpl in |- *.
(* Goal: forall (p1 : prod (Option positive) (Option positive)) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat p1 n)) (_ : and (@eq nat (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n)) (oZ (@snd (Option positive) (Option positive) p1)))) (and (and (lt (oZ (@fst (Option positive) (Option positive) p1)) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) p1)) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) p1)))))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (let (s2, o) := p1 in match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) s2 (None positive)) (S n) end))))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros p1; case p1; simpl in |- *.
intros o3; case o3; simpl in |- *; auto.
intros o3' o4; case o4; simpl in |- *; auto.
(* Goal: forall (x : positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive x)) n)) (_ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat x)) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat x) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat (Pos.mul x base))) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat (Pos.mul x base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4' n Eq1; rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace 0 with (0 * exp (nat_of_P base) n); auto with arith.
intros bound' H'5 H'6;
 case (le_or_lt (nat_of_P bound) (nat_of_P o1')); 
 intros H'7; auto.
apply (H'4 bound'); auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
inversion Eq1.
(* Goal: le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o3')) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- H0.
case (le_or_lt bound' (nat_of_P o1')); intros H'8; auto.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
Contradict H'6; auto.
apply lt_not_le; rewrite Ho1; auto.
apply
 lt_le_trans
  with
    (nat_of_P o1' * nat_of_P base + 1 * nat_of_P base);
 auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
simpl in |- *; auto with arith.
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- mult_plus_distr_r.
replace (nat_of_P o1' + 1) with (S (nat_of_P o1'));
 auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Pos.to_nat bound) *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H'5; auto with arith.
(* Goal: le (Nat.mul (S (Pos.to_nat o1')) (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) bound') *)
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite <- (fun x y => mult_comm (nat_of_P x) y); auto with arith.
(* Goal: @eq nat (S (Pos.to_nat o1')) (Init.Nat.add (Pos.to_nat o1') (S O)) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite plus_comm; auto with arith.
(* Goal: @eq comparison (Pos.compare_cont Eq bound p) Gt *)
apply nat_of_P_gt_Gt_compare_complement_morphism; auto with arith.
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4; case o4; simpl in |- *.
(* Goal: forall (x : positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive x)) n)) (_ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat x)) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat x) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Pos.to_nat (Pos.mul x base))) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat (Pos.mul x base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o4' n Eq1; rewrite nat_of_P_mult_morphism.
(* Goal: forall _ : and (@eq nat (Pos.to_nat o1') (Pos.to_nat o4')) (and (and (lt O (Pos.to_nat bound)) (lt (Pos.to_nat o4') (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))), and (@eq nat (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base))) (and (and (lt O (Pos.to_nat bound)) (lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt (Init.Nat.mul (Pos.to_nat o4') (Pos.to_nat base)) (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (fun x y => mult_comm x (nat_of_P y)); auto with arith.
intros bound' H H0; apply (H'4 bound'); auto.
case (le_or_lt (nat_of_P bound) (nat_of_P o1')); intros H'8;
 auto.
rewrite Pdivless1 in Eq1; auto.
(* Goal: le (Pos.to_nat bound) (Pos.to_nat o1') *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
discriminate.
apply nat_of_P_gt_Gt_compare_complement_morphism; auto.
(* Goal: forall (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) n)) (_ : and (@eq nat (Pos.to_nat o1') O) (and (and (lt O (Pos.to_nat bound)) (lt O (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n Eq1 (H'1, ((H'2, H'3), H'4)); repeat (split; auto).
(* Goal: @eq nat (Pos.to_nat p) O *)
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; rewrite H'1; ring.
(* Goal: lt O (Init.Nat.mul (Pos.to_nat base) (exp (Pos.to_nat base) n)) *)
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace 0 with (0 * exp (nat_of_P base) n); auto with arith.
intros bound' H H0; Contradict H0; rewrite Ho1; rewrite H'1; simpl in |- *;
 auto with arith.
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite Ho1; auto with arith.
(* Goal: lt (Pos.to_nat o1') (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_lt_trans with (nat_of_P o1' * 1 + 0); auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply mult_S_le_reg_l with (n := pred (nat_of_P base)).
(* Goal: le (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat o1')) (Init.Nat.mul (S (Init.Nat.pred (Pos.to_nat base))) (Pos.to_nat p0)) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace (S (pred (nat_of_P base))) with (nat_of_P base).
apply le_trans with (nat_of_P p); auto.
rewrite Ho1; rewrite (fun x => plus_comm x 0); simpl in |- *; auto.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite (mult_comm (nat_of_P base)); simpl in |- *; auto with arith.
(* Goal: le (Pos.to_nat p) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply le_trans with (1 := Hq0); auto with arith.
replace (nat_of_P (xO p0)) with (2 * nat_of_P p0);
 auto with arith.
(* Goal: @eq nat (Init.Nat.mul (S (S O)) (Pos.to_nat p0)) (Pos.to_nat (xO p0)) *)
(* Goal: @eq nat (Pos.to_nat base) (S (Init.Nat.pred (Pos.to_nat base))) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
unfold nat_of_P in |- *; simpl in |- *; (rewrite ZL6; auto).
generalize (lt_O_nat_of_P base); case (nat_of_P base);
 simpl in |- *; auto; intros tmp; inversion tmp.
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
replace (nat_of_P 1) with 1; auto with arith.
(* Goal: forall (_ : le (Pos.to_nat p) (S O)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros Hq0 (H, H0); Contradict Hq0.
(* Goal: not (le (Pos.to_nat p) (S O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
apply lt_not_le.
(* Goal: lt (S O) (Pos.to_nat p) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
rewrite H.
generalize (lt_O_nat_of_P o1'); case (nat_of_P o1');
 simpl in |- *; auto.
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
(* Goal: forall (n : nat) (_ : lt O (S n)), lt (S O) (Init.Nat.add (Init.Nat.add (Pos.to_nat base) (Init.Nat.mul n (Pos.to_nat base))) O) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros n H2; generalize Hb.
case (nat_of_P base); simpl in |- *; auto.
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros base'; case base'; simpl in |- *; auto with arith.
(* Goal: forall _ : lt (S O) (S O), lt (S O) (S (Init.Nat.add (Init.Nat.mul n (S O)) O)) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros tmp; Contradict tmp; auto with arith.
(* Goal: lt (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) *)
(* Goal: le (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) (Init.Nat.mul (S O) (Pos.to_nat base))) (Pos.to_nat bound) *)
(* Goal: @eq comparison (Pos.compare_cont Eq bound o1') Gt *)
(* Goal: forall (o : Option positive) (n : nat) (_ : @eq (prod (prod (Option positive) (Option positive)) nat) (Pdivless bound o1' base p0) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) o) n)) (_ : and (@eq nat (Pos.to_nat o1') (oZ o)) (and (and (lt O (Pos.to_nat bound)) (lt (oZ o) (exp (Pos.to_nat base) n))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat o1')), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O)))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r2 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive (Pos.mul r2 base))) (S n) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S n) end)))))) *)
(* Goal: lt (Pos.to_nat o1') (Pos.to_nat p) *)
(* Goal: le (Pos.to_nat o1') (Pos.to_nat p0) *)
(* Goal: forall (_ : le (Pos.to_nat p) (Pos.to_nat xH)) (_ : and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (Pos.to_nat base)) O)) (lt O (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat o1') (S O)) O)) (and (and (lt (Pos.to_nat o1') (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat o1')))) *)
(* Goal: forall (o : Option positive) (_ : and (@eq nat (Pos.to_nat p) (oZ o)) (lt (oZ o) (Pos.to_nat base))), and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat match o with | @Some _ r1 => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (Some positive r1)) (S O) | @None _ => @pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (None positive) (None positive)) (S O) end)))))) *)
intros o2; case o2; simpl in |- *; auto with arith.
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (Pos.to_nat p) (S O)) O)) (and (and (lt (Pos.to_nat p) (Pos.to_nat bound)) (lt O (S O))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (Pos.to_nat p)))) *)
(* Goal: and (@eq nat (Pos.to_nat p) (Init.Nat.add (Init.Nat.mul (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))))) (and (and (lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (Pos.to_nat bound)) (lt (oZ (@snd (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q)))) (exp (Pos.to_nat base) (@snd (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (Pdivless bound p base q))))))) *)
intros o2' (Ho1, Ho2); repeat (split; auto with arith).
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
(* Goal: forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
intros bound' H H0; Contradict Ho2.
(* Goal: not (lt (Pos.to_nat o2') (Pos.to_nat base)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
apply le_not_lt.
(* Goal: le (Pos.to_nat base) (Pos.to_nat o2') *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite <- Ho1.
(* Goal: le (Pos.to_nat base) (Pos.to_nat p) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
generalize H; case bound'.
(* Goal: forall _ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O), le (Pos.to_nat base) (Pos.to_nat p) *)
(* Goal: forall (n : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (S n))), le (Pos.to_nat base) (Pos.to_nat p) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto.
intros Eq2; generalize (lt_O_nat_of_P bound); rewrite Eq2; intros tmp;
 Contradict tmp; auto with arith.
(* Goal: forall (n : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) (S n))), le (Pos.to_nat base) (Pos.to_nat p) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
intros n Eq2; apply le_trans with (nat_of_P bound); auto with arith.
(* Goal: le (Pos.to_nat base) (Pos.to_nat bound) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite Eq2; auto with arith.
(* Goal: le (Pos.to_nat base) (Init.Nat.mul (Pos.to_nat base) (S n)) *)
(* Goal: forall _ : and (@eq nat (Pos.to_nat p) O) (lt O (Pos.to_nat base)), and (@eq nat (Pos.to_nat p) O) (and (and (lt O (Pos.to_nat bound)) (lt O (Init.Nat.mul (Pos.to_nat base) (S O)))) (forall (bound' : nat) (_ : @eq nat (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) bound')) (_ : le (Pos.to_nat bound) (Pos.to_nat p)), le (Pos.to_nat bound) (Init.Nat.mul (Pos.to_nat base) O))) *)
rewrite mult_comm; simpl in |- *; auto with arith.
intros (Ho1, Ho2); generalize (lt_O_nat_of_P p); rewrite Ho1; intros tmp;
 Contradict tmp; auto with arith.
Qed.
 
Definition PdivBound bound p base := Pdivless bound p base p.
 
Theorem PdivBound_correct :
 forall bound p base,
 1 < nat_of_P base ->
 nat_of_P p =
 oZ (fst (fst (PdivBound bound p base))) *
 exp (nat_of_P base) (snd (PdivBound bound p base)) +
 oZ (snd (fst (PdivBound bound p base))) /\
 (oZ (fst (fst (PdivBound bound p base))) < nat_of_P bound /\
  oZ (snd (fst (PdivBound bound p base))) <
  exp (nat_of_P base) (snd (PdivBound bound p base))) /\
 (forall bound',
  nat_of_P bound = nat_of_P base * bound' ->
  nat_of_P bound <= nat_of_P p ->
  nat_of_P bound <=
  nat_of_P base * oZ (fst (fst (PdivBound bound p base)))).
intros; unfold PdivBound in |- *; apply Pdivless_correct; auto.
Qed.
 
Theorem PdivBound_correct1 :
 forall bound p base,
 1 < nat_of_P base ->
 nat_of_P p =
 oZ (fst (fst (PdivBound bound p base))) *
 exp (nat_of_P base) (snd (PdivBound bound p base)) +
 oZ (snd (fst (PdivBound bound p base))).
(* Goal: forall (bound p base : positive) (_ : lt (S O) (Pos.to_nat base)), lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (PdivBound bound p base)))) (Pos.to_nat bound) *)
intros bound p base H; generalize (PdivBound_correct bound p base); intuition.
Qed.
 
Theorem PdivBound_correct2 :
 forall bound p base,
 1 < nat_of_P base ->
 oZ (fst (fst (PdivBound bound p base))) < nat_of_P bound.
(* Goal: forall (bound p base : positive) (_ : lt (S O) (Pos.to_nat base)), lt (oZ (@fst (Option positive) (Option positive) (@fst (prod (Option positive) (Option positive)) nat (PdivBound bound p base)))) (Pos.to_nat bound) *)
intros bound p base H; generalize (PdivBound_correct bound p base); intuition.
Qed.
 
Theorem PdivBound_correct3 :
 forall bound p base,
 nat_of_P p < nat_of_P bound ->
 PdivBound bound p base = (Some _ p, None _, 0).
(* Goal: forall (bound p base : positive) (_ : lt (Pos.to_nat p) (Pos.to_nat bound)), @eq (prod (prod (Option positive) (Option positive)) nat) (PdivBound bound p base) (@pair (prod (Option positive) (Option positive)) nat (@pair (Option positive) (Option positive) (Some positive p) (None positive)) O) *)
intros bound p base H; (unfold PdivBound in |- *; apply Pdivless1; auto).
(* Goal: @eq comparison (Pos.compare_cont Eq bound p) Gt *)
apply nat_of_P_gt_Gt_compare_complement_morphism; auto with arith.
Qed.
 
Theorem PdivBound_correct4 :
 forall bound p base bound',
 1 < nat_of_P base ->
 nat_of_P bound = nat_of_P base * bound' ->
 nat_of_P bound <= nat_of_P p ->
 nat_of_P bound <=
 nat_of_P base * oZ (fst (fst (PdivBound bound p base))).
intros bound p base bound' H H1 H2; case (PdivBound_correct bound p base);
 auto; intros H'1 (H'2, H'3); apply (H'3 bound'); auto with arith.
Qed.
Transparent Pdiv.
(* Eval Compute
in (PdivBound
    (anti_convert (9))
    (times1 (anti_convert (10)) [x : ?]  x (anti_convert (10)))
    (anti_convert (9))).*)
