]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/library/datatypes/constructors.ma
3567dd915463c8b6c2f809ed8218987a67e78042
[helm.git] / helm / software / matita / library / datatypes / constructors.ma
1 (**************************************************************************)
2 (*       ___                                                                *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
8 (*      ||A||       E.Tassi, S.Zacchiroli                                 *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU Lesser General Public License Version 2.1         *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/datatypes/constructors/".
16 include "logic/equality.ma".
17
18 inductive void : Set \def.
19
20 inductive Prod (A,B:Set) : Set \def
21 pair : A \to B \to Prod A B.
22
23 interpretation "Pair construction" 'pair x y =
24  (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1/1) _ _ x y).
25
26 notation "hvbox(\langle x break , y \rangle )" with precedence 89
27 for @{ 'pair $x $y}.
28
29 interpretation "Product" 'product x y =
30  (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1) x y).
31
32 notation "hvbox(x break \times y)" with precedence 89
33 for @{ 'product $x $y}.
34
35 definition fst \def \lambda A,B:Set.\lambda p: Prod A B.
36 match p with
37 [(pair a b) \Rightarrow a]. 
38
39 definition snd \def \lambda A,B:Set.\lambda p: Prod A B.
40 match p with
41 [(pair a b) \Rightarrow b].
42
43 interpretation "First projection" 'fst x =
44  (cic:/matita/datatypes/constructors/fst.con _ _ x).
45
46 notation "\fst x" with precedence 89
47 for @{ 'fst $x}.
48
49 interpretation "Second projection" 'snd x =
50  (cic:/matita/datatypes/constructors/snd.con _ _ x).
51
52 notation "\snd x" with precedence 89
53 for @{ 'snd $x}.
54
55 theorem eq_pair_fst_snd: \forall A,B:Set.\forall p:Prod A B.
56 p = 〈 (\fst p), (\snd p) 〉.
57 intros.elim p.simplify.reflexivity.
58 qed.
59
60 inductive Sum (A,B:Set) : Set \def
61   inl : A \to Sum A B
62 | inr : B \to Sum A B.
63
64 inductive ProdT (A,B:Type) : Type \def
65 pairT : A \to B \to ProdT A B.
66
67 definition fstT \def \lambda A,B:Type.\lambda p: ProdT A B.
68 match p with
69 [(pairT a b) \Rightarrow a]. 
70
71 definition sndT \def \lambda A,B:Type.\lambda p: ProdT A B.
72 match p with
73 [(pairT a b) \Rightarrow b].