X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fmatita%2Flibrary%2Fnat%2Fminus.ma;h=339e2262c72de402a1d29187e8a41907658038b7;hb=10f29fdd78ee089a9a94446207b543d33d6c851c;hp=f1178107a28d4f742a14942642b7daf650e97009;hpb=a180bddcd4a8f35de3d7292162ba05d0077723aa;p=helm.git diff --git a/helm/software/matita/library/nat/minus.ma b/helm/software/matita/library/nat/minus.ma index f1178107a..339e2262c 100644 --- a/helm/software/matita/library/nat/minus.ma +++ b/helm/software/matita/library/nat/minus.ma @@ -287,6 +287,56 @@ rewrite < plus_n_Sm. apply H.apply H1. qed. +theorem lt_O_minus_to_lt: \forall a,b:nat. +O \lt b-a \to a \lt b. +intros. +rewrite > (plus_n_O a). +rewrite > (sym_plus a O). +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.