X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Ftests%2Fcoercions.ma;h=e792bd78010b3a67a87f3455be0ff3998f5e891b;hb=2499f5fdcf4dbfecc6f4fafe925b24ae76f14be8;hp=914126de2454d4804dfc6909837254f6d6417c68;hpb=f764844fa35ab0bb9c10707151340b924060f069;p=helm.git diff --git a/matita/tests/coercions.ma b/matita/tests/coercions.ma index 914126de2..e792bd780 100644 --- a/matita/tests/coercions.ma +++ b/matita/tests/coercions.ma @@ -13,16 +13,14 @@ (**************************************************************************) set "baseuri" "cic:/matita/tests/coercions/". -include "nat/nat.ma". + +include "nat/compare.ma". +include "datatypes/bool.ma". inductive pos: Set \def | one : pos | next : pos \to pos. -inductive nat:Set \def -| O : nat -| S : nat \to nat. - inductive int: Set \def | positive: nat \to int | negative : nat \to int. @@ -60,11 +58,6 @@ definition double2: \forall f:int \to int. pos \to int \def \lambda f:int \to int. \lambda x : pos .f (nat2int (pos2nat x)). - -coercion cic:/matita/logic/equality/eq_f.con. -coercion cic:/matita/logic/equality/eq_f1.con. -variant xxx : ? \def eq_f. -coercion cic:/matita/tests/coercions/xxx.con. theorem coercion_svelta : \forall T,S:Type.\forall f:T \to S.\forall x,y:T.x=y \to f y = f x. intros. @@ -73,8 +66,6 @@ qed. variant pos2nat' : ? \def pos2nat. -coercion cic:/matita/tests/coercions/xxx.con. - inductive initial: Set \def iii : initial. definition i2pos: ? \def \lambda x:initial.one. @@ -83,4 +74,39 @@ coercion cic:/matita/tests/coercions/i2pos.con. coercion cic:/matita/tests/coercions/pos2nat'.con. +inductive listn (A:Type) : nat \to Type \def + | Nil : listn A O + | Next : \forall n.\forall l:listn A n.\forall a:A.listn A (S n). + +definition if : \forall A:Type.\forall b:bool.\forall a,c:A.A \def + \lambda A,b,a,c. + match b with + [ true \Rightarrow a + | false \Rightarrow c]. + +let rec ith (A:Type) (n,m:nat) (dummy:A) (l:listn A n) on l \def + match l with + [ Nil \Rightarrow dummy + | (Next w l x) \Rightarrow if A (eqb w m) x (ith A w m dummy l)]. + +definition listn2function: + \forall A:Type.\forall dummy:A.\forall n.listn A n \to nat \to A +\def + \lambda A,dummy,n,l,m.ith A n m dummy l. + +definition natlist2map: ? \def listn2function nat O. + +coercion cic:/matita/tests/coercions/natlist2map.con 1. +definition map: \forall n:nat.\forall l:listn nat n. nat \to nat \def + \lambda n:nat.\lambda l:listn nat n.\lambda m:nat.l m. + +definition church: nat \to nat \to nat \def times. + +coercion cic:/matita/tests/coercions/church.con 1. + +definition mapmult: \forall n:nat.\forall l:listn nat n. nat \to nat \to nat \def + \lambda n:nat.\lambda l:listn nat n.\lambda m,o:nat.l m o. + + + \ No newline at end of file