-sandwich.ma ordered_uniform.ma
-property_sigma.ma ordered_uniform.ma russell_support.ma
-uniform.ma supremum.ma
bishop_set.ma ordered_set.ma
+ordered_set.ma cprop_connectives.ma
+cprop_connectives.ma logic/equality.ma
+bishop_set_rewrite.ma bishop_set.ma
sequence.ma nat/nat.ma
-ordered_uniform.ma uniform.ma
+uniform.ma supremum.ma
supremum.ma datatypes/constructors.ma nat/plus.ma nat_ordered_set.ma sequence.ma
-property_exhaustivity.ma ordered_uniform.ma property_sigma.ma
-bishop_set_rewrite.ma bishop_set.ma
-cprop_connectives.ma logic/equality.ma
nat_ordered_set.ma bishop_set.ma nat/compare.ma
+property_sigma.ma ordered_uniform.ma russell_support.ma
+ordered_uniform.ma uniform.ma
+property_exhaustivity.ma ordered_uniform.ma property_sigma.ma
lebesgue.ma property_exhaustivity.ma sandwich.ma
-ordered_set.ma cprop_connectives.ma
+sandwich.ma ordered_uniform.ma
russell_support.ma cprop_connectives.ma nat/nat.ma
-models/nat_lebesgue.ma lebesgue.ma models/nat_order_continuous.ma
+models/nat_order_continuous.ma models/nat_dedekind_sigma_complete.ma models/nat_ordered_uniform.ma
models/nat_ordered_uniform.ma bishop_set_rewrite.ma models/nat_uniform.ma ordered_uniform.ma
-models/discrete_uniformity.ma bishop_set_rewrite.ma uniform.ma
models/q_function.ma Q/q/q.ma cprop_connectives.ma list/list.ma
-models/nat_uniform.ma models/discrete_uniformity.ma nat_ordered_set.ma
+models/discrete_uniformity.ma bishop_set_rewrite.ma uniform.ma
+models/nat_lebesgue.ma lebesgue.ma models/nat_order_continuous.ma
models/nat_dedekind_sigma_complete.ma models/nat_uniform.ma nat/le_arith.ma russell_support.ma supremum.ma
-models/nat_order_continuous.ma models/nat_dedekind_sigma_complete.ma models/nat_ordered_uniform.ma
+models/nat_uniform.ma models/discrete_uniformity.ma nat_ordered_set.ma
Q/q/q.ma
datatypes/constructors.ma
list/list.ma
interpretation "Q less or equal than" 'le x y = (qle x y).
-notation "'nth'" left associative with precedence 70 for @{'nth}.
-notation < "\nth \nbsp l \nbsp d \nbsp i" left associative with precedence 70 for @{'nth_appl $l $d $i}.
+notation "'nth'" with precedence 90 for @{'nth}.
+notation < "'nth' \nbsp l \nbsp d \nbsp i" with precedence 71
+for @{'nth_appl $l $d $i}.
interpretation "list nth" 'nth = (cic:/matita/list/list/nth.con _).
interpretation "list nth" 'nth_appl l d i = (cic:/matita/list/list/nth.con _ l d i).
-notation < "\rationals \sup 2" non associative with precedence 40 for @{'q2}.
+notation < "\rationals \sup 2" non associative with precedence 90 for @{'q2}.
interpretation "Q x Q" 'q2 = (product Q Q).
-let rec mk_list (A:Type) (def:nat→A) (n:nat) on n ≝
+let rec make_list (A:Type) (def:nat→A) (n:nat) on n ≝
match n with
[ O ⇒ []
- | S m ⇒ def m :: mk_list A def m].
+ | S m ⇒ def m :: make_list A def m].
-interpretation "mk_list appl" 'mk_list f n = (mk_list f n).
-interpretation "mk_list" 'mk_list = mk_list.
-notation < "\mk_list \nbsp f \nbsp n" left associative with precedence 70 for @{'mk_list_appl $f $n}.
-notation "'mk_list'" left associative with precedence 70 for @{'mk_list}.
+notation "'mk_list'" with precedence 90 for @{'mk_list}.
+interpretation "'mk_list'" 'mk_list = (make_list _).
+notation < "'mk_list' \nbsp f \nbsp n"
+with precedence 71 for @{'mk_list_appl $f $n}.
+interpretation "'mk_list' appl" 'mk_list_appl f n = (make_list _ f n).
alias symbol "pair" = "pair".
-definition q00 : ℚ × ℚ ≝ 〈OQ,OQ〉.
+definition q0 : ℚ × ℚ ≝ 〈OQ,OQ〉.
+notation < "0 \sub \rationals" with precedence 90 for @{'q0}.
+interpretation "q0" 'q0 = q0.
+
+notation < "[ \rationals \sup 2]" with precedence 90 for @{'lq2}.
+interpretation "lq2" 'lq2 = (list (product Q Q)).
+notation < "[ \rationals \sup 2] \sup 2" with precedence 90 for @{'lq22}.
+interpretation "lq22" 'lq22 = (product (list (product Q Q)) (list (product Q Q))).
+
+
+notation "'len'" with precedence 90 for @{'len}.
+interpretation "len" 'len = length.
+notation < "'len' \nbsp l" with precedence 70 for @{'len_appl $l}.
+interpretation "len appl" 'len_appl l = (length _ l).
+
+alias symbol "pi1" = "exT fst".
+definition eject ≝
+ λP.λp:∃x:(list (ℚ × ℚ)) × (list (ℚ × ℚ)).P x.match p with [ex_introT p _ ⇒ p].
+coercion cic:/matita/dama/models/q_function/eject.con.
+definition inject ≝
+ λP.λp:(list (ℚ × ℚ)) × (list (ℚ × ℚ)).λh:P p. ex_introT ? P p h.
+coercion cic:/matita/dama/models/q_function/inject.con 0 1 nocomposites.
alias symbol "pi2" = "pair pi2".
alias symbol "pi1" = "pair pi1".
definition rebase:
q_f → q_f →
∃p:q_f × q_f.∀i.
- fst (nth (bars (fst p)) q00 i) =
- fst (nth (bars (snd p)) q00 i).
+ fst (nth (bars (fst p)) q0 i) =
+ fst (nth (bars (snd p)) q0 i).
intros (f1 f2); cases f1 (s1 l1); cases f2 (s2 l2); clear f1 f2;
letin aux ≝ (
-let rec aux (l1,l2:list (ℚ × ℚ)) on l1 : (list (ℚ × ℚ)) × (list (ℚ × ℚ)) ≝
+let rec aux (l1,l2:list (ℚ × ℚ)) (n:nat) on n : (list (ℚ × ℚ)) × (list (ℚ × ℚ)) ≝
+match n with
+[ O ⇒ 〈[],[]〉
+| S m ⇒
match l1 with
- [ nil ⇒ 〈mk_list (λi.〈fst (nth l2 q00 i),OQ〉) (length ? l2),l2〉
- | cons he tl ⇒ 〈[],[]〉] in aux);
+ [ nil ⇒
+ let copy_l2_with_0 ≝ mk_list (λi.〈fst (nth l2 q0 i),OQ〉) (length ? l2) in
+ 〈copy_l2_with_0, l2〉
+ | cons he1 tl1 ⇒〈[],[]〉 (*
+ match l2 with
+ [ nil ⇒
+ let copy_l1_with_0 ≝ mk_list (λi.〈fst (nth l1 q0 i),OQ〉) (length ? l1) in
+ 〈l1, copy_l1_with_0〉
+ | cons he2 tl2 ⇒
+ let base1 ≝ fst he1 in
+ let base2 ≝ fst he2 in
+ let height1 ≝ snd he1 in
+ let height2 ≝ snd he2 in
+ match q_cmp base1 base2 with
+ [ q_eq _ ⇒
+ let rc ≝ aux tl1 tl2 m in
+ 〈he1 :: fst rc,he2 :: snd rc〉
+ | q_lt _ ⇒
+ let rest ≝ base2 - base1 in
+ let rc ≝ aux tl1 (〈rest,height2〉 :: tl2) m in
+ 〈〈base1,height1〉 :: fst rc,〈base1,height2〉 :: snd rc〉
+ | q_gt _ ⇒
+ let rest ≝ base1 - base2 in
+ let rc ≝ aux (〈rest,height1〉 :: tl1) tl2 m in
+ 〈〈base2,height1〉 :: fst rc,〈base2,height2〉 :: snd rc〉
+]]*)]]
+in aux : ∀l1,l2,m.∃p.True);
cases (q_cmp s1 s2);
[1: apply (mk_q_f s1);