X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Flib%2Farithmetics%2Fminimization.ma;h=5d4fc9bce9a5aa03002dfdd6151cd0bc14324af7;hb=77bf99a9ac05a61573d621d576e269870668f076;hp=4c55ea6beb9b37a91e752913a0338786cea24952;hpb=31e8729021717072f88d250ef41527da3488289e;p=helm.git diff --git a/matita/matita/lib/arithmetics/minimization.ma b/matita/matita/lib/arithmetics/minimization.ma index 4c55ea6be..5d4fc9bce 100644 --- a/matita/matita/lib/arithmetics/minimization.ma +++ b/matita/matita/lib/arithmetics/minimization.ma @@ -40,7 +40,7 @@ qed. theorem lt_max_n : ∀f.∀n. O < n → max n f < n. #f #n #posn @(lt_O_n_elim ? posn) #m -normalize (cases (f m)) normalize apply le_S_S // +normalize (cases (f m)) normalize @le_S_S // @le_max_n qed. theorem le_to_le_max : ∀f.∀n,m. @@ -122,7 +122,7 @@ qed. theorem max_f_g: ∀f,g,n.(∀i. i < n → f i = g i) → max n f = max n g. #f #g #n (elim n) // -#m #Hind #ext normalize >ext normalize in Hind >Hind // +#m #Hind #ext normalize >ext normalize in Hind; >Hind // #i #ltim @ext /2/ qed. @@ -140,6 +140,39 @@ theorem f_max_true : ∀ f.∀n. #Hall * #x * #ltx #fx @False_ind @(absurd … fx) >Hall /2/ qed. +theorem f_false_to_le_max: ∀f,n,p. (∃i:nat.iHfS + [%1 %{n1} /2/ + |%2 #i #lei + cases (le_to_or_lt_eq ?? lei) #Hi + [@H @le_S_S_to_le @Hi | destruct (Hi) //] + ] + ] + ] +qed. + +theorem exists_max_forall_false:∀f,n. +((∃i. i < n ∧ f i = true) ∧ (f (max n f) = true))∨ +((∀i. i < n → f i = false) ∧ (max n f) = O). +#f #n +cases (exists_forall_lt f n) + [#H %1 % // @(f_max_true f n) @H + |#H %2 % [@H | @max_not_exists @H + ] +qed. + (* minimization *) (* min k b f is the minimun i, b ≤ i < b + k s.t. f i; @@ -230,8 +263,8 @@ lemma min_exists: ∀f.∀t,m. m < t → f m = true → [#b #lebm #ismin #eqtb @False_ind @(absurd … lebm) false_min /2/ @Hind // - [#i #H #H1 @ismin /2/ | >eqt normalize //] + [#ltbm >false_min /2 by le_n/ @Hind // + [#i #H #H1 @ismin /2/ | >eqt normalize //] |#eqbm >true_min // ] ] @@ -295,6 +328,7 @@ min n b g ≤ min n b f. [>ext // |(cases (g b)) normalize /2/ @Hind #i #ltb #ltim #fi @ext /2/ + ] qed. theorem f_min_true : ∀ f.∀n,b.