aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbarras2012-11-21 14:36:17 +0000
committerbarras2012-11-21 14:36:17 +0000
commit36f655f6ff08c6b6f744e1d26465e07a95f0fc9a (patch)
treec1066afb4604113d2a7816109d3bf62438490ade
parentad3449aaf7bfed47b476f958f1c1ebfb898effc3 (diff)
Print univ constraints generated by a constant or inductive (when flag is set)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15989 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--printing/prettyp.ml6
-rw-r--r--printing/printer.ml13
-rw-r--r--printing/printer.mli4
3 files changed, 19 insertions, 4 deletions
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index 3136847b03..1e17a8ab08 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -418,10 +418,12 @@ let print_constant with_values sep sp =
| None ->
str"*** [ " ++
print_basename sp ++ str " : " ++ cut () ++ pr_ltype typ ++
- str" ]"
+ str" ]" ++
+ Printer.pr_univ_cstr cb.const_constraints
| _ ->
print_basename sp ++ str sep ++ cut () ++
- (if with_values then print_typed_body (val_0,typ) else pr_ltype typ))
+ (if with_values then print_typed_body (val_0,typ) else pr_ltype typ)++
+ Printer.pr_univ_cstr cb.const_constraints)
let gallina_print_constant_with_infos sp =
print_constant true " = " sp ++
diff --git a/printing/printer.ml b/printing/printer.ml
index 69fec870a3..a5f884d46c 100644
--- a/printing/printer.ml
+++ b/printing/printer.ml
@@ -113,6 +113,13 @@ let pr_sort s = pr_glob_sort (extern_sort s)
let _ = Termops.set_print_constr pr_lconstr_env
+let pr_in_comment pr x = str "(* " ++ pr x ++ str " *)"
+let pr_univ_cstr (c:Univ.constraints) =
+ if !Detyping.print_universes && not (Univ.is_empty_constraint c) then
+ fnl()++pr_in_comment (fun c -> v 0 (Univ.pr_constraints c)) c
+ else
+ mt()
+
(**********************************************************************)
(* Global references *)
@@ -674,7 +681,8 @@ let print_mutual_inductive env mind mib =
hov 0 (
str (if mib.mind_finite then "Inductive " else "CoInductive ") ++
prlist_with_sep (fun () -> fnl () ++ str" with ")
- (print_one_inductive env mib) inds)
+ (print_one_inductive env mib) inds ++
+ pr_univ_cstr mib.mind_constraints)
let get_fields =
let rec prodec_rec l subst c =
@@ -709,7 +717,8 @@ let print_record env mind mib =
prlist_with_sep (fun () -> str ";" ++ brk(2,0))
(fun (id,b,c) ->
pr_id id ++ str (if b then " : " else " := ") ++
- pr_lconstr_env envpar c) fields) ++ str" }")
+ pr_lconstr_env envpar c) fields) ++ str" }" ++
+ pr_univ_cstr mib.mind_constraints)
let pr_mutual_inductive_body env mind mib =
if mib.mind_record & not !Flags.raw_print then
diff --git a/printing/printer.mli b/printing/printer.mli
index 8fb802cce5..47dfa32b9c 100644
--- a/printing/printer.mli
+++ b/printing/printer.mli
@@ -70,6 +70,10 @@ val pr_cases_pattern : cases_pattern -> std_ppcmds
val pr_sort : sorts -> std_ppcmds
+(** Universe constraints *)
+
+val pr_univ_cstr : Univ.constraints -> std_ppcmds
+
(** Printing global references using names as short as possible *)
val pr_global_env : Idset.t -> global_reference -> std_ppcmds