X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Flibrary%2Fnat%2Fminus.ma;h=10d218d440d7194f2d10e127fddcc3f9eadff05e;hb=e189bde1e0a562e8689ff41d55d392431609e749;hp=11585f2065706c33ba70901cd3944c4261ad775c;hpb=a9f72dea3b74e3c0c33daf5be8f4d5d75611492c;p=helm.git diff --git a/helm/software/matita/library/nat/minus.ma b/helm/software/matita/library/nat/minus.ma index 11585f206..10d218d44 100644 --- a/helm/software/matita/library/nat/minus.ma +++ b/helm/software/matita/library/nat/minus.ma @@ -13,8 +13,6 @@ (**************************************************************************) -set "baseuri" "cic:/matita/nat/minus". - include "nat/le_arith.ma". include "nat/compare.ma". @@ -78,13 +76,12 @@ qed. theorem minus_plus_m_m: \forall n,m:nat.n = (n+m)-m. intros 2. -generalize in match n. -elim m. +elim m in n ⊢ %. rewrite < minus_n_O.apply plus_n_O. -elim n2.simplify. +elim n1.simplify. apply minus_n_n. rewrite < plus_n_Sm. -change with (S n3 = (S n3 + n1)-n1). +change with (S n2 = (S n2 + n)-n). apply H. qed. @@ -296,6 +293,47 @@ apply (lt_minus_to_plus O a b). assumption. qed. +theorem lt_minus_to_lt_plus: +\forall n,m,p. n - m < p \to n < m + p. +intros 2. +apply (nat_elim2 ? ? ? ? n m) + [simplify.intros.autobatch. + |intros 2.rewrite < minus_n_O. + intro.assumption + |intros. + simplify. + cut (n1 < m1+p) + [autobatch + |apply H. + apply H1 + ] + ] +qed. + +theorem lt_plus_to_lt_minus: +\forall n,m,p. m \le n \to n < m + p \to n - m < p. +intros 2. +apply (nat_elim2 ? ? ? ? n m) + [simplify.intros 3. + apply (le_n_O_elim ? H). + simplify.intros.assumption + |simplify.intros.assumption. + |intros. + simplify. + apply H + [apply le_S_S_to_le.assumption + |apply le_S_S_to_le.apply H2 + ] + ] +qed. + +theorem minus_m_minus_mn: \forall n,m. n\le m \to n=m-(m-n). +intros. +apply sym_eq. +apply plus_to_minus. +autobatch. +qed. + theorem distributive_times_minus: distributive nat times minus. unfold distributive. intros.