48 | unstar t = t |
48 | unstar t = t |
49 in |
49 in |
50 unstar term |
50 unstar term |
51 end |
51 end |
52 |
52 |
|
53 local exception MATCH |
|
54 in |
|
55 fun transfer_star_tac ctxt = |
|
56 let |
|
57 fun thm_of (Const (@{const_name Ifun}, _) $ t $ u) = @{thm transfer_Ifun} OF [thm_of t, thm_of u] |
|
58 | thm_of (Const (@{const_name star_of}, _) $ _) = @{thm star_of_def} |
|
59 | thm_of (Const (@{const_name star_n}, _) $ _) = @{thm Pure.reflexive} |
|
60 | thm_of _ = raise MATCH; |
|
61 |
|
62 fun thm_of_goal (Const (@{const_name Pure.eq}, _) $ t $ (Const (@{const_name star_n}, _) $ _)) = |
|
63 thm_of t |
|
64 | thm_of_goal _ = raise MATCH; |
|
65 in |
|
66 SUBGOAL (fn (t, i) => |
|
67 resolve_tac ctxt [thm_of_goal (strip_all_body t |> Logic.strip_imp_concl)] i |
|
68 handle MATCH => no_tac) |
|
69 end; |
|
70 end; |
|
71 |
53 fun transfer_thm_of ctxt ths t = |
72 fun transfer_thm_of ctxt ths t = |
54 let |
73 let |
55 val {intros,unfolds,refolds,consts} = TransferData.get (Context.Proof ctxt); |
74 val {intros,unfolds,refolds,consts} = TransferData.get (Context.Proof ctxt); |
56 val meta = Local_Defs.meta_rewrite_rule ctxt; |
75 val meta = Local_Defs.meta_rewrite_rule ctxt; |
57 val ths' = map meta ths; |
76 val ths' = map meta ths; |
58 val unfolds' = map meta unfolds and refolds' = map meta refolds; |
77 val unfolds' = map meta unfolds and refolds' = map meta refolds; |
59 val (_$_$t') = Thm.concl_of (Raw_Simplifier.rewrite ctxt true unfolds' (Thm.cterm_of ctxt t)) |
78 val (_$_$t') = Thm.concl_of (Raw_Simplifier.rewrite ctxt true unfolds' (Thm.cterm_of ctxt t)) |
60 val u = unstar_term consts t' |
79 val u = unstar_term consts t' |
61 val tac = |
80 val tac = |
62 rewrite_goals_tac ctxt (ths' @ refolds' @ unfolds') THEN |
81 rewrite_goals_tac ctxt (ths' @ refolds' @ unfolds') THEN |
63 ALLGOALS (Object_Logic.full_atomize_tac ctxt) THEN |
82 ALLGOALS (Object_Logic.full_atomize_tac ctxt) THEN |
64 match_tac ctxt [transitive_thm] 1 THEN |
83 match_tac ctxt [transitive_thm] 1 THEN |
65 resolve_tac ctxt [@{thm transfer_start}] 1 THEN |
84 resolve_tac ctxt [@{thm transfer_start}] 1 THEN |
66 REPEAT_ALL_NEW (resolve_tac ctxt intros) 1 THEN |
85 REPEAT_ALL_NEW (resolve_tac ctxt intros ORELSE' transfer_star_tac ctxt) 1 THEN |
67 match_tac ctxt [reflexive_thm] 1 |
86 match_tac ctxt [reflexive_thm] 1 |
68 in Goal.prove ctxt [] [] (Logic.mk_equals (t,u)) (K tac) end |
87 in Goal.prove ctxt [] [] (Logic.mk_equals (t,u)) (K tac) end |
69 |
88 |
70 fun transfer_tac ctxt ths = |
89 fun transfer_tac ctxt ths = |
71 SUBGOAL (fn (t, _) => |
90 SUBGOAL (fn (t, _) => |