let rec subst_tac ~try_tactic ~hyp =
let hole = C.Implicit (Some `Hole) in
let meta = C.Implicit None in
+ let rec ind = function
+ | C.MutInd _ -> true
+ | C.Appl (t :: tl) -> ind t
+ | _ -> false
+ in
let rec constr = function
| C.MutConstruct _ -> true
| C.Appl (t :: tl) -> constr t
[lift_destruct_tac ~context ~what; PESR.clear ~hyps:[hyp]]
in
let whd_g () =
- let whd_pattern = C.Appl [meta; meta; hole; hole] in
+ let whd_pattern = C.Appl [meta; hole; hole; hole] in
let pattern = None, [hyp, whd_pattern], None in
[RT.whd_tac ~pattern; subst_tac ~try_tactic ~hyp]
in
when LO.is_eq_URI uri -> subst_g `LeftToRight i t
| (C.Appl [(C.MutInd (uri, 0, [])); _; t; C.Rel i])
when LO.is_eq_URI uri -> subst_g `RightToLeft i t
- | (C.Appl [(C.MutInd (uri, 0, [])); _; t1; t2])
- when LO.is_eq_URI uri && constr t1 && constr t2 -> destruct_g ()
+ | (C.Appl [(C.MutInd (uri, 0, [])); t; t1; t2])
+ when LO.is_eq_URI uri && ind t && constr t1 && constr t2 -> destruct_g ()
| (C.Appl [(C.MutInd (uri, 0, [])); _; t1; t2])
when LO.is_eq_URI uri -> whd_g ()
| _ -> raise (PET.Fail msg1)
intros. elim q; clear q; auto.
qed.
-theorem nplus_succ_1: \forall p,q,r. NPlus p q r \to
+theorem nplus_succ_1: \forall p,q,r. (p + q == r) \to
(succ p) + q == (succ r).
intros. elim H; clear H q r; auto.
qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||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/ZEq/defs".
+
+include "datatypes/Zah.ma".
+include "NPlus/defs.ma".
+
+inductive ZEq: Zah \to Zah \to Prop :=
+ | zeq: \forall m1,m2,m3,m4,n.
+ (m1 + m4 == n) \to (m3 + m2 == n) \to
+ ZEq \langle m1, m2 \rangle \langle m3, m4 \rangle
+.
+
+interpretation "integer equality" 'eq x y =
+ (cic:/matita/RELATIONAL/ZEq/defs/ZEq.ind#xpointer(1/1) x y).
+
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||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/ZEq/setoid".
+
+include "NPlus/fun.ma".
+include "ZEq/defs.ma".
+
+theorem zeq_refl: \forall z. z = z.
+ intros. elim z. clear z.
+ lapply (nplus_total t t1). decompose.
+ auto.
+qed.
+
+theorem zeq_sym: \forall z1,z2. z1 = z2 \to z2 = z1.
+ intros. elim H. clear H z1 z2. auto.
+qed.
+(*
+theorem zeq_trans: \forall z1,z2. z1 = z2 \to
+ \forall z3. z2 = z3 \to z1 = z3.
+ intros 3. elim H. clear H z1 z2.
+ inversion H3. clear H3. intros. subst.
+ lapply (nplus_total n5 n6). decompose.
+ lapply (nplus_total n4 n9). decompose.
+ apply zeq.
+*)
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||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/Zah/defs".
-
-include "datatypes/constructors.ma".
-include "logic/coimplication.ma".
-include "NPlusList/defs.ma".
-
-definition Zah \def Nat \times Nat.
-(*
-definition ZEq: Zah \to Zah -> Prop :=
- \lambda z1,z2.
- \forall n. ((\fst z1) + (\snd z2) == n) \liff (\fst z2) + (\snd z1) == n.
-
-interpretation "integer equality" 'zeq x y =
- (cic:/matita/RELATIONAL/Zah/defs/ZEq.con x y).
-
-notation "hvbox(a break = b)"
- non associative with precedence 45
-for @{ 'zeq $a $b }.
-*)
\ No newline at end of file
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||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/Zah/setoid".
-
-include "NPlus/monoid.ma".
-include "Zah/defs.ma".
-
-theorem nplus_total: \forall p,q. \exists r. p + q == r.
- intros 2. elim q; clear q;
- decompose; auto.
-qed.
-(*
-theorem zeq_intro: \forall z1,z2.
- (\forall n.((\fst z1) + (\snd z2) == n) \to ((\fst z2) + (\snd z1) == n)) \to
- (\forall n.((\fst z2) + (\snd z1) == n) \to ((\fst z1) + (\snd z2) == n)) \to
- z1 = z2.
- unfold ZEq. intros. apply iff_intro; intros; auto.
-qed.
-
-theorem zeq_refl: \forall z. z = z.
- unfold ZEq. intros. auto.
-qed.
-
-theorem zeq_sym: \forall z1,z2. z1 = z2 \to z2 = z1.
- unfold ZEq. intros. lapply linear (H n). auto.
-qed.
-*)(*
-theorem zeq_trans: \forall z1,z2. z1 = z2 \to
- \forall z3. z2 = z3 \to z1 = z3.
- unfold ZEq. intros.
- lapply (nplus_total (\snd z2) (\fst z2)). decompose.
-
-
-
- apply iff_intro; intros;
- [ lapply (nplus_total (\fst z1) (\snd z3)). decompose
- |
-
-
-
-
- lapply (nplus_total (\snd z2) (\fst z2)). decompose.
- lapply (nplus_total n a). decompose.
- lapply linear (H a1). lapply linear (H1 a1). decompose.
-
-
-
-*)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||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/datatypes/Zah".
+
+include "datatypes/Nat.ma".
+
+definition Zah \def Nat \times Nat.
include "logic/equality.ma".
include "logic/connectives.ma".
+include "datatypes/constructors.ma".