]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/library/datatypes/constructors.ma
resumed ol auto
[helm.git] / helm / software / matita / library / datatypes / constructors.ma
index 2ac1cb376804ad8e89dbd2a805cbd9c1c1284065..b91a59e177f71897dbb0bba85a37214cee9c062c 100644 (file)
@@ -17,9 +17,23 @@ include "logic/equality.ma".
 
 inductive void : Set \def.
 
+inductive unit : Set ≝ something: unit.
+
 inductive Prod (A,B:Set) : Set \def
 pair : A \to B \to Prod A B.
 
+interpretation "Pair construction" 'pair x y =
+ (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1/1) _ _ x y).
+
+notation "hvbox(\langle x break , y \rangle )" with precedence 89
+for @{ 'pair $x $y}.
+
+interpretation "Product" 'product x y =
+ (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1) x y).
+
+notation "hvbox(x break \times y)" with precedence 89
+for @{ 'product $x $y}.
+
 definition fst \def \lambda A,B:Set.\lambda p: Prod A B.
 match p with
 [(pair a b) \Rightarrow a]. 
@@ -28,11 +42,34 @@ definition snd \def \lambda A,B:Set.\lambda p: Prod A B.
 match p with
 [(pair a b) \Rightarrow b].
 
-theorem eq_pair_fst_snd: \forall A,B:Set.\forall p: Prod A B.
-p = pair A B (fst A B p) (snd A B p).
+interpretation "First projection" 'fst x =
+ (cic:/matita/datatypes/constructors/fst.con _ _ x).
+
+notation "\fst x" with precedence 89
+for @{ 'fst $x}.
+
+interpretation "Second projection" 'snd x =
+ (cic:/matita/datatypes/constructors/snd.con _ _ x).
+
+notation "\snd x" with precedence 89
+for @{ 'snd $x}.
+
+theorem eq_pair_fst_snd: \forall A,B:Set.\forall p:Prod A B.
+p = 〈 (\fst p), (\snd p) 〉.
 intros.elim p.simplify.reflexivity.
 qed.
 
 inductive Sum (A,B:Set) : Set \def
   inl : A \to Sum A B
 | inr : B \to Sum A B.
+
+inductive ProdT (A,B:Type) : Type \def
+pairT : A \to B \to ProdT A B.
+
+definition fstT \def \lambda A,B:Type.\lambda p: ProdT A B.
+match p with
+[(pairT a b) \Rightarrow a]. 
+
+definition sndT \def \lambda A,B:Type.\lambda p: ProdT A B.
+match p with
+[(pairT a b) \Rightarrow b].
\ No newline at end of file