src/Pure/Isar/proof_context.ML
changeset 59058 a78612c67ec0
parent 58950 d07464875dd4
child 59064 a8bcb5a446c8
equal deleted inserted replaced
59057:5b649fb2f2e1 59058:a78612c67ec0
  1174 
  1174 
  1175 (** cases **)
  1175 (** cases **)
  1176 
  1176 
  1177 fun dest_cases ctxt =
  1177 fun dest_cases ctxt =
  1178   Name_Space.fold_table (fn (a, (c, i)) => cons (i, (a, c))) (cases_of ctxt) []
  1178   Name_Space.fold_table (fn (a, (c, i)) => cons (i, (a, c))) (cases_of ctxt) []
  1179   |> sort (int_ord o pairself #1) |> map #2;
  1179   |> sort (int_ord o apply2 #1) |> map #2;
  1180 
  1180 
  1181 local
  1181 local
  1182 
  1182 
  1183 fun update_case _ _ ("", _) res = res
  1183 fun update_case _ _ ("", _) res = res
  1184   | update_case _ _ (name, NONE) (cases, index) =
  1184   | update_case _ _ (name, NONE) (cases, index) =
  1253 
  1253 
  1254 fun pretty_abbrevs show_globals ctxt =
  1254 fun pretty_abbrevs show_globals ctxt =
  1255   let
  1255   let
  1256     val space = const_space ctxt;
  1256     val space = const_space ctxt;
  1257     val (constants, global_constants) =
  1257     val (constants, global_constants) =
  1258       pairself (#constants o Consts.dest) (#consts (rep_data ctxt));
  1258       apply2 (#constants o Consts.dest) (#consts (rep_data ctxt));
  1259     val globals = Symtab.make global_constants;
  1259     val globals = Symtab.make global_constants;
  1260     fun add_abbr (_, (_, NONE)) = I
  1260     fun add_abbr (_, (_, NONE)) = I
  1261       | add_abbr (c, (T, SOME t)) =
  1261       | add_abbr (c, (T, SOME t)) =
  1262           if not show_globals andalso Symtab.defined globals c then I
  1262           if not show_globals andalso Symtab.defined globals c then I
  1263           else cons (c, Logic.mk_equals (Const (c, T), t));
  1263           else cons (c, Logic.mk_equals (Const (c, T), t));