]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_notation/cicNotationPp.ml
- bugfix: eta abstractions ignores attributed node while counting lambdas
[helm.git] / helm / ocaml / cic_notation / cicNotationPp.ml
index d51d1a65ec37dd14aaac2cd8307370bda65a7926..e784a8302173f188ac0d515b5cca26a29e194528 100644 (file)
@@ -53,8 +53,10 @@ let pp_literal = function  (* debugging version *)
 let rec pp_term ?(pp_parens = true) t =
   let t_pp =
     match t with
-    | Ast.AttributedTerm (`Href _, term) when debug_printing ->
-        sprintf "#[%s]" (pp_term ~pp_parens:false term)
+    | Ast.AttributedTerm (`Href hrefs, term) when debug_printing ->
+        sprintf "#(%s)[%s]"
+          (String.concat "," (List.map UriManager.string_of_uri hrefs))
+          (pp_term ~pp_parens:false term)
     | Ast.AttributedTerm (`IdRef id, term) when debug_printing ->
         sprintf "x(%s)[%s]" id (pp_term ~pp_parens:false term)
     | Ast.AttributedTerm (_, term) when debug_printing ->
@@ -73,9 +75,18 @@ let rec pp_term ?(pp_parens = true) t =
         sprintf "\\%s %s.%s" (pp_binder kind) (pp_capture_variable var)
           (pp_term body)
     | Ast.Case (term, indtype, typ, patterns) ->
-        sprintf "%smatch %s with %s"
+        sprintf "%smatch %s%s with %s"
           (match typ with None -> "" | Some t -> sprintf "[%s]" (pp_term t))
-          (pp_term term) (pp_patterns patterns)
+          (pp_term term)
+          (match indtype with
+          | None -> ""
+          | Some (ty, href_opt) ->
+              sprintf " in %s%s" ty
+              (match debug_printing, href_opt with
+              | true, Some uri ->
+                  sprintf "(i.e.%s)" (UriManager.string_of_uri uri)
+              | _ -> ""))
+          (pp_patterns patterns)
     | Ast.Cast (t1, t2) -> sprintf "(%s: %s)" (pp_term t1) (pp_term t2)
     | Ast.LetIn (var, t1, t2) ->
         sprintf "let %s = %s in %s" (pp_capture_variable var) (pp_term t1)
@@ -120,12 +131,18 @@ let rec pp_term ?(pp_parens = true) t =
 and pp_subst (name, term) = sprintf "%s \\Assign %s" name (pp_term term)
 and pp_substs substs = String.concat "; " (List.map pp_subst substs)
 
-and pp_pattern ((head, vars), term) =
+and pp_pattern ((head, href, vars), term) =
+  let head_pp =
+    head ^
+    (match debug_printing, href with
+    | true, Some uri -> sprintf "(i.e.%s)" (UriManager.string_of_uri uri)
+    | _ -> "")
+  in
   sprintf "%s \\Rightarrow %s"
     (match vars with
-    | [] -> head
+    | [] -> head_pp
     | _ ->
-        sprintf "(%s %s)" head
+        sprintf "(%s %s)" head_pp
           (String.concat " " (List.map pp_capture_variable vars)))
     (pp_term term)