From: Stefano Zacchiroli Date: Tue, 24 Feb 2004 16:09:10 +0000 (+0000) Subject: added binary {positive,integer} notation X-Git-Tag: v0_0_4~83 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=320b8572a343818d9bf1d7d75502c92cc8043010;p=helm.git added binary {positive,integer} notation --- diff --git a/helm/ocaml/cic_disambiguation/arit_notation.ml b/helm/ocaml/cic_disambiguation/arit_notation.ml index 324501eb3..d21c5d3a7 100644 --- a/helm/ocaml/cic_disambiguation/arit_notation.ml +++ b/helm/ocaml/cic_disambiguation/arit_notation.ml @@ -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);