]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_transformations/cexpr2pres_hashtbl.ml
###############################################################
[helm.git] / helm / ocaml / cic_transformations / cexpr2pres_hashtbl.ml
index 657464270b727a8421c2f747a225127eabbbe423..79c9943c9985fc3b9839a3aa823a10e2701d2eba 100644 (file)
@@ -214,6 +214,27 @@ Hashtbl.add C2P.symbol_table "not" (unary
        P.Mtext([],"(");P.Mo([],Netconversion.ustring_of_uchar `Enc_utf8 0xAC);
        cexpr2pres a;P.Mtext([],")")])));
 
+(* inv *)
+Hashtbl.add C2P.symbol_table "inv" (unary
+  (fun a ~priority ~assoc ~tail attr sattr ->
+    P.Msup([],
+      P.Mrow([],[
+        P.Mtext([],"(");
+        cexpr2pres a;
+        P.Mtext([],")")]),
+      P.Mrow([],[
+        P.Mo([],"-");
+        P.Mn([],"1")]))));
+
+(* opp *)
+Hashtbl.add C2P.symbol_table "opp" (unary
+  (fun a ~priority ~assoc ~tail attr sattr ->
+    P.Mrow([],[
+      P.Mo([],"-");
+      P.Mtext([],"(");
+      cexpr2pres a;
+      P.Mtext([],")")])));
+
 (* leq *)
 Hashtbl.add C2P.symbol_table "leq" (binary
   (fun a b ~priority ~assoc ~tail aattr sattr ->
@@ -415,5 +436,34 @@ Hashtbl.add C2P.symbol_table_charcount "minus" (binary
        P.two_rows_table_without_brackets aattr
          (cexpr2pres_charcount ~priority:60 ~assoc:true ~tail:[] a)
          (cexpr2pres_charcount ~priority:60 ~assoc:false ~tail:tail b)
-         (P.Mo(sattr,"-"))))
+         (P.Mo(sattr,"-"))));
+
+(* div *)
+Hashtbl.add C2P.symbol_table "div" (binary
+  (fun a b ~priority ~assoc ~tail aattr sattr ->
+     if (priority > 60) || (priority = 60 && assoc) then
+       P.row_with_brackets aattr
+         (cexpr2pres ~priority:60 ~assoc:true ~tail:[] a)
+         (cexpr2pres ~priority:60 ~assoc:false 
+            ~tail:(P.Mtext([],")")::tail) b)
+         (P.Mo(sattr,"/"))
+     else 
+       P.row_without_brackets aattr
+         (cexpr2pres ~priority:60 ~assoc:true ~tail:[] a)
+         (cexpr2pres ~priority:60 ~assoc:false ~tail:tail b)
+         (P.Mo(sattr,"/"))));
+
+Hashtbl.add C2P.symbol_table_charcount "div" (binary
+  (fun a b ~priority ~assoc ~tail aattr sattr ->
+     if (priority > 60) || (priority = 60 && assoc) then
+       P.two_rows_table_with_brackets aattr
+         (cexpr2pres_charcount ~priority:60 ~assoc:true ~tail:[] a)
+         (cexpr2pres_charcount ~priority:60 ~assoc:false 
+           ~tail:(P.Mtext([],")")::tail) b)
+         (P.Mo(sattr,"/"))
+     else
+       P.two_rows_table_without_brackets aattr
+         (cexpr2pres_charcount ~priority:60 ~assoc:true ~tail:[] a)
+         (cexpr2pres_charcount ~priority:60 ~assoc:false ~tail:tail b)
+         (P.Mo(sattr,"/"))))
 ;;