]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/contribs/assembly/freescale/freescale_ocaml/matita_nat_nat.ml
branch for universe
[helm.git] / matita / contribs / assembly / freescale / freescale_ocaml / matita_nat_nat.ml
diff --git a/matita/contribs/assembly/freescale/freescale_ocaml/matita_nat_nat.ml b/matita/contribs/assembly/freescale/freescale_ocaml/matita_nat_nat.ml
new file mode 100644 (file)
index 0000000..dfefaeb
--- /dev/null
@@ -0,0 +1,31 @@
+type nat =
+O
+ | S of nat
+;;
+
+let nat_rec =
+(function p -> (function f -> let rec aux = 
+(function n -> 
+(match n with 
+   O -> p
+ | S(n1) -> (f n1 (aux n1)))
+) in aux))
+;;
+
+let nat_rect =
+(function p -> (function f -> let rec aux = 
+(function n -> 
+(match n with 
+   O -> p
+ | S(n1) -> (f n1 (aux n1)))
+) in aux))
+;;
+
+let pred =
+(function n -> 
+(match n with 
+   O -> O
+ | S(p) -> p)
+)
+;;
+