790 fact_tac (Facts.could_unify (facts_of ctxt) (Term.strip_all_body goal)) i); |
790 fact_tac (Facts.could_unify (facts_of ctxt) (Term.strip_all_body goal)) i); |
791 |
791 |
792 |
792 |
793 (* get_thm(s) *) |
793 (* get_thm(s) *) |
794 |
794 |
|
795 local |
|
796 |
795 fun retrieve_thms _ pick ctxt (Facts.Fact s) = |
797 fun retrieve_thms _ pick ctxt (Facts.Fact s) = |
796 let |
798 let |
797 val prop = Syntax.read_prop (set_mode mode_default ctxt) s |
799 val prop = Syntax.read_prop (set_mode mode_default ctxt) s |
798 |> singleton (Variable.polymorphic ctxt); |
800 |> singleton (Variable.polymorphic ctxt); |
799 val th = Goal.prove ctxt [] [] prop (K (ALLGOALS (some_fact_tac ctxt))) |
801 val th = Goal.prove ctxt [] [] prop (K (ALLGOALS (some_fact_tac ctxt))) |
812 (case Facts.lookup local_facts name of |
814 (case Facts.lookup local_facts name of |
813 SOME ths => map (Thm.transfer thy) (Facts.select thmref ths) |
815 SOME ths => map (Thm.transfer thy) (Facts.select thmref ths) |
814 | NONE => from_thy thy xthmref); |
816 | NONE => from_thy thy xthmref); |
815 in pick name thms end; |
817 in pick name thms end; |
816 |
818 |
817 val get_fact_silent = retrieve_thms PureThy.get_fact_silent (K I); |
819 in |
818 |
820 |
819 val get_fact = retrieve_thms PureThy.get_fact (K I); |
821 val get_fact = retrieve_thms PureThy.get_fact (K I); |
820 val get_fact_single = retrieve_thms PureThy.get_fact Facts.the_single; |
822 val get_fact_single = retrieve_thms PureThy.get_fact Facts.the_single; |
821 |
823 |
822 fun get_thms ctxt name = get_fact ctxt (Facts.Named (name, NONE)); |
824 fun get_thms_silent ctxt = retrieve_thms PureThy.get_fact_silent (K I) ctxt o Facts.named; |
823 fun get_thm ctxt name = get_fact_single ctxt (Facts.Named (name, NONE)); |
825 fun get_thms ctxt = get_fact ctxt o Facts.named; |
|
826 fun get_thm ctxt = get_fact_single ctxt o Facts.named; |
|
827 |
|
828 end; |
824 |
829 |
825 |
830 |
826 (* valid_thms *) |
831 (* valid_thms *) |
827 |
832 |
828 fun valid_thms ctxt (name, ths) = |
833 fun valid_thms ctxt (name, ths) = |
829 (case try (fn () => get_fact_silent ctxt (Facts.Named (name, NONE))) () of |
834 (case try (fn () => get_thms_silent ctxt name) () of |
830 NONE => false |
835 NONE => false |
831 | SOME ths' => Thm.eq_thms (ths, ths')); |
836 | SOME ths' => Thm.eq_thms (ths, ths')); |
832 |
837 |
833 |
838 |
834 (* name space operations *) |
839 (* name space operations *) |