From: Enrico Tassi Date: Wed, 2 Jul 2008 21:43:55 +0000 (+0000) Subject: some work X-Git-Tag: make_still_working~4964 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=eabdca1b931aa21e17a63ad34a3f43b4f79e4c5b;p=helm.git some work --- diff --git a/helm/software/matita/contribs/dama/dama/depends b/helm/software/matita/contribs/dama/dama/depends index 69d98ade5..4fc4c9d0f 100644 --- a/helm/software/matita/contribs/dama/dama/depends +++ b/helm/software/matita/contribs/dama/dama/depends @@ -1,29 +1,31 @@ -sandwich.ma ordered_uniform.ma property_sigma.ma ordered_uniform.ma russell_support.ma -uniform.ma supremum.ma bishop_set.ma ordered_set.ma -sequence.ma nat/nat.ma ordered_uniform.ma uniform.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 datatypes/constructors.ma logic/equality.ma +sequence.ma nat/nat.ma nat_ordered_set.ma bishop_set.ma nat/compare.ma lebesgue.ma property_exhaustivity.ma sandwich.ma +property_exhaustivity.ma ordered_uniform.ma property_sigma.ma +cprop_connectives.ma datatypes/constructors.ma logic/equality.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 +uniform.ma supremum.ma +supremum.ma datatypes/constructors.ma nat/plus.ma nat_ordered_set.ma sequence.ma models/nat_ordered_uniform.ma bishop_set_rewrite.ma models/nat_uniform.ma ordered_uniform.ma -models/q_support.ma Q/q/q.ma cprop_connectives.ma -models/discrete_uniformity.ma bishop_set_rewrite.ma uniform.ma -models/q_bars.ma cprop_connectives.ma models/list_support.ma models/q_support.ma nat_ordered_set.ma -models/q_function.ma models/q_shift.ma nat_ordered_set.ma models/nat_uniform.ma models/discrete_uniformity.ma nat_ordered_set.ma -models/nat_dedekind_sigma_complete.ma models/nat_uniform.ma nat/le_arith.ma russell_support.ma supremum.ma +models/q_support.ma Q/q/qplus.ma Q/q/qtimes.ma cprop_connectives.ma models/q_shift.ma models/q_bars.ma -models/list_support.ma list/list.ma models/nat_order_continuous.ma models/nat_dedekind_sigma_complete.ma models/nat_ordered_uniform.ma -Q/q/q.ma +models/nat_lebesgue.ma lebesgue.ma models/nat_order_continuous.ma +models/list_support.ma list/list.ma +models/nat_dedekind_sigma_complete.ma models/nat_uniform.ma nat/le_arith.ma russell_support.ma supremum.ma +models/discrete_uniformity.ma bishop_set_rewrite.ma uniform.ma +models/q_function.ma Q/q/qtimes.ma models/q_shift.ma nat_ordered_set.ma +models/q_bars.ma cprop_connectives.ma models/list_support.ma models/q_support.ma nat_ordered_set.ma +models/q_value_skip.ma models/q_shift.ma +Q/q/qplus.ma +Q/q/qtimes.ma datatypes/constructors.ma list/list.ma logic/equality.ma diff --git a/helm/software/matita/contribs/dama/dama/depends.png b/helm/software/matita/contribs/dama/dama/depends.png index 7ce64426c..95829b4db 100644 Binary files a/helm/software/matita/contribs/dama/dama/depends.png and b/helm/software/matita/contribs/dama/dama/depends.png differ diff --git a/helm/software/matita/contribs/dama/dama/models/q_bars.ma b/helm/software/matita/contribs/dama/dama/models/q_bars.ma index 2aae66a5b..06b4a67e0 100644 --- a/helm/software/matita/contribs/dama/dama/models/q_bars.ma +++ b/helm/software/matita/contribs/dama/dama/models/q_bars.ma @@ -39,7 +39,7 @@ definition nth_height ≝ λf,n. \snd (nth f ▭ n). record q_f : Type ≝ { bars: list bar; - increasing_bars : sorted bars; + bars_sorted : sorted bars; bars_begin_OQ : nth_base bars O = OQ; bars_tail_OQ : nth_height bars (pred (len bars)) = OQ }. @@ -47,54 +47,104 @@ record q_f : Type ≝ { lemma nth_nil: ∀T,i.∀def:T. nth [] def i = def. intros; elim i; simplify; [reflexivity;] assumption; qed. -lemma all_bases_positives : ∀f:q_f.∀i.i < len (bars f) → OQ < nth_base (bars f) i. -intro f; elim (increasing_bars f); -[1: unfold nth_base; rewrite > nth_nil; apply (q_pos_OQ one); -|2: cases i in H; [2: cases (?:False); +inductive non_empty_list (A:Type) : list A → Type := +| show_head: ∀x,l. non_empty_list A (x::l). + +lemma bars_not_nil: ∀f:q_f.non_empty_list ? (bars f). +intro f; generalize in match (bars_begin_OQ f); cases (bars f); +[1: intro X; normalize in X; destruct X; +|2: intros; constructor 1;] qed. -definition eject_Q ≝ - λP.λp:∃x:ℚ.P x.match p with [ex_introT p _ ⇒ p]. -coercion eject_Q. -definition inject_Q ≝ λP.λp:ℚ.λh:P p. ex_introT ? P p h. -coercion inject_Q with 0 1 nocomposites. +lemma sorted_tail: ∀x,l.sorted (x::l) → sorted l. +intros; inversion H; intros; [destruct H1;|destruct H1;constructor 1;] +destruct H4; assumption; +qed. -definition value_spec : q_f → ℚ → ℚ → Prop ≝ - λf,i,q. - ∃j. q = nth_height (bars f) j ∧ - (nth_base (bars f) j < i ∧ - ∀n.j < n → n < len (bars f) → i ≤ nth_base (bars f) n). +lemma sorted_skip: ∀x,y,l. sorted (x::y::l) → sorted (x::l). +intros; inversion H; intros; [1,2: destruct H1] +destruct H4; inversion H2; intros; [destruct H4] +[1: destruct H4; constructor 2; +|2: destruct H7; constructor 3; [apply (q_lt_trans ??? H1 H4);] + apply (sorted_tail ?? H2);] +qed. + +lemma sorted_tail_bigger : ∀x,l.sorted (x::l) → ∀i. i < len l → \fst x < nth_base l i. +intros 2; elim l; [ cases (not_le_Sn_O i H1);] +cases i in H2; +[2: intros; apply (H ? n);[apply (sorted_skip ??? H1)|apply le_S_S_to_le; apply H2] +|1: intros; inversion H1; intros; [1,2: destruct H3] + destruct H6; simplify; assumption;] +qed. + +lemma all_bases_positive : ∀f:q_f.∀i. OQ < nth_base (bars f) (S i). +intro f; generalize in match (bars_begin_OQ f); generalize in match (bars_sorted f); +cases (bars_not_nil f); intros; +cases (cmp_nat i (len l)); +[1: lapply (sorted_tail_bigger ?? H ? H2) as K; simplify in H1; + rewrite > H1 in K; apply K; +|2: rewrite > H2; simplify; elim l; simplify; [apply (q_pos_OQ one)] + assumption; +|3: simplify; elim l in i H2;[simplify; rewrite > nth_nil; apply (q_pos_OQ one)] + cases n in H3; intros; [cases (not_le_Sn_O ? H3)] apply (H2 n1); + apply (le_S_S_to_le ?? H3);] +qed. + +definition eject_NxQ ≝ + λP.λp:∃x:nat × ℚ.P x.match p with [ex_introT p _ ⇒ p]. +coercion eject_NxQ. +definition inject_NxQ ≝ λP.λp:nat × ℚ.λh:P p. ex_introT ? P p h. +coercion inject_NxQ with 0 1 nocomposites. -definition value : ∀f:q_f.∀i:ratio.∃p:ℚ.value_spec f (Qpos i) p. +definition value_spec : q_f → ℚ → nat × ℚ → Prop ≝ + λf,i,q. nth_height (bars f) (\fst q) = \snd q ∧ + (nth_base (bars f) (\fst q) < i ∧ + ∀n.\fst q < n → n < len (bars f) → i ≤ nth_base (bars f) n). + +definition value : ∀f:q_f.∀i:ratio.∃p:ℚ.∃j.value_spec f (Qpos i) 〈j,p〉. intros; -alias symbol "lt" (instance 5) = "Q less than". +alias symbol "pi2" = "pair pi2". +alias symbol "pi1" = "pair pi1". +alias symbol "lt" (instance 6) = "Q less than". alias symbol "leq" = "Q less or equal than". letin value_spec_aux ≝ ( - λf,i,q.∃j. q = nth_height f j ∧ - (nth_base f j < i ∧ ∀n.j < n → n < len f → i ≤ nth_base f n)); + λf,i,q. + \snd q = nth_height f (\fst q) ∧ + (nth_base f (\fst q) < i ∧ ∀n.(\fst q) < n → n < len f → i ≤ nth_base f n)); +alias symbol "lt" (instance 5) = "Q less than". letin value ≝ ( - let rec value (acc: ℚ) (l : list bar) on l : ℚ ≝ + METTERE IN ACC LA LISTA PROCESSATA SO FAR + E DIRE CHE QUELLA@L=BARS + let rec value (acc: nat × ℚ) (l : list bar) on l : nat × ℚ ≝ match l with [ nil ⇒ acc | cons x tl ⇒ match q_cmp (\fst x) (Qpos i) with - [ q_leq _ ⇒ value (\snd x) tl + [ q_leq _ ⇒ value 〈S (\fst acc), \snd x〉 tl | q_gt _ ⇒ acc]] in value : - ∀acc,l.∃p:ℚ. OQ ≤ acc → value_spec_aux l (Qpos i) p); -[4: clearbody value; cases (value OQ (bars f)) (p Hp); exists[apply p]; - cases (Hp (q_le_n ?)) (j Hj); cases Hj (Hjp H); cases H (Hin Hmax); - clear Hp value value_spec_aux Hj H; exists [apply j]; split[2:split;intros;] - try apply Hmax; assumption; -|1: intro Hacc; clear H2; cases (value (\snd b) l1) (j Hj); - cases (q_cmp (\snd b) (Qpos i)) (Hib Hib); - [1: cases (Hj Hib) (w Hw); simplify in ⊢ (? ? ? %); clear Hib Hj; - exists [apply (S w)] cases Hw; cases H3; clear Hw H3; - split; try assumption; split; try assumption; intros; - apply (q_le_trans ??? (H5 (pred n) ??)); [3: apply q_le_n] - - - + ∀acc,l.∃p:nat × ℚ. + (∀i.i < len l → nth_base (bars f) (\fst acc) < nth_base l i) → + nth_height (bars f) (\fst acc) = \snd acc → + value_spec_aux l (Qpos i) p); +[3: intros; unfold; +[4: clearbody value; unfold value_spec; + generalize in match (bars_begin_OQ f); + generalize in match (bars_sorted f); + cases (bars_not_nil f); intro S; generalize in match (sorted_tail_bigger ?? S); + clear S; cases (value 〈O,\snd x〉 (x::l)) (p Hp); intros; + exists[apply (\snd p)];exists [apply (\fst p)] + cases (Hp ?) (Hg HV); + [unfold; split[reflexivity]simplify;split; + [rewrite > H1;apply q_pos_OQ; + |intros; cases n in H2 H3; [intro X; cases (not_le_Sn_O ? X)] + intros; + rewrite > H1; apply q_pos_OQ; + cases HV (Hi Hm); clear Hp value value_spec_aux HV; + exists [apply (\fst p)]; split;[rewrite > Hg;reflexivity|split;[assumption]intros] + apply Hm; assumption; +|1: unfold value_spec_aux; clear value value_spec_aux H2;intros; split[2:split] + [1: apply (q_lt_le_trans ??? (H4 (\fst p))); clear H4 H5; [5: clearbody value; cases (q_cmp i (start f));