]> matita.cs.unibo.it Git - helm.git/commitdiff
added binary {positive,integer} notation
authorStefano Zacchiroli <zack@upsilon.cc>
Tue, 24 Feb 2004 16:09:10 +0000 (16:09 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Tue, 24 Feb 2004 16:09:10 +0000 (16:09 +0000)
helm/ocaml/cic_disambiguation/arit_notation.ml

index 324501eb31055db58aab1d8f4f70a1dc4db440d2..d21c5d3a79f3c9ac2c3bfa5c2d73cae9e1eabc23 100644 (file)
@@ -74,23 +74,57 @@ let _ =
   DisambiguateChoices.add_num_choice
     ("real number",
       (fun _ num _ -> HelmLibraryObjects.build_real (int_of_string num)));
+  DisambiguateChoices.add_num_choice
+    ("binary positive number",
+      (fun _ num _ ->
+        let num = int_of_string num in
+        if num = 0 then
+          raise DisambiguateChoices.Invalid_choice
+        else
+          HelmLibraryObjects.build_bin_pos num));
+  DisambiguateChoices.add_num_choice
+    ("binary integer number",
+      (fun _ num _ ->
+        let num = int_of_string num in
+        if num = 0 then
+          HelmLibraryObjects.BinInt.z0
+        else if num > 0 then
+          Cic.Appl [
+            HelmLibraryObjects.BinInt.zpos;
+            HelmLibraryObjects.build_bin_pos num ]
+        else
+          assert false));
 
   DisambiguateChoices.add_binary_op "plus" "natural plus"
     HelmLibraryObjects.Peano.plus;
   DisambiguateChoices.add_binary_op "plus" "real plus"
     HelmLibraryObjects.Reals.rplus;
+  DisambiguateChoices.add_binary_op "plus" "binary integer plus"
+    HelmLibraryObjects.BinInt.zplus;
+  DisambiguateChoices.add_binary_op "plus" "binary positive plus"
+    HelmLibraryObjects.BinPos.pplus;
   DisambiguateChoices.add_binary_op "minus" "natural minus"
     (const HelmLibraryObjects.Peano.minus_URI);
   DisambiguateChoices.add_binary_op "minus" "real minus"
     (const HelmLibraryObjects.Reals.rminus_URI);
+  DisambiguateChoices.add_binary_op "minus" "binary integer minus"
+    HelmLibraryObjects.BinInt.zminus;
+  DisambiguateChoices.add_binary_op "minus" "binary positive minus"
+    HelmLibraryObjects.BinPos.pminus;
   DisambiguateChoices.add_binary_op "times" "natural times"
     (const HelmLibraryObjects.Peano.mult_URI);
   DisambiguateChoices.add_binary_op "times" "real times"
     (const HelmLibraryObjects.Reals.rmult_URI);
+  DisambiguateChoices.add_binary_op "times" "binary positive times"
+    HelmLibraryObjects.BinPos.pmult;
   DisambiguateChoices.add_binary_op "divide" "real divide"
     (const HelmLibraryObjects.Reals.rdiv_URI);
   DisambiguateChoices.add_unary_op "uminus" "real unary minus"
     (const HelmLibraryObjects.Reals.ropp_URI);
+  DisambiguateChoices.add_unary_op "uminus" "binary integer negative sign"
+    (HelmLibraryObjects.BinInt.zneg);
+  DisambiguateChoices.add_unary_op "uminus" "binary integer unary minus"
+    (HelmLibraryObjects.BinInt.zopp);
 
   DisambiguateChoices.add_binary_op "leq" "natural 'less or equal to'"
     (mutind HelmLibraryObjects.Peano.le_URI);