Broken references to renamed errors fixed.
axiom frac_Qinv2: \forall a,b:nat.Qinv(frac (Zopp a) b) = frac (Zopp b) a.
definition sigma_Q \def \lambda n,p,f.iter_p_gen n p Q f QO Qplus.
-
+(*
theorem geometric: \forall q.\exists k.
Qlt q (sigma_Q k (\lambda x.true) (\lambda x. frac (S O) x)).
-
\ No newline at end of file
+*)
\ No newline at end of file
(* several definitions/theorems to be moved somewhere else *)
-definition ltb ≝λn,m. leb n m ∧ notb (eqb n m).
-
-theorem not_eq_to_le_to_lt: ∀n,m. n≠m → n≤m → n<m.
-intros;
-elim (le_to_or_lt_eq ? ? H1);
-[ assumption
-| elim (H H2)
-].
-qed.
-
-theorem ltb_to_Prop :
- ∀n,m.
- match ltb n m with
- [ true ⇒ n < m
- | false ⇒ n ≮ m
- ].
-intros;
-unfold ltb;
-apply leb_elim;
-apply eqb_elim;
-intros;
-simplify;
-[ rewrite < H;
- apply le_to_not_lt;
- constructor 1
-| apply (not_eq_to_le_to_lt ? ? H H1)
-| rewrite < H;
- apply le_to_not_lt;
- constructor 1
-| apply le_to_not_lt;
- generalize in match (not_le_to_lt ? ? H1);
- clear H1;
- intro;
- apply lt_to_le;
- assumption
-].
-qed.
-
-theorem ltb_elim: ∀n,m:nat. ∀P:bool → Prop.
-(n < m → (P true)) → (n ≮ m → (P false)) →
-P (ltb n m).
-intros.
-cut
-(match (ltb n m) with
-[ true ⇒ n < m
-| false ⇒ n ≮ m] → (P (ltb n m))).
-apply Hcut.apply ltb_to_Prop.
-elim (ltb n m).
-apply ((H H2)).
-apply ((H1 H2)).
-qed.
-
-theorem Not_lt_n_n: ∀n. n ≮ n.
-intro;
-unfold Not;
-intro;
-unfold lt in H;
-apply (not_le_Sn_n ? H).
-qed.
-
-theorem eq_pred_to_eq:
- ∀n,m. O < n → O < m → pred n = pred m → n = m.
-intros;
-generalize in match (eq_f ? ? S ? ? H2);
-intro;
-rewrite < S_pred in H3;
-rewrite < S_pred in H3;
-assumption.
-qed.
-
-theorem le_pred_to_le:
- ∀n,m. O < m → pred n ≤ pred m → n ≤ m.
-intros 2;
-elim n;
-[ apply le_O_n
-| simplify in H2;
- rewrite > (S_pred m);
- [ apply le_S_S;
- assumption
- | assumption
- ]
-].
-qed.
-
-theorem le_to_le_pred:
- ∀n,m. n ≤ m → pred n ≤ pred m.
-intros 2;
-elim n;
-[ simplify;
- apply le_O_n
-| simplify;
- generalize in match H1;
- clear H1;
- elim m;
- [ elim (not_le_Sn_O ? H1)
- | simplify;
- apply le_S_S_to_le;
- assumption
- ]
-].
-qed.
-
-theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n.
-intros;
-unfold Not;
-intro;
-unfold lt in H;
-unfold lt in H1;
-generalize in match (le_S_S ? ? H);
-intro;
-generalize in match (transitive_le ? ? ? H2 H1);
-intro;
-apply (not_le_Sn_n ? H3).
-qed.
-
-
-
-(* moved to nat/order.ma
-theorem lt_O_S: ∀n. O < S n.
-intro;
-unfold lt;
-apply le_S_S;
-apply le_O_n.
-qed. *)
-
-theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
-intros;
-unfold lt in H1;
-generalize in match (le_S_S_to_le ? ? H1);
-intro;
-apply cic:/matita/nat/orders/antisym_le.con;
-assumption.
-qed.
-
theorem pigeonhole:
∀n:nat.∀f:nat→nat.
(∀x,y.x≤n → y≤n → f x = f y → x=y) →
apply (ltb_elim (f (S n1)) (f a));
[ simplify;
intros;
- generalize in match (lt_S_S ? ? H5);
+ generalize in match (lt_to_lt_S_S ? ? H5);
intro;
rewrite < S_pred in H6;
[ elim (lt_n_m_to_not_lt_m_Sn ? ? H4 H6)
[ apply (H1 ? ? ? ? Hcut);
apply le_S;
assumption
- | apply eq_pred_to_eq;
+ | alias id "eq_pred_to_eq" = "cic:/matita/nat/relevant_equations/eq_pred_to_eq.con".
+apply eq_pred_to_eq;
[ apply (ltn_to_ltO ? ? H7)
| apply (ltn_to_ltO ? ? H6)
| assumption
rewrite > nat_of_exadecimal_exadecimal_of_nat in Hletin1;
elim (eq_mod_O_to_exists ? ? Hletin1); clear Hletin1;
rewrite > H1;
- rewrite > div_times_ltO; [2: autobatch | ]
+ rewrite > lt_O_to_div_times; [2: autobatch | ]
lapply (eq_f ? ? (λx.x/16) ? ? H1);
- rewrite > div_times_ltO in Hletin; [2: autobatch | ]
+ rewrite > lt_O_to_div_times in Hletin; [2: autobatch | ]
lapply (eq_f ? ? (λx.x \mod 16) ? ? H1);
rewrite > eq_mod_times_n_m_m_O in Hletin1;
elim daemon
elim b;
simplify;
[
- |*: alias id "lt_S_S" = "cic:/matita/algebra/finite_groups/lt_S_S.con".
- repeat (apply lt_S_S)
+ |*: repeat (apply lt_to_lt_S_S)
];
autobatch.
qed.
| NotL: ∀l1,l2,f.
derive 〈l1,f::l2〉 → derive 〈FNot f :: l1,l2〉.
-alias id "Nil" = "cic:/matita/list/list.ind#xpointer(1/1/1)".
let rec and_of_list l ≝
match l with
- [ Nil ⇒ FTrue
- | Cons F l' ⇒ FAnd F (and_of_list l')
+ [ nil ⇒ FTrue
+ | cons F l' ⇒ FAnd F (and_of_list l')
].
+alias id "Nil" = "cic:/matita/list/list.ind#xpointer(1/1/1)".
let rec or_of_list l ≝
match l with
[ Nil ⇒ FFalse
qed.
alias num (instance 0) = "natural number".
-alias symbol "plus" = "natural plus".
let rec size F ≝
match F with
[ FTrue ⇒ 0
let rec sizel l ≝
match l with
- [ Nil ⇒ 0
- | Cons F l' ⇒ size F + sizel l'
+ [ nil ⇒ 0
+ | cons F l' ⇒ size F + sizel l'
].
definition size_of_sequent ≝
qed.
definition symmetricb ≝
- λA:Type.λeq:A → A → bool.
- ∀x,y. eq x y = eq y x.
+ λA:Type.λeq:A → A → bool. ∀x,y. eq x y = eq y x.
theorem symmetricb_eqb: symmetricb ? eqb.
intro;
| apply NotR;
simplify in H1;
*)
-*)
qed.
*)
+definition ltb ≝λn,m. leb n m ∧ notb (eqb n m).
+
+theorem ltb_to_Prop :
+ ∀n,m.
+ match ltb n m with
+ [ true ⇒ n < m
+ | false ⇒ n ≮ m
+ ].
+intros;
+unfold ltb;
+apply leb_elim;
+apply eqb_elim;
+intros;
+simplify;
+[ rewrite < H;
+ apply le_to_not_lt;
+ constructor 1
+| apply (not_eq_to_le_to_lt ? ? H H1)
+| rewrite < H;
+ apply le_to_not_lt;
+ constructor 1
+| apply le_to_not_lt;
+ generalize in match (not_le_to_lt ? ? H1);
+ clear H1;
+ intro;
+ apply lt_to_le;
+ assumption
+].
+qed.
+
+theorem ltb_elim: ∀n,m:nat. ∀P:bool → Prop.
+(n < m → (P true)) → (n ≮ m → (P false)) →
+P (ltb n m).
+intros.
+cut
+(match (ltb n m) with
+[ true ⇒ n < m
+| false ⇒ n ≮ m] → (P (ltb n m))).
+apply Hcut.apply ltb_to_Prop.
+elim (ltb n m).
+apply ((H H2)).
+apply ((H1 H2)).
+qed.
+
let rec nat_compare n m: compare \def
match n with
[ O \Rightarrow
intros.simplify.reflexivity.
qed.
-theorem S_pred: \forall n:nat.lt O n \to eq nat n (S (pred n)).
-intro.elim n.apply False_ind.exact (not_le_Sn_O O H).
-apply eq_f.apply pred_Sn.
-qed.
-
theorem nat_compare_pred_pred:
\forall n,m:nat.lt O n \to lt O m \to
eq compare (nat_compare n m) (nat_compare (pred n) (pred m)).
apply le_times_l.
assumption.
apply le_times_r.assumption.
-alias id "not_eq_to_le_to_lt" = "cic:/matita/algebra/finite_groups/not_eq_to_le_to_lt.con".
-apply not_eq_to_le_to_lt.
+ apply not_eq_to_le_to_lt.
unfold.intro.apply H1.
rewrite < H3.
apply (witness ? r r ?).simplify.apply plus_n_O.
intros.rewrite > eq_p_ord_inv.
apply mod_plus_times.
assumption.
-qed.
\ No newline at end of file
+qed.
]
qed.
+theorem S_pred: \forall n:nat.lt O n \to eq nat n (S (pred n)).
+intro.elim n.apply False_ind.exact (not_le_Sn_O O H).
+apply eq_f.apply pred_Sn.
+qed.
+
+theorem le_pred_to_le:
+ ∀n,m. O < m → pred n ≤ pred m → n ≤ m.
+intros 2;
+elim n;
+[ apply le_O_n
+| simplify in H2;
+ rewrite > (S_pred m);
+ [ apply le_S_S;
+ assumption
+ | assumption
+ ]
+].
+qed.
+
+theorem le_to_le_pred:
+ ∀n,m. n ≤ m → pred n ≤ pred m.
+intros 2;
+elim n;
+[ simplify;
+ apply le_O_n
+| simplify;
+ generalize in match H1;
+ clear H1;
+ elim m;
+ [ elim (not_le_Sn_O ? H1)
+ | simplify;
+ apply le_S_S_to_le;
+ assumption
+ ]
+].
+qed.
+
(* le to lt or eq *)
theorem le_to_or_lt_eq : \forall n,m:nat.
n \leq m \to n < m \lor n = m.
left.unfold lt.apply le_S_S.assumption.
qed.
+theorem Not_lt_n_n: ∀n. n ≮ n.
+intro;
+unfold Not;
+intro;
+unfold lt in H;
+apply (not_le_Sn_n ? H).
+qed.
+
(* not eq *)
theorem lt_to_not_eq : \forall n,m:nat. n<m \to n \neq m.
unfold Not.intros.cut ((le (S n) m) \to False).
]
qed.
+theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n.
+intros;
+unfold Not;
+intro;
+unfold lt in H;
+unfold lt in H1;
+generalize in match (le_S_S ? ? H);
+intro;
+generalize in match (transitive_le ? ? ? H2 H1);
+intro;
+apply (not_le_Sn_n ? H3).
+qed.
+
(* le vs. lt *)
theorem lt_to_le : \forall n,m:nat. n<m \to n \leq m.
simplify.intros.unfold lt in H.elim H.
apply le_S_S.assumption.
qed.
+theorem not_eq_to_le_to_lt: ∀n,m. n≠m → n≤m → n<m.
+intros;
+elim (le_to_or_lt_eq ? ? H1);
+[ assumption
+| elim (H H2)
+].
+qed.
+
(* le elimination *)
theorem le_n_O_to_eq : \forall n:nat. n \leq O \to O=n.
intro.elim n.reflexivity.
theorem antisym_le: \forall n,m:nat. n \leq m \to m \leq n \to n=m
\def antisymmetric_le.
+theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
+intros;
+unfold lt in H1;
+generalize in match (le_S_S_to_le ? ? H1);
+intro;
+apply antisym_le;
+assumption.
+qed.
+
theorem decidable_le: \forall n,m:nat. decidable (n \leq m).
intros.
apply (nat_elim2 (\lambda n,m.decidable (n \leq m))).
rewrite > distr_times_plus.
rewrite < assoc_plus.reflexivity.
qed.
+
+theorem eq_pred_to_eq:
+ ∀n,m. O < n → O < m → pred n = pred m → n = m.
+intros;
+generalize in match (eq_f ? ? S ? ? H2);
+intro;
+rewrite < S_pred in H3;
+rewrite < S_pred in H3;
+assumption.
+qed.