src/HOL/Eisbach/Tests.thy
changeset 62070 b13b98a4d5f8
parent 61912 ad710de5c576
child 62075 ea3360245939
equal deleted inserted replaced
62069:28acb93a745f 62070:b13b98a4d5f8
   476   apply (add_my_thms rule_my_thms f:A)
   476   apply (add_my_thms rule_my_thms f:A)
   477   apply (add_my_thms rule_my_thms' f:A)
   477   apply (add_my_thms rule_my_thms' f:A)
   478   apply (add_my_thms \<open>rule my_thms_named\<close> f:A)
   478   apply (add_my_thms \<open>rule my_thms_named\<close> f:A)
   479   done
   479   done
   480 
   480 
       
   481 
   481 subsection \<open>Shallow parser tests\<close>
   482 subsection \<open>Shallow parser tests\<close>
   482 
   483 
   483 method all_args for A B methods m1 m2 uses f1 f2 declares my_thms_named = fail
   484 method all_args for A B methods m1 m2 uses f1 f2 declares my_thms_named = fail
   484 
   485 
   485 lemma True
   486 lemma True
   486   by (all_args True False - fail f1: TrueI f2: TrueI my_thms_named: TrueI | rule TrueI)
   487   by (all_args True False - fail f1: TrueI f2: TrueI my_thms_named: TrueI | rule TrueI)
   487 
   488 
       
   489 
   488 subsection \<open>Method name internalization test\<close>
   490 subsection \<open>Method name internalization test\<close>
   489 
   491 
   490 
   492 
   491 method test2 = (simp)
   493 method test2 = (simp)
   492 
   494 
   493 method simp = fail
   495 method simp = fail
   494 
   496 
   495 lemma "A \<Longrightarrow> A" by test2
   497 lemma "A \<Longrightarrow> A" by test2
   496 
   498 
       
   499 
       
   500 subsection \<open>Eisbach method invocation from ML\<close>
       
   501 
       
   502 method test_method for x y uses r = (print_term x, print_term y, rule r)
       
   503 
       
   504 method_setup test_method' = \<open>
       
   505   Args.term -- Args.term --
       
   506   (Scan.lift (Args.$$$ "rule" -- Args.colon) |-- Attrib.thms) >>
       
   507     (fn ((x, y), r) => fn ctxt =>
       
   508       Method_Closure.apply_method ctxt "Tests.test_method" [x, y] [r] [] ctxt);
       
   509 \<close>
       
   510 
       
   511 lemma
       
   512   fixes a b :: nat
       
   513   assumes "a = b"
       
   514   shows "b = a"
       
   515   apply (test_method a b)?
       
   516   apply (test_method' a b rule: refl)?
       
   517   apply (test_method' a b rule: assms [symmetric])?
       
   518   done
       
   519 
   497 end
   520 end