From ffa63313d7329be5e1a7b0f40cd31e7102ee0417 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Thu, 2 Oct 2008 08:08:03 +0000 Subject: [PATCH] ... --- .../contribs/dama/dama/models/q_function.ma | 96 ------------------- .../contribs/dama/dama/models/q_rebase.ma | 83 +++++++++++++++- 2 files changed, 82 insertions(+), 97 deletions(-) delete mode 100644 helm/software/matita/contribs/dama/dama/models/q_function.ma diff --git a/helm/software/matita/contribs/dama/dama/models/q_function.ma b/helm/software/matita/contribs/dama/dama/models/q_function.ma deleted file mode 100644 index 26c319c74..000000000 --- a/helm/software/matita/contribs/dama/dama/models/q_function.ma +++ /dev/null @@ -1,96 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -include "russell_support.ma". -include "models/q_copy.ma". - -definition rebase_spec ≝ - λl1,l2:q_f.λp:q_f × q_f. - And3 - (same_bases (bars (\fst p)) (bars (\snd p))) - (same_values l1 (\fst p)) - (same_values l2 (\snd p)). - -inductive rebase_cases : list bar → list bar → (list bar) × (list bar) → Prop ≝ -| rb_fst_full : ∀b,h1,xs. - rebase_cases (〈b,h1〉::xs) [] 〈〈b,h1〉::xs,〈b,〈OQ,OQ〉〉::copy xs〉 -| rb_snd_full : ∀b,h1,ys. - rebase_cases [] (〈b,h1〉::ys) 〈〈b,〈OQ,OQ〉〉::copy ys,〈b,h1〉::ys〉 -| rb_all_full : ∀b,h1,h2,h3,h4,xs,ys,r1,r2. - \snd(\last ▭ (〈b,h1〉::xs)) = \snd(\last ▭ (〈b,h3〉::r1)) → - \snd(\last ▭ (〈b,h2〉::ys)) = \snd(\last ▭ (〈b,h4〉::r2)) → - rebase_cases (〈b,h1〉::xs) (〈b,h2〉::ys) 〈〈b,h3〉::r1,〈b,h4〉::r2〉 -| rb_all_full_l : ∀b1,b2,h1,h2,xs,ys,r1,r2. - \snd(\last ▭ (〈b1,h1〉::xs)) = \snd(\last ▭ (〈b1,h1〉::r1)) → - \snd(\last ▭ (〈b2,h2〉::ys)) = \snd(\last ▭ (〈b1,h2〉::r2)) → - b1 < b2 → - rebase_cases (〈b1,h1〉::xs) (〈b2,h2〉::ys) 〈〈b1,h1〉::r1,〈b1,〈OQ,OQ〉〉::r2〉 -| rb_all_full_r : ∀b1,b2,h1,h2,xs,ys,r1,r2. - \snd(\last ▭ (〈b1,h1〉::xs)) = \snd(\last ▭ (〈b2,h1〉::r1)) → - \snd(\last ▭ (〈b2,h2〉::ys)) = \snd(\last ▭ (〈b2,h2〉::r2)) → - b2 < b1 → - rebase_cases (〈b1,h1〉::xs) (〈b2,h2〉::ys) 〈〈b2,〈OQ,OQ〉〉::r1,〈b2,h2〉::r2〉 -| rb_all_empty : rebase_cases [] [] 〈[],[]〉. - -alias symbol "pi2" = "pair pi2". -alias symbol "pi1" = "pair pi1". -alias symbol "leq" = "natural 'less or equal to'". -inductive rebase_spec_aux_p (l1, l2:list bar) (p:(list bar) × (list bar)) : Prop ≝ -| prove_rebase_spec_aux: - rebase_cases l1 l2 p → - (sorted q2_lt (\fst p)) → - (sorted q2_lt (\snd p)) → - (same_bases (\fst p) (\snd p)) → - (same_values_simpl l1 (\fst p)) → - (same_values_simpl l2 (\snd p)) → - rebase_spec_aux_p l1 l2 p. - -lemma aux_preserves_sorting: - ∀b,b3,l2,l3,w. rebase_cases l2 l3 w → - sorted q2_lt (b::l2) → sorted q2_lt (b3::l3) → \fst b3 = \fst b → - sorted q2_lt (\fst w) → sorted q2_lt (\snd w) → - same_bases (\fst w) (\snd w) → - sorted q2_lt (b :: \fst w). -intros 6; cases H; simplify; intros; clear H; -[ apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H1); -| apply (sorted_cons q2_lt); [2:assumption] - whd; rewrite < H3; apply (inversion_sorted2 ??? H2); -| apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H3); -| apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H4); -| apply (sorted_cons q2_lt); [2:assumption] - whd; rewrite < H6; apply (inversion_sorted2 ??? H5); -| apply (sorted_one q2_lt);] -qed. - -lemma aux_preserves_sorting2: - ∀b,b3,l2,l3,w. rebase_cases l2 l3 w → - sorted q2_lt (b::l2) → sorted q2_lt (b3::l3) → \fst b3 = \fst b → - sorted q2_lt (\fst w) → sorted q2_lt (\snd w) → same_bases (\fst w) (\snd w) → - sorted q2_lt (b :: \snd w). -intros 6; cases H; simplify; intros; clear H; -[ apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H1); -| apply (sorted_cons q2_lt); [2:assumption] - whd; rewrite < H3; apply (inversion_sorted2 ??? H2); -| apply (sorted_cons q2_lt); [2: assumption] apply (inversion_sorted2 ??? H3); -| apply (sorted_cons q2_lt); [2: assumption] apply (inversion_sorted2 ??? H4); -| apply (sorted_cons q2_lt); [2: assumption] - whd; rewrite < H6; apply (inversion_sorted2 ??? H5); -| apply (sorted_one q2_lt);] -qed. - -definition rebase_spec_aux ≝ - λl1,l2:list bar.λp:(list bar) × (list bar). - sorted q2_lt l1 → (\snd (\last ▭ l1) = 〈OQ,OQ〉) → - sorted q2_lt l2 → (\snd (\last ▭ l2) = 〈OQ,OQ〉) → - rebase_spec_aux_p l1 l2 p. diff --git a/helm/software/matita/contribs/dama/dama/models/q_rebase.ma b/helm/software/matita/contribs/dama/dama/models/q_rebase.ma index 81ea33e68..c521e6bbd 100644 --- a/helm/software/matita/contribs/dama/dama/models/q_rebase.ma +++ b/helm/software/matita/contribs/dama/dama/models/q_rebase.ma @@ -12,7 +12,88 @@ (* *) (**************************************************************************) -include "models/q_function.ma". +include "russell_support.ma". +include "models/q_copy.ma". + +definition rebase_spec ≝ + λl1,l2:q_f.λp:q_f × q_f. + And3 + (same_bases (bars (\fst p)) (bars (\snd p))) + (same_values l1 (\fst p)) + (same_values l2 (\snd p)). + +inductive rebase_cases : list bar → list bar → (list bar) × (list bar) → Prop ≝ +| rb_fst_full : ∀b,h1,xs. + rebase_cases (〈b,h1〉::xs) [] 〈〈b,h1〉::xs,〈b,〈OQ,OQ〉〉::copy xs〉 +| rb_snd_full : ∀b,h1,ys. + rebase_cases [] (〈b,h1〉::ys) 〈〈b,〈OQ,OQ〉〉::copy ys,〈b,h1〉::ys〉 +| rb_all_full : ∀b,h1,h2,h3,h4,xs,ys,r1,r2. + \snd(\last ▭ (〈b,h1〉::xs)) = \snd(\last ▭ (〈b,h3〉::r1)) → + \snd(\last ▭ (〈b,h2〉::ys)) = \snd(\last ▭ (〈b,h4〉::r2)) → + rebase_cases (〈b,h1〉::xs) (〈b,h2〉::ys) 〈〈b,h3〉::r1,〈b,h4〉::r2〉 +| rb_all_full_l : ∀b1,b2,h1,h2,xs,ys,r1,r2. + \snd(\last ▭ (〈b1,h1〉::xs)) = \snd(\last ▭ (〈b1,h1〉::r1)) → + \snd(\last ▭ (〈b2,h2〉::ys)) = \snd(\last ▭ (〈b1,h2〉::r2)) → + b1 < b2 → + rebase_cases (〈b1,h1〉::xs) (〈b2,h2〉::ys) 〈〈b1,h1〉::r1,〈b1,〈OQ,OQ〉〉::r2〉 +| rb_all_full_r : ∀b1,b2,h1,h2,xs,ys,r1,r2. + \snd(\last ▭ (〈b1,h1〉::xs)) = \snd(\last ▭ (〈b2,h1〉::r1)) → + \snd(\last ▭ (〈b2,h2〉::ys)) = \snd(\last ▭ (〈b2,h2〉::r2)) → + b2 < b1 → + rebase_cases (〈b1,h1〉::xs) (〈b2,h2〉::ys) 〈〈b2,〈OQ,OQ〉〉::r1,〈b2,h2〉::r2〉 +| rb_all_empty : rebase_cases [] [] 〈[],[]〉. + +alias symbol "pi2" = "pair pi2". +alias symbol "pi1" = "pair pi1". +alias symbol "leq" = "natural 'less or equal to'". +inductive rebase_spec_aux_p (l1, l2:list bar) (p:(list bar) × (list bar)) : Prop ≝ +| prove_rebase_spec_aux: + rebase_cases l1 l2 p → + (sorted q2_lt (\fst p)) → + (sorted q2_lt (\snd p)) → + (same_bases (\fst p) (\snd p)) → + (same_values_simpl l1 (\fst p)) → + (same_values_simpl l2 (\snd p)) → + rebase_spec_aux_p l1 l2 p. + +lemma aux_preserves_sorting: + ∀b,b3,l2,l3,w. rebase_cases l2 l3 w → + sorted q2_lt (b::l2) → sorted q2_lt (b3::l3) → \fst b3 = \fst b → + sorted q2_lt (\fst w) → sorted q2_lt (\snd w) → + same_bases (\fst w) (\snd w) → + sorted q2_lt (b :: \fst w). +intros 6; cases H; simplify; intros; clear H; +[ apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H1); +| apply (sorted_cons q2_lt); [2:assumption] + whd; rewrite < H3; apply (inversion_sorted2 ??? H2); +| apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H3); +| apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H4); +| apply (sorted_cons q2_lt); [2:assumption] + whd; rewrite < H6; apply (inversion_sorted2 ??? H5); +| apply (sorted_one q2_lt);] +qed. + +lemma aux_preserves_sorting2: + ∀b,b3,l2,l3,w. rebase_cases l2 l3 w → + sorted q2_lt (b::l2) → sorted q2_lt (b3::l3) → \fst b3 = \fst b → + sorted q2_lt (\fst w) → sorted q2_lt (\snd w) → same_bases (\fst w) (\snd w) → + sorted q2_lt (b :: \snd w). +intros 6; cases H; simplify; intros; clear H; +[ apply (sorted_cons q2_lt); [2:assumption] apply (inversion_sorted2 ??? H1); +| apply (sorted_cons q2_lt); [2:assumption] + whd; rewrite < H3; apply (inversion_sorted2 ??? H2); +| apply (sorted_cons q2_lt); [2: assumption] apply (inversion_sorted2 ??? H3); +| apply (sorted_cons q2_lt); [2: assumption] apply (inversion_sorted2 ??? H4); +| apply (sorted_cons q2_lt); [2: assumption] + whd; rewrite < H6; apply (inversion_sorted2 ??? H5); +| apply (sorted_one q2_lt);] +qed. + +definition rebase_spec_aux ≝ + λl1,l2:list bar.λp:(list bar) × (list bar). + sorted q2_lt l1 → (\snd (\last ▭ l1) = 〈OQ,OQ〉) → + sorted q2_lt l2 → (\snd (\last ▭ l2) = 〈OQ,OQ〉) → + rebase_spec_aux_p l1 l2 p. alias symbol "lt" = "Q less than". alias symbol "Q" = "Rationals". -- 2.39.2