]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/dama/dama/supremum.ma
lebesgue completely dualized
[helm.git] / helm / software / matita / contribs / dama / dama / supremum.ma
index 7fb1da4ba8e512f208b2661862cc6f949bf3762f..4ba3ca3afa678e4e9878ebd20e166e582606b068 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
+
+include "datatypes/constructors.ma".
+include "nat/plus.ma".
+include "nat_ordered_set.ma".
 include "sequence.ma".
-include "ordered_set.ma".
 
 (* Definition 2.4 *)
-definition upper_bound ≝ λO:ordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
+definition upper_bound ≝ 
+  λO:half_ordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤≤ u.
 
 definition supremum ≝
-  λO:ordered_set.λs:sequence O.λx.upper_bound ? s x ∧ (∀y:O.x ≰ y → ∃n.s n ≰ y).
+  λO:half_ordered_set.λs:sequence O.λx.
+    upper_bound ? s x ∧ (∀y:O.x ≰≰ y → ∃n.s n ≰≰ y).
 
-definition increasing ≝ λO:ordered_set.λa:sequence O.∀n:nat.a n ≤ a (S n).
+definition increasing ≝ 
+  λO:half_ordered_set.λa:sequence O.∀n:nat.a n ≤≤ a (S n).
 
-notation < "x \nbsp 'is_upper_bound' \nbsp s" non associative with precedence 50 
+notation < "x \nbsp 'is_upper_bound' \nbsp s" non associative with precedence 45 
   for @{'upper_bound $s $x}.
-notation < "s \nbsp 'is_increasing'"          non associative with precedence 50 
+notation < "x \nbsp 'is_lower_bound' \nbsp s" non associative with precedence 45 
+  for @{'lower_bound $s $x}.
+notation < "s \nbsp 'is_increasing'" non associative with precedence 45 
   for @{'increasing $s}.
-notation < "x \nbsp 'is_supremum' \nbsp s"  non associative with precedence 50 
+notation < "s \nbsp 'is_decreasing'" non associative with precedence 45 
+  for @{'decreasing $s}.
+notation < "x \nbsp 'is_supremum' \nbsp s" non associative with precedence 45 
   for @{'supremum $s $x}.
-
-notation > "x 'is_upper_bound' s" non associative with precedence 50 
+notation < "x \nbsp 'is_infimum' \nbsp s" non associative with precedence 45 
+  for @{'infimum $s $x}.
+notation > "x 'is_upper_bound' s" non associative with precedence 45 
   for @{'upper_bound $s $x}.
-notation > "s 'is_increasing'"    non associative with precedence 50 
+notation > "x 'is_lower_bound' s" non associative with precedence 45 
+  for @{'lower_bound $s $x}.
+notation > "s 'is_increasing'"    non associative with precedence 45 
   for @{'increasing $s}.
-notation > "x 'is_supremum' s"  non associative with precedence 50 
+notation > "s 'is_decreasing'"    non associative with precedence 45 
+  for @{'decreasing $s}.
+notation > "x 'is_supremum' s"  non associative with precedence 45 
   for @{'supremum $s $x}.
+notation > "x 'is_infimum' s"  non associative with precedence 45 
+  for @{'infimum $s $x}.
 
-interpretation "Ordered set upper bound" 'upper_bound s x = 
-  (cic:/matita/dama/supremum/upper_bound.con _ s x).
-interpretation "Ordered set increasing"  'increasing s    = 
-  (cic:/matita/dama/supremum/increasing.con _ s).
-interpretation "Ordered set strong sup"  'supremum s x  = 
-  (cic:/matita/dama/supremum/supremum.con _ s x).
+interpretation "Ordered set upper bound" 'upper_bound s x = (upper_bound (os_l _) s x).
+interpretation "Ordered set lower bound" 'lower_bound s x = (upper_bound (os_r _) s x).
 
-include "nat/compare.ma".
-include "nat/plus.ma".  
-include "bishop_set.ma".
+interpretation "Ordered set increasing"  'increasing s = (increasing (os_l _) s).
+interpretation "Ordered set decreasing"  'decreasing s = (increasing (os_r _) s).
+
+interpretation "Ordered set strong sup"  'supremum s x = (supremum (os_l _) s x).
+interpretation "Ordered set strong inf"  'infimum s x = (supremum (os_r _) s x).
   
+(* se non faccio il bs_of_hos perdo dualità qui *)  
 lemma uniq_supremum: 
   ∀O:ordered_set.∀s:sequence O.∀t1,t2:O.
     t1 is_supremum s → t2 is_supremum s → t1 ≈ t2.
@@ -58,61 +74,297 @@ apply le_le_eq; intro X;
 qed.
 
 (* Fact 2.5 *)
-lemma supremum_is_upper_bound: 
-  ∀C:ordered_set.∀a:sequence C.∀u:C.
-   u is_supremum a → ∀v.v is_upper_bound a → u ≤ v.
+lemma h_supremum_is_upper_bound: 
+  ∀C:half_ordered_set.∀a:sequence C.∀u:C.
+   supremum ? a u → ∀v.upper_bound ? a v → u ≤≤ v.
 intros 7 (C s u Hu v Hv H); cases Hu (_ H1); clear Hu;
-cases (H1 ? H) (w Hw); apply Hv; assumption;
+cases (H1 ? H) (w Hw); apply Hv; [apply w] assumption;
 qed.
 
-(* Lemma 2.6 *)
-definition strictly_increasing ≝ λC:ordered_set.λa:sequence C.∀n:nat.a (S n) ≰ a n.
-definition nat_excess : nat → nat → CProp ≝ λn,m. leb (m+S O) n = true.
-
-axiom nat_excess_cotransitive: cotransitive ? nat_excess.
-(*intros 3 (x y z); elim x 0; elim y 0; elim z 0;
-    [1: intros; left; assumption
-    |2,5,6,7: intros; first [right; constructor 1|left; constructor 1]
-    |3: intros (n H abs); simplify in abs; destruct abs;
-    |4: intros (n H m W abs); simplify in abs; destruct abs;
-    |8: clear x y z; intros (x H1 y H2 z H3 H4);
-*)
+notation "'supremum_is_upper_bound'" non associative with precedence 90 for @{'supremum_is_upper_bound}.
+notation "'infimum_is_lower_bound'" non associative with precedence 90 for @{'infimum_is_lower_bound}.
+
+interpretation "supremum_is_upper_bound" 'supremum_is_upper_bound = (h_supremum_is_upper_bound (os_l _)).
+interpretation "infimum_is_lower_bound" 'infimum_is_lower_bound = (h_supremum_is_upper_bound (os_r _)).
 
-lemma nat_ordered_set : ordered_set.
-apply (mk_ordered_set ? nat_excess);
-[1: intro x; elim x (w H); simplify; intro X; [destruct X] apply H; assumption;
-|2: apply nat_excess_cotransitive]
+(* TEST DUALITY
+lemma test_infimum_is_lower_bound_duality: 
+  ∀C:ordered_set.∀a:sequence C.∀u:C.
+   u is_infimum a → ∀v.v is_lower_bound a → u ≥ v. 
+intros; lapply (infimum_is_lower_bound a u H v H1); assumption;
 qed.
+*)
+
+(* Lemma 2.6 *)
+definition strictly_increasing ≝ 
+  λC:half_ordered_set.λa:sequence C.∀n:nat.a (S n) ≰≰ a n.
 
-notation < "s \nbsp 'is_strictly_increasing'" non associative with precedence 50 
+notation < "s \nbsp 'is_strictly_increasing'" non associative with precedence 45 
   for @{'strictly_increasing $s}.
-notation > "s 'is_strictly_increasing'" non associative with precedence 50 
+notation > "s 'is_strictly_increasing'" non associative with precedence 45 
   for @{'strictly_increasing $s}.
-interpretation "Ordered set increasing"  'strictly_increasing s    = 
-  (cic:/matita/dama/supremum/strictly_increasing.con _ s).
+interpretation "Ordered set strict increasing"  'strictly_increasing s    = 
+  (strictly_increasing (os_l _) s).
+  
+notation < "s \nbsp 'is_strictly_decreasing'" non associative with precedence 45 
+  for @{'strictly_decreasing $s}.
+notation > "s 'is_strictly_decreasing'" non associative with precedence 45 
+  for @{'strictly_decreasing $s}.
+interpretation "Ordered set strict decreasing"  'strictly_decreasing s    = 
+  (strictly_increasing (os_r _) s).
+
+definition uparrow ≝
+  λC:half_ordered_set.λs:sequence C.λu:C.
+   increasing ? s ∧ supremum ? s u.
+(*   
+notation < "a \uparrow \nbsp u" non associative with precedence 45 for @{'sup_inc $a $u}.
+notation > "a \uparrow u" non associative with precedence 45 for @{'sup_inc $a $u}.
+*)
+interpretation "Ordered set uparrow" 'funion s u = (uparrow (os_l _) s u).
+
+(*
+notation < "a \downarrow \nbsp u" non associative with precedence 45 for @{'inf_dec $a $u}.
+notation > "a \downarrow u" non associative with precedence 45 for @{'inf_dec $a $u}.
+*)
+interpretation "Ordered set downarrow" 'fintersects s u = (uparrow (os_r _) s u).
+
+lemma h_trans_increasing: 
+  ∀C:half_ordered_set.∀a:sequence C.increasing ? a → 
+   ∀n,m:nat_ordered_set. n ≤ m → a n ≤≤ a m.
+intros 5 (C a Hs n m); elim m; [
+  rewrite > (le_n_O_to_eq n (not_lt_to_le O n H));
+  intro X; cases (hos_coreflexive ?? X);]
+cases (le_to_or_lt_eq ?? (not_lt_to_le (S n1) n H1)); clear H1;
+[2: rewrite > H2; intro; cases (hos_coreflexive ?? H1);
+|1: apply (hle_transitive ???? (H ?) (Hs ?));
+    intro; whd in H1; apply (not_le_Sn_n n); apply (transitive_le ??? H2 H1);]
+qed.
+
+notation "'trans_increasing'" non associative with precedence 90 for @{'trans_increasing}.
+notation "'trans_decreasing'" non associative with precedence 90 for @{'trans_decreasing}.
+
+interpretation "trans_increasing" 'trans_increasing = (h_trans_increasing (os_l _)).
+interpretation "trans_decreasing" 'trans_decreasing = (h_trans_increasing (os_r _)).
+
+(* TEST DUALITY
+lemma test_trans_decreasing_duality: 
+  ∀C:ordered_set.∀a:sequence C.a is_decreasing → 
+   ∀n,m:nat_ordered_set. n ≤ m → a m ≤ a n.
+intros; apply (trans_decreasing ? H ?? H1); qed.
+*)
+
+lemma h_trans_increasing_exc: 
+  ∀C:half_ordered_set.∀a:sequence C.increasing ? a → 
+   ∀n,m:nat_ordered_set. m ≰ n → a n ≤≤ a m.
+intros 5 (C a Hs n m); elim m; [cases (not_le_Sn_O n H);]
+intro; apply H; 
+[1: change in n1 with (hos_carr (os_l nat_ordered_set)); 
+    change with (n<n1);
+    cases (le_to_or_lt_eq ?? H1); [apply le_S_S_to_le;assumption]
+    cases (Hs n); rewrite < H3 in H2; assumption;    
+|2: cases (hos_cotransitive ??? (a n1) H2); [assumption]
+    cases (Hs n1); assumption;]
+qed.
+
+notation "'trans_increasing_exc'" non associative with precedence 90 for @{'trans_increasing_exc}.
+notation "'trans_decreasing_exc'" non associative with precedence 90 for @{'trans_decreasing_exc}.
+
+interpretation "trans_increasing_exc" 'trans_increasing_exc = (h_trans_increasing_exc (os_l _)).
+interpretation "trans_decreasing_exc" 'trans_decreasing_exc = (h_trans_increasing_exc (os_r _)).
+
+alias symbol "exists" = "CProp exists".
+lemma nat_strictly_increasing_reaches: 
+  ∀m:sequence nat_ordered_set.
+   m is_strictly_increasing → ∀w.∃t.m t ≰ w.
+intros; elim w;
+[1: cases (nat_discriminable O (m O)); [2: cases (not_le_Sn_n O (ltn_to_ltO ?? H1))]
+    cases H1; [exists [apply O] apply H2;]
+    exists [apply (S O)] lapply (H O) as H3; rewrite < H2 in H3; assumption
+|2: cases H1 (p Hp); cases (nat_discriminable (S n) (m p)); 
+    [1: cases H2; clear H2;
+        [1: exists [apply p]; assumption;
+        |2: exists [apply (S p)]; rewrite > H3; apply H;]
+    |2: cases (?:False); change in Hp with (n<m p);
+        apply (not_le_Sn_n (m p));
+        apply (transitive_le ??? H2 Hp);]]
+qed.
+     
+lemma h_selection_uparrow: 
+  ∀C:half_ordered_set.∀m:sequence nat_ordered_set.
+   m is_strictly_increasing →
+    ∀a:sequence C.∀u.uparrow ? a u → uparrow ? ⌊x,a (m x)⌋ u.
+intros (C m Hm a u Ha); cases Ha (Ia Su); cases Su (Uu Hu); repeat split; 
+[1: intro n; simplify; apply (h_trans_increasing_exc ? a Ia); apply (Hm n);
+|2: intro n; simplify; apply Uu;
+|3: intros (y Hy); simplify; cases (Hu ? Hy);
+    cases (nat_strictly_increasing_reaches ? Hm w); 
+    exists [apply w1]; cases (hos_cotransitive ??? (a (m w1)) H); [2:assumption]  
+    cases (h_trans_increasing_exc ?? Ia ?? H1); assumption;]
+qed.     
+
+notation "'selection_uparrow'" non associative with precedence 90 for @{'selection_uparrow}.
+notation "'selection_downarrow'" non associative with precedence 90 for @{'selection_downarrow}.
+
+interpretation "selection_uparrow" 'selection_uparrow = (h_selection_uparrow (os_l _)).
+interpretation "selection_downarrow" 'selection_downarrow = (h_selection_uparrow (os_r _)).
+
+(* Definition 2.7 *)
+definition order_converge ≝
+  λO:ordered_set.λa:sequence O.λx:O.
+   exT23 (sequence O) (λl.l ↑ x) (λu.u ↓ x)
+     (λl,u:sequence O.∀i:nat. (l i) is_infimum ⌊w,a (w+i)⌋ ∧ 
+                   (u i) is_supremum ⌊w,a (w+i)⌋).
+    
+notation < "a \nbsp (\cir \atop (\horbar\triangleright)) \nbsp x" non associative with precedence 45 
+  for @{'order_converge $a $x}.
+notation > "a 'order_converges' x" non associative with precedence 45 
+  for @{'order_converge $a $x}.
+interpretation "Order convergence" 'order_converge s u = (order_converge _ s u).   
+    
+(* Definition 2.8 *)
+definition segment ≝ λO:half_ordered_set.λa,b:O.λx:O.(x ≤≤ b) ∧ (a ≤≤ x).
+
+notation "[term 19 a,term 19 b]" non associative with precedence 90 for @{'segment $a $b}.
+interpretation "Ordered set sergment" 'segment a b = (segment (os_l _) a b).
+
+notation "hvbox(x \in break [term 19 a, term 19 b])" non associative with precedence 45 
+  for @{'segment_in $a $b $x}.
+interpretation "Ordered set sergment in" 'segment_in a b x= (segment (os_l _) a b x).
+
+definition segment_ordered_set_carr ≝
+  λO:half_ordered_set.λu,v:O.∃x.segment ? u v x.
+definition segment_ordered_set_exc ≝ 
+  λO:half_ordered_set.λu,v:O.
+   λx,y:segment_ordered_set_carr ? u v.\fst x ≰≰ \fst y.
+lemma segment_ordered_set_corefl:
+ ∀O,u,v. coreflexive ? (segment_ordered_set_exc O u v).
+intros 4; cases x; simplify; apply hos_coreflexive; qed.
+lemma segment_ordered_set_cotrans : 
+  ∀O,u,v. cotransitive ? (segment_ordered_set_exc O u v).
+intros 6 (O u v x y z); cases x; cases y ; cases z; simplify; apply hos_cotransitive;
+qed.  
   
-notation "a \uparrow u"  non associative with precedence 50 for  @{'sup_inc $a $u}.
-interpretation "Ordered set supremum of increasing" 'sup_inc s u =
- (cic:/matita/dama/cprop_connectives/And.ind#xpointer(1/1) 
-  (cic:/matita/dama/supremum/increasing.con _ s)
-  (cic:/matita/dama/supremum/supremum.con _ s u)).
+lemma half_segment_ordered_set: 
+  ∀O:half_ordered_set.∀u,v:O.half_ordered_set.
+intros (O u v); apply (mk_half_ordered_set ?? (segment_ordered_set_corefl O u v) (segment_ordered_set_cotrans ???));
+qed.
+
+lemma segment_ordered_set: 
+  ∀O:ordered_set.∀u,v:O.ordered_set.
+intros (O u v); 
+apply half2full; apply (half_segment_ordered_set (os_l O) u v); 
+qed.
+
+(*
+notation < "hvbox({[a, break b]/})" non associative with precedence 90 
+  for @{'h_segment_set $a $b}.
+notation > "hvbox({[a, break b]/})" non associative with precedence 90 
+  for @{'h_segment_set $a $b}.
+interpretation "Half ordered set segment" 'h_segment_set a b = 
+  (half_segment_ordered_set _ a b).
+*)
+
+notation < "hvbox({[a, break b]})" non associative with precedence 90 
+  for @{'segment_set $a $b}.
+notation > "hvbox({[a, break b]})" non associative with precedence 90 
+  for @{'segment_set $a $b}.
+interpretation "Ordered set segment" 'segment_set a b = 
+  (segment_ordered_set _ a b).
   
-lemma trans_increasing: 
-  ∀C:ordered_set.∀s:sequence C.s is_increasing → ∀n,m. m ≰ n → s n ≤ s m.
-intros 5 (C s Hs n m); elim m; [1: cases (?:False); autobatch]
-cases (le_to_or_lt_eq ?? H1);
- [2: destruct H2; apply Hs;
- |1: apply (le_transitive ???? (H (lt_S_S_to_lt ?? H2))); apply Hs;]
+definition hint_sequence: 
+  ∀C:ordered_set.
+    sequence (hos_carr (os_l C)) → sequence (Type_of_ordered_set C).
+intros;assumption;
+qed.
+
+definition hint_sequence1: 
+  ∀C:ordered_set.
+    sequence (hos_carr (os_r C)) → sequence (Type_of_ordered_set_dual C).
+intros;assumption;
+qed.
+
+definition hint_sequence2: 
+  ∀C:ordered_set.
+    sequence (Type_of_ordered_set C) → sequence (hos_carr (os_l C)).
+intros;assumption;
+qed.
+
+definition hint_sequence3: 
+  ∀C:ordered_set.
+    sequence (Type_of_ordered_set_dual C) → sequence (hos_carr (os_r C)).
+intros;assumption;
+qed.
+
+coercion hint_sequence nocomposites.
+coercion hint_sequence1 nocomposites.
+coercion hint_sequence2 nocomposites.
+coercion hint_sequence3 nocomposites.
+
+(* Lemma 2.9 - non easily dualizable *)
+lemma segment_preserves_supremum:
+  ∀O:ordered_set.∀l,u:O.∀a:sequence {[l,u]}.∀x:{[l,u]}. 
+    ⌊n,\fst (a n)⌋ is_increasing ∧ 
+    (\fst x) is_supremum ⌊n,\fst (a n)⌋ → a ↑ x.
+intros; split; cases H; clear H; 
+[1: apply H1;
+|2: cases H2; split; clear H2;
+    [1: apply H;
+    |2: clear H; intro y0; apply (H3 (\fst y0));]]
+qed.
+
+lemma segment_preserves_infimum:
+  ∀O:ordered_set.∀l,u:O.∀a:sequence {[l,u]}.∀x:{[l,u]}. 
+    ⌊n,\fst (a n)⌋ is_decreasing ∧ 
+    (\fst x) is_infimum ⌊n,\fst (a n)⌋ → a ↓ x.
+intros; split; cases H; clear H; 
+[1: apply H1;
+|2: cases H2; split; clear H2;
+    [1: apply H;
+    |2: clear H; intro y0; apply (H3 (\fst y0));]]
 qed.
+           
+(* Definition 2.10 *)
+alias symbol "pi2" = "pair pi2".
+alias symbol "pi1" = "pair pi1".
+definition square_segment ≝ 
+  λO:ordered_set.λa,b:O.λx: O squareO.
+    And4 (\fst x ≤ b) (a ≤ \fst x) (\snd x ≤ b) (a ≤ \snd x).
+definition convex ≝
+  λO:ordered_set.λU:O squareO → Prop.
+    ∀p.U p → \fst p ≤ \snd p → ∀y. 
+      square_segment O (\fst p) (\snd p) y → U y.
   
-lemma selection: 
-  ∀C:ordered_set.∀m:sequence nat_ordered_set.m is_strictly_increasing →
-    ∀a:sequence C.∀u.a ↑ u → (λx.a (m x)) ↑ u.
-intros (C m Hm a u Ha); cases Ha (Ia Su); cases Su (Uu Hu); repeat split; 
-[1: intro n; simplify; apply trans_increasing; [assumption] 
-    lapply (Hm n) as W; unfold nat_ordered_set in W; simplify in W;
-    cases W;
-|2: intro n;
-|3:
-    
\ No newline at end of file
+(* Definition 2.11 *)  
+definition upper_located ≝
+  λO:half_ordered_set.λa:sequence O.∀x,y:O. y ≰≰ x → 
+    (∃i:nat.a i ≰≰ x) ∨ (∃b:O.y ≰≰ b ∧ ∀i:nat.a i ≤≤ b).
+
+notation < "s \nbsp 'is_upper_located'" non associative with precedence 45 
+  for @{'upper_located $s}.
+notation > "s 'is_upper_located'" non associative with precedence 45 
+  for @{'upper_located $s}.
+interpretation "Ordered set upper locatedness" 'upper_located s = 
+  (upper_located (os_l _) s).
+
+notation < "s \nbsp 'is_lower_located'" non associative with precedence 45 
+  for @{'lower_located $s}.
+notation > "s 'is_lower_located'" non associative with precedence 45
+  for @{'lower_located $s}.
+interpretation "Ordered set lower locatedness" 'lower_located s = 
+  (upper_located (os_r _) s).
+      
+(* Lemma 2.12 *)    
+lemma h_uparrow_upperlocated:
+  ∀C:half_ordered_set.∀a:sequence C.∀u:C.uparrow ? a u → upper_located ? a.
+intros (C a u H); cases H (H2 H3); clear H; intros 3 (x y Hxy);
+cases H3 (H4 H5); clear H3; cases (hos_cotransitive ??? u Hxy) (W W);
+[2: cases (H5 ? W) (w Hw); left; exists [apply w] assumption;
+|1: right; exists [apply u]; split; [apply W|apply H4]]
+qed.
+
+notation "'uparrow_upperlocated'" non associative with precedence 90 for @{'uparrow_upperlocated}.
+notation "'downarrow_lowerlocated'" non associative with precedence 90 for @{'downarrow_lowerlocated}.
+
+interpretation "uparrow_upperlocated" 'uparrow_upperlocated = (h_uparrow_upperlocated (os_l _)).
+interpretation "downarrow_lowerlocated" 'downarrow_lowerlocated = (h_uparrow_upperlocated (os_r _)).