113 |
113 |
114 fun pretty_default S = Pretty.block |
114 fun pretty_default S = Pretty.block |
115 [Pretty.str "default sort:", Pretty.brk 1, prt_sort S]; |
115 [Pretty.str "default sort:", Pretty.brk 1, prt_sort S]; |
116 |
116 |
117 val tfrees = map (fn v => TFree (v, [])); |
117 val tfrees = map (fn v => TFree (v, [])); |
118 fun pretty_type syn (t, (Type.LogicalType n)) = |
118 fun pretty_type syn (t, Type.LogicalType n) = |
119 if syn then NONE |
119 if syn then NONE |
120 else SOME (prt_typ (Type (t, tfrees (Name.invent Name.context Name.aT n)))) |
120 else SOME (prt_typ (Type (t, tfrees (Name.invent Name.context Name.aT n)))) |
121 | pretty_type syn (t, (Type.Abbreviation (vs, U, syn'))) = |
121 | pretty_type syn (t, Type.Abbreviation (vs, U, syn')) = |
122 if syn <> syn' then NONE |
122 if syn <> syn' then NONE |
123 else SOME (Pretty.block |
123 else SOME (Pretty.block |
124 [prt_typ (Type (t, tfrees vs)), Pretty.str " =", Pretty.brk 1, prt_typ U]) |
124 [prt_typ (Type (t, tfrees vs)), Pretty.str " =", Pretty.brk 1, prt_typ U]) |
125 | pretty_type syn (t, Type.Nonterminal) = |
125 | pretty_type syn (t, Type.Nonterminal) = |
126 if not syn then NONE |
126 if not syn then NONE |
153 val type_space = Type.type_space tsig; |
153 val type_space = Type.type_space tsig; |
154 val (class_space, class_algebra) = classes; |
154 val (class_space, class_algebra) = classes; |
155 val classes = Sorts.classes_of class_algebra; |
155 val classes = Sorts.classes_of class_algebra; |
156 val arities = Sorts.arities_of class_algebra; |
156 val arities = Sorts.arities_of class_algebra; |
157 |
157 |
158 fun extern_item (Defs.Constant, c) = (Defs.Constant, Name_Space.extern ctxt const_space c) |
158 val item_space = fn Defs.Constant => const_space | Defs.Type => type_space; |
159 | extern_item (Defs.Type, c) = (Defs.Type, Name_Space.extern ctxt type_space c); |
159 fun extern_item (k, c) = (k, Name_Space.extern ctxt (item_space k) c); |
160 |
160 fun prune_item (k, c) = not verbose andalso Name_Space.is_concealed (item_space k) c; |
161 fun prune_item (Defs.Constant, c) = not verbose andalso Consts.is_concealed consts c |
|
162 | prune_item (Defs.Type, c) = not verbose andalso Name_Space.is_concealed type_space c; |
|
163 |
161 |
164 val clsses = |
162 val clsses = |
165 Name_Space.extern_entries verbose ctxt class_space |
163 Name_Space.extern_entries verbose ctxt class_space |
166 (map (fn ((c, _), cs) => (c, Sign.minimize_sort thy cs)) (Graph.dest classes)) |
164 (map (fn ((c, _), cs) => (c, Sign.minimize_sort thy cs)) (Graph.dest classes)) |
167 |> map (apfst #1); |
165 |> map (apfst #1); |
168 val tdecls = Name_Space.extern_table verbose ctxt types |> map (apfst #1); |
166 val tdecls = Name_Space.extern_table verbose ctxt types |> map (apfst #1); |
169 val arties = |
167 val arties = |
170 Name_Space.extern_entries verbose ctxt (Type.type_space tsig) (Symtab.dest arities) |
168 Name_Space.extern_entries verbose ctxt type_space (Symtab.dest arities) |
171 |> map (apfst #1); |
169 |> map (apfst #1); |
172 |
170 |
173 val cnsts = Name_Space.markup_entries verbose ctxt const_space constants; |
171 val cnsts = Name_Space.markup_entries verbose ctxt const_space constants; |
174 val log_cnsts = map_filter (fn (c, (ty, NONE)) => SOME (c, ty) | _ => NONE) cnsts; |
172 val log_cnsts = map_filter (fn (c, (ty, NONE)) => SOME (c, ty) | _ => NONE) cnsts; |
175 val abbrevs = map_filter (fn (c, (ty, SOME t)) => SOME (c, (ty, t)) | _ => NONE) cnsts; |
173 val abbrevs = map_filter (fn (c, (ty, SOME t)) => SOME (c, (ty, t)) | _ => NONE) cnsts; |