--- a/src/Pure/General/cache.scala Thu Aug 15 16:17:18 2019 +0200
+++ b/src/Pure/General/cache.scala Thu Aug 15 16:26:50 2019 +0200
@@ -37,9 +37,6 @@
x
}
- protected def cache_int(x: Int): Int =
- lookup(x) getOrElse store(x)
-
protected def cache_string(x: String): String =
{
if (x == "") ""
@@ -58,6 +55,5 @@
}
// main methods
- def int(x: Int): Int = synchronized { cache_int(x) }
def string(x: String): String = synchronized { cache_string(x) }
}
--- a/src/Pure/term.scala Thu Aug 15 16:17:18 2019 +0200
+++ b/src/Pure/term.scala Thu Aug 15 16:26:50 2019 +0200
@@ -13,7 +13,7 @@
{
/* types and terms */
- type Indexname = (String, Int)
+ sealed case class Indexname(name: String, index: Int)
type Sort = List[String]
val dummyS: Sort = List("")
@@ -100,7 +100,7 @@
extends isabelle.Cache(initial_size, max_string)
{
protected def cache_indexname(x: Indexname): Indexname =
- lookup(x) getOrElse store(cache_string(x._1), cache_int(x._2))
+ lookup(x) getOrElse store(Indexname(cache_string(x.name), x.index))
protected def cache_sort(x: Sort): Sort =
if (x == dummyS) dummyS
@@ -141,7 +141,7 @@
case Const(name, typ) => store(Const(cache_string(name), cache_typ(typ)))
case Free(name, typ) => store(Free(cache_string(name), cache_typ(typ)))
case Var(name, typ) => store(Var(cache_indexname(name), cache_typ(typ)))
- case Bound(index) => store(Bound(cache_int(index)))
+ case Bound(_) => store(x)
case Abs(name, typ, body) =>
store(Abs(cache_string(name), cache_typ(typ), cache_term(body)))
case App(fun, arg) => store(App(cache_term(fun), cache_term(arg)))
@@ -157,7 +157,7 @@
case Some(y) => y
case None =>
x match {
- case PBound(index) => store(PBound(cache_int(index)))
+ case PBound(_) => store(x)
case Abst(name, typ, body) =>
store(Abst(cache_string(name), cache_typ(typ), cache_proof(body)))
case AbsP(name, hyp, body) =>
--- a/src/Pure/term_xml.scala Thu Aug 15 16:17:18 2019 +0200
+++ b/src/Pure/term_xml.scala Thu Aug 15 16:26:50 2019 +0200
@@ -21,13 +21,13 @@
variant[Typ](List(
{ case Type(a, b) => (List(a), list(typ)(b)) },
{ case TFree(a, b) => (List(a), sort(b)) },
- { case TVar((a, b), c) => (List(a, int_atom(b)), sort(c)) }))
+ { case TVar(Indexname(a, b), c) => (List(a, int_atom(b)), sort(c)) }))
def term: T[Term] =
variant[Term](List(
{ case Const(a, b) => (List(a), typ(b)) },
{ case Free(a, b) => (List(a), typ(b)) },
- { case Var((a, b), c) => (List(a, int_atom(b)), typ(c)) },
+ { case Var(Indexname(a, b), c) => (List(a, int_atom(b)), typ(c)) },
{ case Bound(a) => (List(int_atom(a)), Nil) },
{ case Abs(a, b, c) => (List(a), pair(typ, term)(b, c)) },
{ case App(a, b) => (Nil, pair(term, term)(a, b)) }))
@@ -43,13 +43,13 @@
variant[Typ](List(
{ case (List(a), b) => Type(a, list(typ)(b)) },
{ case (List(a), b) => TFree(a, sort(b)) },
- { case (List(a, b), c) => TVar((a, int_atom(b)), sort(c)) }))
+ { case (List(a, b), c) => TVar(Indexname(a, int_atom(b)), sort(c)) }))
def term: T[Term] =
variant[Term](List(
{ case (List(a), b) => Const(a, typ(b)) },
{ case (List(a), b) => Free(a, typ(b)) },
- { case (List(a, b), c) => Var((a, int_atom(b)), typ(c)) },
+ { case (List(a, b), c) => Var(Indexname(a, int_atom(b)), typ(c)) },
{ case (List(a), Nil) => Bound(int_atom(a)) },
{ case (List(a), b) => val (c, d) = pair(typ, term)(b); Abs(a, c, d) },
{ case (Nil, a) => val (b, c) = pair(term, term)(a); App(b, c) }))