X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_proof_checking%2FcicPp.ml;h=b9a5b72f478dfbad467211e3935163647711c540;hb=ac7687ce66526f905874ed99a845223c853c558a;hp=5c5bd71fff473b8522256c633a0fa7c5e9546c74;hpb=3eca59409abc3dc4a3c4b07752282fb47e2a5c30;p=helm.git diff --git a/helm/ocaml/cic_proof_checking/cicPp.ml b/helm/ocaml/cic_proof_checking/cicPp.ml index 5c5bd71ff..b9a5b72f4 100644 --- a/helm/ocaml/cic_proof_checking/cicPp.ml +++ b/helm/ocaml/cic_proof_checking/cicPp.ml @@ -69,7 +69,7 @@ let rec pp t l = (match get_nth l n with Some (C.Name s) -> s | Some C.Anonymous -> "__" ^ string_of_int n - | _ -> raise CicPpInternalError + | None -> "_hidden_" ^ string_of_int n ) with NotEnoughElements -> string_of_int (List.length l - n) @@ -85,10 +85,10 @@ let rec pp t l = (match s with C.Prop -> "Prop" | C.Set -> "Set" - | C.Type -> "Type" + | C.Type _ -> "Type" (* TASSI: universe is not explicit *) | C.CProp -> "CProp" ) - | C.Implicit -> "?" + | C.Implicit _ -> "?" | C.Prod (b,s,t) -> (match b with C.Name n -> "(" ^ n ^ ":" ^ pp s l ^ ")" ^ pp t ((Some b)::l) @@ -193,6 +193,24 @@ let ppinductiveType (typename, inductive, arity, cons) = cons "" ;; +let ppcontext ?(sep = "\n") context = + let separate s = if s = "" then "" else s ^ sep in + fst (List.fold_right + (fun context_entry (i,name_context) -> + match context_entry with + Some (n,Cic.Decl t) -> + Printf.sprintf "%s%s : %s" (separate i) (ppname n) + (pp t name_context), (Some n)::name_context + | Some (n,Cic.Def (bo,ty)) -> + Printf.sprintf "%s%s : %s := %s" (separate i) (ppname n) + (match ty with + None -> "_" + | Some ty -> pp ty name_context) + (pp bo name_context), (Some n)::name_context + | None -> + Printf.sprintf "%s_ :? _" (separate i), None::name_context + ) context ("",[])) + (* ppobj obj returns a string with describing the cic object obj in a syntax *) (* similar to the one used by Coq *) let ppobj obj =