]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/contribs/assembly/freescale/freescale_ocaml/matita_nat_compare.ml
branch for universe
[helm.git] / matita / contribs / assembly / freescale / freescale_ocaml / matita_nat_compare.ml
diff --git a/matita/contribs/assembly/freescale/freescale_ocaml/matita_nat_compare.ml b/matita/contribs/assembly/freescale/freescale_ocaml/matita_nat_compare.ml
new file mode 100644 (file)
index 0000000..e37ab1d
--- /dev/null
@@ -0,0 +1,51 @@
+let eqb =
+let rec eqb = 
+(function n -> (function m -> 
+(match n with 
+   Matita_nat_nat.O -> 
+(match m with 
+   Matita_nat_nat.O -> Matita_datatypes_bool.True
+ | Matita_nat_nat.S(q) -> Matita_datatypes_bool.False)
+
+ | Matita_nat_nat.S(p) -> 
+(match m with 
+   Matita_nat_nat.O -> Matita_datatypes_bool.False
+ | Matita_nat_nat.S(q) -> (eqb p q))
+)
+)) in eqb
+;;
+
+let leb =
+let rec leb = 
+(function n -> (function m -> 
+(match n with 
+   Matita_nat_nat.O -> Matita_datatypes_bool.True
+ | Matita_nat_nat.S(p) -> 
+(match m with 
+   Matita_nat_nat.O -> Matita_datatypes_bool.False
+ | Matita_nat_nat.S(q) -> (leb p q))
+)
+)) in leb
+;;
+
+let ltb =
+(function n -> (function m -> (Matita_datatypes_bool.andb (leb n m) (Matita_datatypes_bool.notb (eqb n m)))))
+;;
+
+let nat_compare =
+let rec nat_compare = 
+(function n -> (function m -> 
+(match n with 
+   Matita_nat_nat.O -> 
+(match m with 
+   Matita_nat_nat.O -> Matita_datatypes_compare.EQ
+ | Matita_nat_nat.S(q) -> Matita_datatypes_compare.LT)
+
+ | Matita_nat_nat.S(p) -> 
+(match m with 
+   Matita_nat_nat.O -> Matita_datatypes_compare.GT
+ | Matita_nat_nat.S(q) -> (nat_compare p q))
+)
+)) in nat_compare
+;;
+