X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=matita%2Fcontribs%2FRELATIONAL%2FNPlus%2Finv.ma;fp=matita%2Fcontribs%2FRELATIONAL%2FNPlus%2Finv.ma;h=e3ec16898e0766f2a041eab6fcaed38a525bb4c2;hp=0000000000000000000000000000000000000000;hb=f61af501fb4608cc4fb062a0864c774e677f0d76;hpb=58ae1809c352e71e7b5530dc41e2bfc834e1aef1 diff --git a/matita/contribs/RELATIONAL/NPlus/inv.ma b/matita/contribs/RELATIONAL/NPlus/inv.ma new file mode 100644 index 000000000..e3ec16898 --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlus/inv.ma @@ -0,0 +1,81 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "NPlus/defs.ma". + +(* Inversion lemmas *********************************************************) + +theorem nplus_inv_zero_1: \forall q,r. (zero + q == r) \to q = r. + intros. elim H; clear H q r; autobatch. +qed. + +theorem nplus_inv_succ_1: \forall p,q,r. ((succ p) + q == r) \to + \exists s. r = (succ s) \land p + q == s. + intros. elim H; clear H q r; intros; + [ autobatch depth = 4 + | clear H1. decompose. destruct. autobatch depth = 4 + ] +qed. + +theorem nplus_inv_zero_2: \forall p,r. (p + zero == r) \to p = r. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nplus_inv_succ_2: \forall p,q,r. (p + (succ q) == r) \to + \exists s. r = (succ s) \land p + q == s. + intros. inversion H; clear H; intros; destruct. + autobatch depth = 4. +qed. + +theorem nplus_inv_zero_3: \forall p,q. (p + q == zero) \to + p = zero \land q = zero. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nplus_inv_succ_3: \forall p,q,r. (p + q == (succ r)) \to + \exists s. p = succ s \land (s + q == r) \lor + q = succ s \land p + s == r. + intros. inversion H; clear H; intros; destruct; + autobatch depth = 4. +qed. + +(* Corollaries to inversion lemmas ******************************************) + +theorem nplus_inv_succ_2_3: \forall p,q,r. + (p + (succ q) == (succ r)) \to p + q == r. + intros. + lapply linear nplus_inv_succ_2 to H. decompose. destruct. autobatch. +qed. + +theorem nplus_inv_succ_1_3: \forall p,q,r. + ((succ p) + q == (succ r)) \to p + q == r. + intros. + lapply linear nplus_inv_succ_1 to H. decompose. destruct. autobatch. +qed. + +theorem nplus_inv_eq_2_3: \forall p,q. (p + q == q) \to p = zero. + intros 2. elim q; clear q; + [ lapply linear nplus_inv_zero_2 to H + | lapply linear nplus_inv_succ_2_3 to H1 + ]; autobatch. +qed. + +theorem nplus_inv_eq_1_3: \forall p,q. (p + q == p) \to q = zero. + intros 1. elim p; clear p; + [ lapply linear nplus_inv_zero_1 to H + | lapply linear nplus_inv_succ_1_3 to H1. + ]; autobatch. +qed.