src/Pure/Thy/thy_read.ML
changeset 1598 6f4d995590fd
parent 1589 fd6a571cb2b0
child 1602 699ad6611c1e
equal deleted inserted replaced
1597:54ece585bf62 1598:6f4d995590fd
  1071                              "</PRE><P>\n")
  1071                              "</PRE><P>\n")
  1072                )
  1072                )
  1073            | None => ()
  1073            | None => ()
  1074       end;
  1074       end;
  1075 
  1075 
  1076     (*Return version with trivial proof object; store original version *)
  1076     (*Label this theorem*)
  1077     val thm' = Thm.name_thm (the theory, name, thm) handle OPTION _ => thm
  1077     val thm' = Thm.name_thm (name, thm)
  1078   in
  1078   in
  1079     loaded_thys := Symtab.update
  1079     loaded_thys := Symtab.update
  1080      ((thy_name, ThyInfo {path = path, children = children, parents = parents,
  1080      ((thy_name, ThyInfo {path = path, children = children, parents = parents,
  1081                           thy_time = thy_time, ml_time = ml_time,
  1081                           thy_time = thy_time, ml_time = ml_time,
  1082                           theory = theory, thms = thms',
  1082                           theory = theory, thms = thms',
  1116 
  1116 
  1117 fun thmtab_of_name name =
  1117 fun thmtab_of_name name =
  1118   let val ThyInfo {thms, ...} = the (get_thyinfo name);
  1118   let val ThyInfo {thms, ...} = the (get_thyinfo name);
  1119   in thms end;
  1119   in thms end;
  1120 
  1120 
  1121 (*Get a stored theorem specified by theory and name.
  1121 (*Get a stored theorem specified by theory and name. *)
  1122   Derivation has the form Theorem(thy,name). *)
       
  1123 fun get_thm thy name =
  1122 fun get_thm thy name =
  1124   let fun get [] [] searched =
  1123   let fun get [] [] searched =
  1125            raise THEORY ("get_thm: no theorem " ^ quote name, [thy])
  1124            raise THEORY ("get_thm: no theorem " ^ quote name, [thy])
  1126         | get [] ng searched =
  1125         | get [] ng searched =
  1127             get (ng \\ searched) [] searched
  1126             get (ng \\ searched) [] searched
  1128         | get (t::ts) ng searched =
  1127         | get (t::ts) ng searched =
  1129             (case Symtab.lookup (thmtab_of_name t, name) of
  1128             (case Symtab.lookup (thmtab_of_name t, name) of
  1130                  Some thm => Thm.name_thm(thy,name,thm)
  1129                  Some thm => thm
  1131                | None => get ts (ng union (parents_of_name t)) (t::searched));
  1130                | None => get ts (ng union (parents_of_name t)) (t::searched));
  1132 
  1131 
  1133       val (tname, _) = thyinfo_of_sign (sign_of thy);
  1132       val (tname, _) = thyinfo_of_sign (sign_of thy);
  1134   in get [tname] [] [] end;
  1133   in get [tname] [] [] end;
  1135 
  1134 
  1301       Pretty.quote (pretty_thm th)];
  1300       Pretty.quote (pretty_thm th)];
  1302   in
  1301   in
  1303     Pretty.writeln (Pretty.big_list "stored theorems:" (map prt_thm thms))
  1302     Pretty.writeln (Pretty.big_list "stored theorems:" (map prt_thm thms))
  1304   end;
  1303   end;
  1305 
  1304 
  1306 fun print_theory thy = (Drule.print_theory thy; print_thms thy);
  1305 fun print_theory thy = (Display.print_theory thy; print_thms thy);
  1307 
  1306 
  1308 
  1307 
  1309 (*** Misc functions ***)
  1308 (*** Misc functions ***)
  1310 
  1309 
  1311 (*Add data handling methods to theory*)
  1310 (*Add data handling methods to theory*)