From 110578d269f4ced34c4317eed5171a7f45884c15 Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Fri, 16 Jun 2006 20:45:00 +0000 Subject: [PATCH] contribution on relational arithmetics started --- .../RELATIONAL-ARITHMETICS/add_defs.ma | 22 ++++ .../RELATIONAL-ARITHMETICS/add_props.ma | 118 ++++++++++++++++++ .../contribs/RELATIONAL-ARITHMETICS/makefile | 33 +++++ .../RELATIONAL-ARITHMETICS/nat_defs.ma | 25 ++++ 4 files changed, 198 insertions(+) create mode 100644 matita/contribs/RELATIONAL-ARITHMETICS/add_defs.ma create mode 100644 matita/contribs/RELATIONAL-ARITHMETICS/add_props.ma create mode 100644 matita/contribs/RELATIONAL-ARITHMETICS/makefile create mode 100644 matita/contribs/RELATIONAL-ARITHMETICS/nat_defs.ma diff --git a/matita/contribs/RELATIONAL-ARITHMETICS/add_defs.ma b/matita/contribs/RELATIONAL-ARITHMETICS/add_defs.ma new file mode 100644 index 000000000..4f95ad4e8 --- /dev/null +++ b/matita/contribs/RELATIONAL-ARITHMETICS/add_defs.ma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||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 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL-ARITHMETICS/add_defs". + +include "nat_defs.ma". + +inductive add (p:nat): nat \to nat \to Prop \def + | add_O_2: add p O p + | add_S_2: \forall q, r. add p q r \to add p (S q) (S r). + diff --git a/matita/contribs/RELATIONAL-ARITHMETICS/add_props.ma b/matita/contribs/RELATIONAL-ARITHMETICS/add_props.ma new file mode 100644 index 000000000..567bb1fed --- /dev/null +++ b/matita/contribs/RELATIONAL-ARITHMETICS/add_props.ma @@ -0,0 +1,118 @@ +(**************************************************************************) +(* ___ *) +(* ||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 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL-ARITHMETICS/add_props". + +include "add_defs.ma". + +axiom add_gen_O_2: \forall p,r. add p O r \to p = r. + +axiom add_gen_S_2: \forall p,q,r. add p (S q) r \to + \exists s. r = (S s) \land add p q s. + +theorem add_O_1: \forall q. add O q q. + intros. elim q; clear q; auto. +qed. + +theorem add_S_1: \forall p,q,r. add p q r \to add (S p) q (S r). + intros 2. elim q; clear q; + [ lapply add_gen_O_2 to H using H0. clear H. + rewrite > H0. clear H0. clear p + | lapply add_gen_S_2 to H1 using H0. clear H1. + decompose H0. + rewrite > H2. clear H2. clear r + ]; auto. +qed. + +theorem add_sym: \forall p,q,r. add p q r \to add q p r. + intros 2. elim q; clear q; + [ lapply add_gen_O_2 to H using H0. clear H. + rewrite > H0. clear H0. clear p + | lapply add_gen_S_2 to H1 using H0. clear H1. + decompose H0. + rewrite > H2. clear H2. clear r + ]; auto. +qed. + +theorem add_shift_S_sx: \forall p,q,r. add p (S q) r \to add (S p) q r. + intros. + lapply add_gen_S_2 to H using H0. clear H. + decompose H0. + rewrite > H1. clear H1. clear r. + auto. +qed. + +theorem add_gen_O_1: \forall q,r. add O q r \to q = r. + intros. auto. +qed. + +theorem add_gen_S_1: \forall p,q,r. add (S p) q r \to + \exists s. r = (S s) \land add p q s. + intros. auto. +qed. + +theorem add_shift_S_dx: \forall p,q,r. add (S p) q r \to add p (S q) r. + intros. + lapply add_gen_S_1 to H using H0. clear H. + decompose H0. + rewrite > H1. clear H1. clear r. + auto. +qed. + +theorem add_trans_1: \forall p,q1,r1. add p q1 r1 \to + \forall q2,r2. add r1 q2 r2 \to + \exists q. add q1 q2 q \land add p q r2. + intros 2; elim q1; clear q1; intros; + [ lapply add_gen_O_2 to H using H0. clear H. + rewrite > H0. clear H0. clear p + | lapply add_gen_S_2 to H1 using H0. clear H1. + decompose H0. + rewrite > H3. rewrite > H3 in H2. clear H3. clear r1. + lapply add_gen_S_1 to H2 using H0. clear H2. + decompose H0. + rewrite > H2. clear H2. clear r2. + lapply H to H4, H3 using H0. clear H. clear H4. clear H3. + decompose H0. + ]; apply ex_intro; [| auto || auto ]. +qed. + +theorem add_trans_2: \forall p1,q,r1. add p1 q r1 \to + \forall p2,r2. add p2 r1 r2 \to + \exists p. add p1 p2 p \land add p q r2. + intros 2; elim q; clear q; intros; + [ lapply add_gen_O_2 to H using H0. clear H. + rewrite > H0. clear H0. clear p1 + | lapply add_gen_S_2 to H1 using H0. clear H1. + decompose H0. + rewrite > H3. rewrite > H3 in H2. clear H3. clear r1. + lapply add_gen_S_2 to H2 using H0. clear H2. + decompose H0. + rewrite > H2. clear H2. clear r2. + lapply H to H4, H3 using H0. clear H. clear H4. clear H3. + decompose H0. + ]; apply ex_intro; [| auto || auto ]. +qed. + +theorem add_conf: \forall p,q,r1. add p q r1 \to + \forall r2. add p q r2 \to r1 = r2. + intros 2. elim q; clear q; intros; + [ lapply add_gen_O_2 to H using H0. clear H. + rewrite > H0 in H1. clear H0. clear p + | lapply add_gen_S_2 to H1 using H0. clear H1. + decompose H0. + rewrite > H3. clear H3. clear r1. + lapply add_gen_S_2 to H2 using H0. clear H2. + decompose H0. + rewrite > H2. clear H2. clear r2. + ]; auto. diff --git a/matita/contribs/RELATIONAL-ARITHMETICS/makefile b/matita/contribs/RELATIONAL-ARITHMETICS/makefile new file mode 100644 index 000000000..dc30e2595 --- /dev/null +++ b/matita/contribs/RELATIONAL-ARITHMETICS/makefile @@ -0,0 +1,33 @@ +H=@ + +RT_BASEDIR=/home/fguidi/svn/trunk/helm/software/matita/ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +all: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $@ + +preall: + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + diff --git a/matita/contribs/RELATIONAL-ARITHMETICS/nat_defs.ma b/matita/contribs/RELATIONAL-ARITHMETICS/nat_defs.ma new file mode 100644 index 000000000..a188208f2 --- /dev/null +++ b/matita/contribs/RELATIONAL-ARITHMETICS/nat_defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||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 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL-ARITHMETICS/nat_defs". + +include "library/logic/equality.ma". + +inductive nat: Set \def + | O: nat + | S: nat \to nat. + +theorem eq_gen_O_S: \forall (P:Prop). \forall m2. O = S m2 \to P. + intros. inversion H. + -- 2.39.2