X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=components%2Facic_content%2FcicNotationPp.ml;h=47bfe2748693c07975996bd6f7662fb91ddc44d4;hb=3cfd4bb3d93b84b4b59ac04265ec00e5f5253c02;hp=ff0a09265c0d6b985d4c439b70931f74f0b8eb0a;hpb=9e18c7f8aa6c5b905598521c769c1a2f58c13262;p=helm.git diff --git a/components/acic_content/cicNotationPp.ml b/components/acic_content/cicNotationPp.ml index ff0a09265..47bfe2748 100644 --- a/components/acic_content/cicNotationPp.ml +++ b/components/acic_content/cicNotationPp.ml @@ -99,7 +99,6 @@ let rec pp_term ?(pp_parens = true) t = | Ast.Case (term, indtype, typ, patterns) -> sprintf "match %s%s%s with %s" (pp_term term) - (match typ with None -> "" | Some t -> sprintf " return %s" (pp_term t)) (match indtype with | None -> "" | Some (ty, href_opt) -> @@ -107,37 +106,29 @@ let rec pp_term ?(pp_parens = true) t = (match debug_printing, href_opt with | true, Some uri -> sprintf "(i.e.%s)" (UriManager.string_of_uri uri) - | _ -> "")) + | _ -> "")) + (match typ with None -> "" | Some t -> sprintf " return %s" (pp_term t)) (pp_patterns patterns) | Ast.Cast (t1, t2) -> sprintf "(%s: %s)" (pp_term ~pp_parens:true t1) (pp_term ~pp_parens:true t2) | Ast.LetIn (var, t1, t2) -> sprintf "let %s \\def %s in %s" (pp_capture_variable var) (pp_term ~pp_parens:true t1) (pp_term ~pp_parens:true t2) | Ast.LetRec (kind, definitions, term) -> - let strip i t = - let rec aux i l = function - | Ast.Binder (_, var, body) when i > 0 -> aux (pred i) (var :: l) body - | body -> List.rev l, body - in - aux i [] t - in let rec get_guard i = function - | [] -> assert false + | [] -> (*assert false*) Ast.Implicit | [term, _] when i = 1 -> term | _ :: tl -> get_guard (pred i) tl in - let map (var, body, i) = - let id, vars, typ, body = match var with - | term, Some typ -> - let pvars, pbody = strip i typ in - let _, bbody = strip i body in - term, pvars, pbody, bbody - | _ -> assert false - in + let map (params, (id,typ), body, i) = + let typ = + match typ with + None -> Ast.Implicit + | Some typ -> typ + in sprintf "%s %s on %s: %s \\def %s" (pp_term ~pp_parens:false term) - (String.concat " " (List.map pp_capture_variable vars)) - (pp_term ~pp_parens:false (get_guard i vars)) + (String.concat " " (List.map pp_capture_variable params)) + (pp_term ~pp_parens:false (get_guard i params)) (pp_term typ) (pp_term body) in sprintf "let %s %s in %s" @@ -268,12 +259,7 @@ let set_pp_term f = _pp_term := f let pp_params = function | [] -> "" - | params -> - " " ^ - String.concat " " - (List.map - (fun (name, typ) -> sprintf "(%s:%s)" name (pp_term typ)) - params) + | params -> " " ^ String.concat " " (List.map pp_capture_variable params) let pp_flavour = function | `Definition -> "definition" @@ -289,8 +275,11 @@ let pp_fields fields = (if fields <> [] then "\n" else "") ^ String.concat ";\n" (List.map - (fun (name,ty,coercion) -> - " " ^ name ^ if coercion then ":>" else ": " ^ pp_term ty) fields) + (fun (name,ty,coercion,arity) -> + " " ^ name ^ + if coercion then (":" ^ + if arity > 0 then string_of_int arity else "" ^ ">") else ": " ^ + pp_term ty) fields) let pp_obj = function | Ast.Inductive (params, types) ->