src/Pure/Thy/export_theory.ML
author wenzelm
Mon, 06 Aug 2018 11:06:43 +0200
changeset 68727 ec0b2833cfc4
parent 68726 782d6b89fb19
child 68830 44ec6fdaacf8
permissions -rw-r--r--
export shyps as regular typargs;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Thy/export_theory.ML
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     3
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     4
Export foundational theory content.
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     5
*)
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     6
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     7
signature EXPORT_THEORY =
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
     8
sig
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
     9
  val setup_presentation: (Thy_Info.presentation_context -> theory -> unit) -> unit
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    10
  val export_body: theory -> string -> XML.body -> unit
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    11
end;
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    12
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    13
structure Export_Theory: EXPORT_THEORY =
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    14
struct
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    15
68725
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    16
(* names for bound variables *)
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    17
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    18
local
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    19
  fun declare_names (Abs (_, _, b)) = declare_names b
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    20
    | declare_names (t $ u) = declare_names t #> declare_names u
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    21
    | declare_names (Const (c, _)) = Name.declare (Long_Name.base_name c)
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    22
    | declare_names (Free (x, _)) = Name.declare x
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    23
    | declare_names _ = I;
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    24
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    25
  fun variant_abs bs (Abs (x, T, t)) =
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    26
        let
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    27
          val names = fold Name.declare bs (declare_names t Name.context);
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    28
          val x' = #1 (Name.variant x names);
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    29
          val t' = variant_abs (x' :: bs) t;
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    30
        in Abs (x', T, t') end
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    31
    | variant_abs bs (t $ u) = variant_abs bs t $ variant_abs bs u
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    32
    | variant_abs _ t = t;
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    33
in
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    34
  val named_bounds = variant_abs [];
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    35
end;
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    36
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
    37
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    38
(* general setup *)
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    39
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    40
fun setup_presentation f =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    41
  Theory.setup (Thy_Info.add_presentation (fn context => fn thy =>
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    42
    if Options.bool (#options context) "export_theory" then f context thy else ()));
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    43
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    44
fun export_body thy name body =
68230
9bee37c2ac2b more scalable;
wenzelm
parents: 68208
diff changeset
    45
  Export.export thy ("theory/" ^ name) (Buffer.chunks (YXML.buffer_body body Buffer.empty));
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
    46
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    47
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    48
(* presentation *)
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    49
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    50
val _ = setup_presentation (fn {adjust_pos, ...} => fn thy =>
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    51
  let
68264
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
    52
    val rep_tsig = Type.rep_tsig (Sign.tsig_of thy);
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
    53
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
    54
68206
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    55
    (* parents *)
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    56
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    57
    val parents = Theory.parents_of thy;
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    58
    val _ =
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    59
      export_body thy "parents"
68231
0004e7a9fa10 clarified encoding;
wenzelm
parents: 68230
diff changeset
    60
        (XML.Encode.string (cat_lines (map Context.theory_long_name parents)));
68206
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    61
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    62
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    63
    (* entities *)
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    64
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    65
    fun entity_markup space name =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    66
      let
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    67
        val {serial, pos, ...} = Name_Space.the_entry space name;
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    68
        val props =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    69
          Markup.serial_properties serial @
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    70
          Position.offset_properties_of (adjust_pos pos);
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    71
      in (Markup.entityN, (Markup.nameN, name) :: props) end;
68154
42d63ea39161 some export of foundational theory content;
wenzelm
parents:
diff changeset
    72
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    73
    fun export_entities export_name export get_space decls =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    74
      let val elems =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    75
        let
68206
dedf1a70d1fa export more theory and session structure;
wenzelm
parents: 68201
diff changeset
    76
          val parent_spaces = map get_space parents;
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    77
          val space = get_space thy;
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    78
        in
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    79
          (decls, []) |-> fold (fn (name, decl) =>
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    80
            if exists (fn space => Name_Space.declared space name) parent_spaces then I
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    81
            else
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    82
              (case export name decl of
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    83
                NONE => I
68724
7fafadbf16c7 export in foundational order;
wenzelm
parents: 68539
diff changeset
    84
              | SOME body =>
7fafadbf16c7 export in foundational order;
wenzelm
parents: 68539
diff changeset
    85
                  cons (#serial (Name_Space.the_entry space name),
7fafadbf16c7 export in foundational order;
wenzelm
parents: 68539
diff changeset
    86
                    XML.Elem (entity_markup space name, body))))
7fafadbf16c7 export in foundational order;
wenzelm
parents: 68539
diff changeset
    87
          |> sort (int_ord o apply2 #1) |> map #2
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    88
        end;
68724
7fafadbf16c7 export in foundational order;
wenzelm
parents: 68539
diff changeset
    89
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    90
      in if null elems then () else export_body thy export_name elems end;
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
    91
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
    92
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    93
    (* types *)
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
    94
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    95
    val encode_type =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    96
      let open XML.Encode Term_XML.Encode
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    97
      in pair (list string) (option typ) end;
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
    98
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
    99
    fun export_type (Type.LogicalType n) =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   100
          SOME (encode_type (Name.invent Name.context Name.aT n, NONE))
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   101
      | export_type (Type.Abbreviation (args, U, false)) =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   102
          SOME (encode_type (args, SOME U))
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   103
      | export_type _ = NONE;
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
   104
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   105
    val _ =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   106
      export_entities "types" (K export_type) Sign.type_space
68264
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   107
        (Name_Space.dest_table (#types rep_tsig));
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   108
68173
7ed88a534bb6 more uniform types vs. consts;
wenzelm
parents: 68172
diff changeset
   109
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   110
    (* consts *)
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   111
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   112
    val encode_const =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   113
      let open XML.Encode Term_XML.Encode
68725
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
   114
      in triple (list string) typ (option (term o named_bounds)) end;
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
   115
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   116
    fun export_const c (T, abbrev) =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   117
      let
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   118
        val T' = T |> Logic.unvarifyT_global |> Type.strip_sorts;
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   119
        val abbrev' = abbrev |> Option.map (Logic.unvarify_global #> map_types Type.strip_sorts);
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   120
        val args = map (#1 o dest_TFree) (Consts.typargs (Sign.consts_of thy) (c, T'));
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   121
      in SOME (encode_const (args, T', abbrev')) end;
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
   122
68201
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   123
    val _ =
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   124
      export_entities "consts" export_const Sign.const_space
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   125
        (#constants (Consts.dest (Sign.consts_of thy)));
dee993b88a7b misc tuning and clarification;
wenzelm
parents: 68199
diff changeset
   126
68208
d9f2cf4fc002 more exports;
wenzelm
parents: 68206
diff changeset
   127
68232
4b93573ac5b4 export facts;
wenzelm
parents: 68231
diff changeset
   128
    (* axioms and facts *)
68208
d9f2cf4fc002 more exports;
wenzelm
parents: 68206
diff changeset
   129
68727
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   130
    fun standard_prop_of raw_thm =
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   131
      let
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   132
        val thm = raw_thm
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   133
          |> Thm.transfer thy
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   134
          |> Thm.check_hyps (Context.Theory thy)
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   135
          |> Thm.strip_shyps;
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   136
        val prop = thm
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   137
          |> Thm.full_prop_of
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   138
          |> Term_Subst.zero_var_indexes;
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   139
      in (Thm.extra_shyps thm, prop) end;
68539
6740e3611a86 disallow hyps in export;
wenzelm
parents: 68295
diff changeset
   140
68727
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   141
    fun encode_prop (Ss, prop) =
68208
d9f2cf4fc002 more exports;
wenzelm
parents: 68206
diff changeset
   142
      let
68726
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   143
        val prop' = Logic.unvarify_global (named_bounds prop);
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   144
        val typargs = rev (Term.add_tfrees prop' []);
68727
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   145
        val sorts = Name.invent (Name.make_context (map #1 typargs)) Name.aT (length Ss) ~~ Ss;
68726
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   146
        val args = rev (Term.add_frees prop' []);
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   147
      in
68727
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   148
        (sorts @ typargs, args, prop') |>
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   149
          let open XML.Encode Term_XML.Encode
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   150
          in triple (list (pair string sort)) (list (pair string typ)) term end
68726
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   151
      end;
68208
d9f2cf4fc002 more exports;
wenzelm
parents: 68206
diff changeset
   152
68726
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   153
    val encode_fact = XML.Encode.list encode_prop o map standard_prop_of;
68208
d9f2cf4fc002 more exports;
wenzelm
parents: 68206
diff changeset
   154
68232
4b93573ac5b4 export facts;
wenzelm
parents: 68231
diff changeset
   155
    val _ =
68727
ec0b2833cfc4 export shyps as regular typargs;
wenzelm
parents: 68726
diff changeset
   156
      export_entities "axioms" (fn _ => fn t => SOME (encode_prop ([], t))) Theory.axiom_space
68235
a3bd410db5b2 standardize implicit variables: non-zero indexes do occur occasionally, e.g. via RS;
wenzelm
parents: 68232
diff changeset
   157
        (Theory.axioms_of thy);
a3bd410db5b2 standardize implicit variables: non-zero indexes do occur occasionally, e.g. via RS;
wenzelm
parents: 68232
diff changeset
   158
    val _ =
68726
782d6b89fb19 more uniform facts: single vs. multi;
wenzelm
parents: 68725
diff changeset
   159
      export_entities "facts" (K (SOME o encode_fact)) (Facts.space_of o Global_Theory.facts_of)
68232
4b93573ac5b4 export facts;
wenzelm
parents: 68231
diff changeset
   160
        (Facts.dest_static true [] (Global_Theory.facts_of thy));
4b93573ac5b4 export facts;
wenzelm
parents: 68231
diff changeset
   161
68264
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   162
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   163
    (* type classes *)
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   164
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   165
    val encode_class =
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   166
      let open XML.Encode Term_XML.Encode
68725
367e60d9aa1b explicit names for bound variables;
wenzelm
parents: 68724
diff changeset
   167
      in pair (list (pair string typ)) (list (term o named_bounds)) end;
68264
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   168
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   169
    fun export_class name =
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   170
      (case try (Axclass.get_info thy) name of
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   171
        NONE => ([], [])
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   172
      | SOME {params, axioms, ...} =>
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   173
          (params, map (Logic.unvarify_global o Thm.full_prop_of) axioms))
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   174
      |> encode_class |> SOME;
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   175
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   176
    val _ =
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   177
      export_entities "classes" (fn name => fn () => export_class name)
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   178
        Sign.class_space (map (rpair ()) (Graph.keys (Sorts.classes_of (#2 (#classes rep_tsig)))));
bb9a3be6952a more exports;
wenzelm
parents: 68235
diff changeset
   179
68295
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   180
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   181
    (* sort algebra *)
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   182
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   183
    val {classrel, arities} =
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   184
      Sorts.dest_algebra (map (#2 o #classes o Type.rep_tsig o Sign.tsig_of) parents)
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   185
        (#2 (#classes rep_tsig));
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   186
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   187
    val encode_classrel =
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   188
      let open XML.Encode
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   189
      in list (pair string (list string)) end;
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   190
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   191
    val encode_arities =
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   192
      let open XML.Encode Term_XML.Encode
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   193
      in list (triple string (list sort) string) end;
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   194
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   195
    val _ = if null classrel then () else export_body thy "classrel" (encode_classrel classrel);
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   196
    val _ = if null arities then () else export_body thy "arities" (encode_arities arities);
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   197
781a98696638 export sort algebra;
wenzelm
parents: 68264
diff changeset
   198
  in () end);
68165
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
   199
a7a2174ac014 more exports;
wenzelm
parents: 68154
diff changeset
   200
end;