src/Pure/pure_thy.ML
changeset 18678 dd0c569fa43d
parent 18666 f37a43cec547
child 18713 cf777b9788b5
equal deleted inserted replaced
18677:01265301db7f 18678:dd0c569fa43d
   174   NameSelection of string * interval list |
   174   NameSelection of string * interval list |
   175   Fact of string;
   175   Fact of string;
   176 
   176 
   177 fun name_of_thmref (Name name) = name
   177 fun name_of_thmref (Name name) = name
   178   | name_of_thmref (NameSelection (name, _)) = name
   178   | name_of_thmref (NameSelection (name, _)) = name
   179   | name_of_thmref (Fact _) = raise ERROR_MESSAGE "Illegal literal fact";
   179   | name_of_thmref (Fact _) = error "Illegal literal fact";
   180 
   180 
   181 fun map_name_of_thmref f (Name name) = Name (f name)
   181 fun map_name_of_thmref f (Name name) = Name (f name)
   182   | map_name_of_thmref f (NameSelection (name, is)) = NameSelection (f name, is)
   182   | map_name_of_thmref f (NameSelection (name, is)) = NameSelection (f name, is)
   183   | map_name_of_thmref _ thmref = thmref;
   183   | map_name_of_thmref _ thmref = thmref;
   184 
   184 
   185 fun string_of_thmref (Name name) = name
   185 fun string_of_thmref (Name name) = name
   186   | string_of_thmref (NameSelection (name, is)) =
   186   | string_of_thmref (NameSelection (name, is)) =
   187       name ^ enclose "(" ")" (commas (map string_of_interval is))
   187       name ^ enclose "(" ")" (commas (map string_of_interval is))
   188   | string_of_thmref (Fact _) = raise ERROR_MESSAGE "Illegal literal fact";
   188   | string_of_thmref (Fact _) = error "Illegal literal fact";
   189 
   189 
   190 
   190 
   191 (* select_thm *)
   191 (* select_thm *)
   192 
   192 
   193 fun select_thm (Name _) thms = thms
   193 fun select_thm (Name _) thms = thms
   252 
   252 
   253 
   253 
   254 (* thms_containing etc. *)
   254 (* thms_containing etc. *)
   255 
   255 
   256 fun valid_thms thy (thmref, ths) =
   256 fun valid_thms thy (thmref, ths) =
   257   (case try (transform_error (get_thms thy)) thmref of
   257   (case try (get_thms thy) thmref of
   258     NONE => false
   258     NONE => false
   259   | SOME ths' => Thm.eq_thms (ths, ths'));
   259   | SOME ths' => Thm.eq_thms (ths, ths'));
   260 
   260 
   261 fun thms_containing theory spec =
   261 fun thms_containing theory spec =
   262   (theory :: Theory.ancestors_of theory)
   262   (theory :: Theory.ancestors_of theory)