]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/content_pres/termContentPres.ml
parameter sintax added to axiom statement
[helm.git] / helm / software / components / content_pres / termContentPres.ml
index 00f6c978982b5f7904f30a098c2eb699a401cd94..68cc4ccbb391e913a21b5fac7ca99419ae781c2d 100644 (file)
@@ -88,13 +88,21 @@ let binder_symbol s =
   add_xml_attrs (RenderingAttrs.builtin_symbol_attributes `MathML)
     (builtin_symbol s)
 
-let string_of_sort_kind = function
-  | `Prop -> "Prop"
-  | `Set -> "Set"
-  | `CProp _ -> "CProp"
-  | `Type _ -> "Type"
-  | `NType s -> "Type[" ^ s ^ "]"
-  | `NCProp s -> "CProp[" ^ s ^ "]"
+let xml_of_sort x = 
+  let to_string x = Ast.Ident (x, None) in
+  let identify x = 
+    add_xml_attrs (RenderingAttrs.keyword_attributes `MathML) (to_string x)
+  in
+  let lvl t = Ast.AttributedTerm (`Level 90,t) in
+  match x with
+  | `Prop -> identify "Prop"
+  | `Set -> identify "Set"
+  | `CProp _ -> identify "CProp"
+  | `Type _ -> identify "Type"
+  | `NType s -> lvl(Ast.Layout (Ast.Sub (identify "Type",to_string s)))
+  | `NCProp s -> lvl(Ast.Layout (Ast.Sub (identify "CProp",to_string s)))
+;;
+
 
 let map_space f l =
  HExtlib.list_concat
@@ -239,7 +247,7 @@ let pp_ast0 t k =
             (fun (params, name, ty, body, rec_param) ->
               [ break;
                 hvbox false true ([
-                  keyword "and";
+                  keyword "and"; space;
                   name] @
                   params @
                   [space; keyword "on" ; space; rec_param ;space ] @
@@ -253,7 +261,8 @@ let pp_ast0 t k =
           ((hvbox false false
             (fst_row :: List.flatten tl_rows
              @ [ break; keyword "in"; break; k where ])))
-    | Ast.Implicit -> builtin_symbol "?"
+    | Ast.Implicit `JustOne -> builtin_symbol "?"
+    | Ast.Implicit `Vector -> builtin_symbol "…"
     | Ast.Meta (n, l) ->
         let local_context l =
             List.map (function None -> None | Some t -> Some (k t)) l
@@ -267,9 +276,7 @@ let pp_ast0 t k =
     | Ast.Literal _
     | Ast.UserInput as leaf -> leaf
     | t -> CicNotationUtil.visit_ast ~special_k k t
-  and aux_sort sort_kind =
-    add_xml_attrs (RenderingAttrs.keyword_attributes `MathML)
-      (Ast.Ident (string_of_sort_kind sort_kind, None))
+  and aux_sort sort_kind = xml_of_sort sort_kind
   and aux_ty = function
     | None -> builtin_symbol "?"
     | Some ty -> k ty
@@ -542,6 +549,8 @@ let head_names names env =
             aux ((name, (ty, v)) :: acc) tl
         | Env.TermType _, Env.TermValue _  ->
             aux ((name, (ty, v)) :: acc) tl
+        | Env.OptType _, Env.OptValue _ ->
+            aux ((name, (ty, v)) :: acc) tl
         | _ -> assert false)
     | _ :: tl -> aux acc tl
       (* base pattern may contain only meta names, thus we trash all others *)
@@ -557,6 +566,8 @@ let tail_names names env =
             aux ((name, (Env.ListType ty, Env.ListValue vtl)) :: acc) tl
         | Env.TermType _, Env.TermValue _  ->
             aux ((name, (ty, v)) :: acc) tl
+        | Env.OptType _, Env.OptValue _ ->
+            aux ((name, (ty, v)) :: acc) tl
         | _ -> assert false)
     | binding :: tl -> aux (binding :: acc) tl
     | [] -> acc
@@ -596,7 +607,7 @@ let instantiate_level2 env term =
         Ast.Ident (name, Some (aux_substs env substs))
     | Ast.Meta (index, substs) -> Ast.Meta (index, aux_meta_substs env substs)
 
-    | Ast.Implicit
+    | Ast.Implicit _
     | Ast.Ident _
     | Ast.Num _
     | Ast.Sort _