equal
deleted
inserted
replaced
99 |
99 |
100 local |
100 local |
101 |
101 |
102 fun name_of (Const (n, T)) = n |
102 fun name_of (Const (n, T)) = n |
103 | name_of (Free (n, T)) = n |
103 | name_of (Free (n, T)) = n |
104 | name_of _ = fixrec_err "name_of" |
104 | name_of t = raise TERM ("Fixrec.add_unfold: lhs not a constant", [t]); |
105 |
105 |
106 val lhs_name = |
106 val lhs_name = |
107 name_of o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of; |
107 name_of o head_of o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of; |
108 |
108 |
109 in |
109 in |
110 |
110 |
111 val add_unfold : attribute = |
111 val add_unfold : attribute = |
112 Thm.declaration_attribute |
112 Thm.declaration_attribute |
309 fun concl t = |
309 fun concl t = |
310 if Logic.is_all t then concl (snd (Logic.dest_all t)) |
310 if Logic.is_all t then concl (snd (Logic.dest_all t)) |
311 else HOLogic.dest_Trueprop (Logic.strip_imp_concl t); |
311 else HOLogic.dest_Trueprop (Logic.strip_imp_concl t); |
312 fun tac (t, i) = |
312 fun tac (t, i) = |
313 let |
313 let |
314 val Const (c, T) = chead_of (fst (HOLogic.dest_eq (concl t))); |
314 val Const (c, T) = head_of (chead_of (fst (HOLogic.dest_eq (concl t)))); |
315 val unfold_thm = the (Symtab.lookup tab c); |
315 val unfold_thm = the (Symtab.lookup tab c); |
316 val rule = unfold_thm RS @{thm ssubst_lhs}; |
316 val rule = unfold_thm RS @{thm ssubst_lhs}; |
317 in |
317 in |
318 CHANGED (rtac rule i THEN asm_simp_tac ss i) |
318 CHANGED (rtac rule i THEN asm_simp_tac ss i) |
319 end |
319 end |