src/Pure/Thy/export_theory.scala
changeset 73866 66bff50bc5f1
parent 73359 d8a0e996614b
child 74114 700e5bd59c7d
equal deleted inserted replaced
73865:4e94ceabaaad 73866:66bff50bc5f1
    92       locales.iterator.map(_.entity) ++
    92       locales.iterator.map(_.entity) ++
    93       locale_dependencies.iterator.map(_.entity)
    93       locale_dependencies.iterator.map(_.entity)
    94 
    94 
    95     def cache(cache: Term.Cache): Theory =
    95     def cache(cache: Term.Cache): Theory =
    96       Theory(cache.string(name),
    96       Theory(cache.string(name),
    97         parents.map(cache.string(_)),
    97         parents.map(cache.string),
    98         types.map(_.cache(cache)),
    98         types.map(_.cache(cache)),
    99         consts.map(_.cache(cache)),
    99         consts.map(_.cache(cache)),
   100         axioms.map(_.cache(cache)),
   100         axioms.map(_.cache(cache)),
   101         thms.map(_.cache(cache)),
   101         thms.map(_.cache(cache)),
   102         classes.map(_.cache(cache)),
   102         classes.map(_.cache(cache)),
   234     entity: Entity, syntax: Syntax, args: List[String], abbrev: Option[Term.Typ])
   234     entity: Entity, syntax: Syntax, args: List[String], abbrev: Option[Term.Typ])
   235   {
   235   {
   236     def cache(cache: Term.Cache): Type =
   236     def cache(cache: Term.Cache): Type =
   237       Type(entity.cache(cache),
   237       Type(entity.cache(cache),
   238         syntax,
   238         syntax,
   239         args.map(cache.string(_)),
   239         args.map(cache.string),
   240         abbrev.map(cache.typ(_)))
   240         abbrev.map(cache.typ))
   241   }
   241   }
   242 
   242 
   243   def read_types(provider: Export.Provider): List[Type] =
   243   def read_types(provider: Export.Provider): List[Type] =
   244     provider.uncompressed_yxml(Export.THEORY_PREFIX + "types").map((tree: XML.Tree) =>
   244     provider.uncompressed_yxml(Export.THEORY_PREFIX + "types").map((tree: XML.Tree) =>
   245       {
   245       {
   264     propositional: Boolean)
   264     propositional: Boolean)
   265   {
   265   {
   266     def cache(cache: Term.Cache): Const =
   266     def cache(cache: Term.Cache): Const =
   267       Const(entity.cache(cache),
   267       Const(entity.cache(cache),
   268         syntax,
   268         syntax,
   269         typargs.map(cache.string(_)),
   269         typargs.map(cache.string),
   270         cache.typ(typ),
   270         cache.typ(typ),
   271         abbrev.map(cache.term(_)),
   271         abbrev.map(cache.term),
   272         propositional)
   272         propositional)
   273   }
   273   }
   274 
   274 
   275   def read_consts(provider: Export.Provider): List[Const] =
   275   def read_consts(provider: Export.Provider): List[Const] =
   276     provider.uncompressed_yxml(Export.THEORY_PREFIX + "consts").map((tree: XML.Tree) =>
   276     provider.uncompressed_yxml(Export.THEORY_PREFIX + "consts").map((tree: XML.Tree) =>
   343   {
   343   {
   344     def cache(cache: Term.Cache): Thm =
   344     def cache(cache: Term.Cache): Thm =
   345       Thm(
   345       Thm(
   346         entity.cache(cache),
   346         entity.cache(cache),
   347         prop.cache(cache),
   347         prop.cache(cache),
   348         deps.map(cache.string _),
   348         deps.map(cache.string),
   349         cache.proof(proof))
   349         cache.proof(proof))
   350   }
   350   }
   351 
   351 
   352   def read_thms(provider: Export.Provider): List[Thm] =
   352   def read_thms(provider: Export.Provider): List[Thm] =
   353     provider.uncompressed_yxml(Export.THEORY_PREFIX + "thms").map((tree: XML.Tree) =>
   353     provider.uncompressed_yxml(Export.THEORY_PREFIX + "thms").map((tree: XML.Tree) =>
   556   }
   556   }
   557 
   557 
   558   sealed case class Arity(type_name: String, domain: List[Term.Sort], codomain: String, prop: Prop)
   558   sealed case class Arity(type_name: String, domain: List[Term.Sort], codomain: String, prop: Prop)
   559   {
   559   {
   560     def cache(cache: Term.Cache): Arity =
   560     def cache(cache: Term.Cache): Arity =
   561       Arity(cache.string(type_name), domain.map(cache.sort(_)), cache.string(codomain),
   561       Arity(cache.string(type_name), domain.map(cache.sort), cache.string(codomain),
   562         prop.cache(cache))
   562         prop.cache(cache))
   563   }
   563   }
   564 
   564 
   565   def read_arities(provider: Export.Provider): List[Arity] =
   565   def read_arities(provider: Export.Provider): List[Arity] =
   566   {
   566   {
   736         cache.string(name),
   736         cache.string(name),
   737         rough_classification.cache(cache),
   737         rough_classification.cache(cache),
   738         typargs.map({ case (name, sort) => (cache.string(name), cache.sort(sort)) }),
   738         typargs.map({ case (name, sort) => (cache.string(name), cache.sort(sort)) }),
   739         args.map({ case (name, typ) => (cache.string(name), cache.typ(typ)) }),
   739         args.map({ case (name, typ) => (cache.string(name), cache.typ(typ)) }),
   740         terms.map({ case (term, typ) => (cache.term(term), cache.typ(typ)) }),
   740         terms.map({ case (term, typ) => (cache.term(term), cache.typ(typ)) }),
   741         rules.map(cache.term(_)))
   741         rules.map(cache.term))
   742   }
   742   }
   743 
   743 
   744   def read_spec_rules(provider: Export.Provider): List[Spec_Rule] =
   744   def read_spec_rules(provider: Export.Provider): List[Spec_Rule] =
   745   {
   745   {
   746     val body = provider.uncompressed_yxml(Export.THEORY_PREFIX + "spec_rules")
   746     val body = provider.uncompressed_yxml(Export.THEORY_PREFIX + "spec_rules")