X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Flibrary%2Fdatatypes%2Fconstructors.ma;h=d8130d714d1ac75f6d8e52c851ff5dd8eafe743b;hb=790eccfa6b94dc82826d919691f8d4bfadb04573;hp=3f74db5ad85cfb8b7e9ce99d414471fe53f88f3b;hpb=68a2f8d0a8c34cb7ea0438c7db9222a853a38826;p=helm.git diff --git a/helm/software/matita/library/datatypes/constructors.ma b/helm/software/matita/library/datatypes/constructors.ma index 3f74db5ad..d8130d714 100644 --- a/helm/software/matita/library/datatypes/constructors.ma +++ b/helm/software/matita/library/datatypes/constructors.ma @@ -12,38 +12,48 @@ (* *) (**************************************************************************) -set "baseuri" "cic:/matita/datatypes/constructors/". include "logic/equality.ma". inductive void : Set \def. -inductive Prod (A,B:Set) : Set \def +inductive unit : Set ≝ something: unit. + +inductive Prod (A,B:Type) : Type \def pair : A \to B \to Prod A B. -definition fst \def \lambda A,B:Set.\lambda p: Prod A B. +interpretation "Pair construction" 'pair x y = + (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1/1) _ _ x y). + +interpretation "Product" 'product x y = + (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1) x y). + +definition fst \def \lambda A,B:Type.\lambda p: Prod A B. match p with [(pair a b) \Rightarrow a]. -definition snd \def \lambda A,B:Set.\lambda p: Prod A B. +definition snd \def \lambda A,B:Type.\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 "pair pi1" 'pi1 = (fst _ _). +interpretation "pair pi2" 'pi2 = (snd _ _). +interpretation "pair pi1" 'pi1a x = (fst _ _ x). +interpretation "pair pi2" 'pi2a x = (snd _ _ x). +interpretation "pair pi1" 'pi1b x y = (fst _ _ x y). +interpretation "pair pi2" 'pi2b x y = (snd _ _ x y). + +theorem eq_pair_fst_snd: \forall A,B:Type.\forall p:Prod A B. +p = 〈 \fst p, \snd p 〉. intros.elim p.simplify.reflexivity. qed. -inductive Sum (A,B:Set) : Set \def +inductive Sum (A,B:Type) : Type \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. +interpretation "Disjoint union" 'plus A B = + (cic:/matita/datatypes/constructors/Sum.ind#xpointer(1/1) 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 +inductive option (A:Type) : Type ≝ + None : option A + | Some : A → option A.