src/Pure/display.ML
changeset 19702 2ab12e94156f
parent 19698 f48cfaacd92c
child 19703 9c84266e1d5f
equal deleted inserted replaced
19701:c07c31ac689b 19702:2ab12e94156f
   205     fun pretty_abbrev (c, (ty, t)) = Pretty.block
   205     fun pretty_abbrev (c, (ty, t)) = Pretty.block
   206       (prt_const (c, ty) @ [Pretty.str " ==", Pretty.brk 1, prt_term_no_vars t]);
   206       (prt_const (c, ty) @ [Pretty.str " ==", Pretty.brk 1, prt_term_no_vars t]);
   207 
   207 
   208     fun pretty_axm (a, t) = Pretty.block [Pretty.str (a ^ ":"), Pretty.brk 1, prt_term_no_vars t];
   208     fun pretty_axm (a, t) = Pretty.block [Pretty.str (a ^ ":"), Pretty.brk 1, prt_term_no_vars t];
   209 
   209 
       
   210     fun pretty_finals reds = Pretty.block
       
   211       (Pretty.str "final:" :: Pretty.brk 1 :: Pretty.commas (map (prt_const' o #1) reds));
       
   212 
   210     fun pretty_reduct (lhs, rhs) = Pretty.block
   213     fun pretty_reduct (lhs, rhs) = Pretty.block
   211       ([prt_const' lhs, Pretty.str "  ->", Pretty.brk 2] @ Pretty.commas (map prt_const' rhs));
   214       ([prt_const' lhs, Pretty.str "  ->", Pretty.brk 2] @
       
   215         Pretty.commas (map prt_const' (sort_wrt #1 rhs)));
   212 
   216 
   213     fun pretty_restrict (const, name) =
   217     fun pretty_restrict (const, name) =
   214       Pretty.block ([prt_const' const, Pretty.brk 2, Pretty.str ("(from " ^ quote name ^ ")")]);
   218       Pretty.block ([prt_const' const, Pretty.brk 2, Pretty.str ("(from " ^ quote name ^ ")")]);
   215 
   219 
   216     val {axioms, defs, oracles} = Theory.rep_theory thy;
   220     val {axioms, defs, oracles} = Theory.rep_theory thy;
   230     val abbrevs = map_filter (fn (c, (ty, SOME t)) => SOME (c, (ty, t)) | _ => NONE) cnsts;
   234     val abbrevs = map_filter (fn (c, (ty, SOME t)) => SOME (c, (ty, t)) | _ => NONE) cnsts;
   231     val cnstrs = NameSpace.extern_table constraints;
   235     val cnstrs = NameSpace.extern_table constraints;
   232     val axms = NameSpace.extern_table axioms;
   236     val axms = NameSpace.extern_table axioms;
   233     val oras = NameSpace.extern_table oracles;
   237     val oras = NameSpace.extern_table oracles;
   234 
   238 
   235     val reds = reducts |> map_filter (fn (lhs, rhs) =>
   239     val (reds0, (reds1, reds2)) = reducts |> map (fn (lhs, rhs) =>
   236       if null rhs then NONE
   240         (apfst extern_const lhs, map (apfst extern_const) rhs))
   237       else SOME (apfst extern_const lhs, map (apfst extern_const) rhs)) |> sort_wrt (#1 o #1);
   241       |> sort_wrt (#1 o #1)
       
   242       |> List.partition (null o #2)
       
   243       ||> List.partition (Defs.plain_args o #2 o #1);
   238     val rests = restricts |> map (apfst (apfst extern_const)) |> sort_wrt (#1 o #1);
   244     val rests = restricts |> map (apfst (apfst extern_const)) |> sort_wrt (#1 o #1);
   239   in
   245   in
   240     [Pretty.strs ("names:" :: Context.names_of thy),
   246     [Pretty.strs ("names:" :: Context.names_of thy),
   241       Pretty.strs ("theory data:" :: Context.theory_data_of thy),
   247       Pretty.strs ("theory data:" :: Context.theory_data_of thy),
   242       Pretty.strs ("proof data:" :: Context.proof_data_of thy),
   248       Pretty.strs ("proof data:" :: Context.proof_data_of thy),
   249       Pretty.big_list "type arities:" (pretty_arities arties),
   255       Pretty.big_list "type arities:" (pretty_arities arties),
   250       Pretty.big_list "logical consts:" (map (Pretty.block o prt_const) log_cnsts),
   256       Pretty.big_list "logical consts:" (map (Pretty.block o prt_const) log_cnsts),
   251       Pretty.big_list "abbreviations:" (map pretty_abbrev abbrevs),
   257       Pretty.big_list "abbreviations:" (map pretty_abbrev abbrevs),
   252       Pretty.big_list "constraints:" (map (Pretty.block o prt_const) cnstrs),
   258       Pretty.big_list "constraints:" (map (Pretty.block o prt_const) cnstrs),
   253       Pretty.big_list "axioms:" (map pretty_axm axms),
   259       Pretty.big_list "axioms:" (map pretty_axm axms),
       
   260       Pretty.strs ("oracles:" :: (map #1 oras)),
   254       Pretty.big_list "definitions:"
   261       Pretty.big_list "definitions:"
   255         [Pretty.big_list "open dependencies:" (map pretty_reduct reds),
   262         [pretty_finals reds0,
   256          Pretty.big_list "pattern restrictions:" (map pretty_restrict rests)],
   263          Pretty.big_list "non-overloaded:" (map pretty_reduct reds1),
   257       Pretty.strs ("oracles:" :: (map #1 oras))]
   264          Pretty.big_list "overloaded:" (map pretty_reduct reds2),
       
   265          Pretty.big_list "pattern restrictions:" (map pretty_restrict rests)]]
   258   end;
   266   end;
   259 
   267 
   260 
   268 
   261 
   269 
   262 (** print_goals **)
   270 (** print_goals **)