equal
deleted
inserted
replaced
1058 - If S is a more-selector we have to make sure that the update on component |
1058 - If S is a more-selector we have to make sure that the update on component |
1059 X does not affect the selected subrecord. |
1059 X does not affect the selected subrecord. |
1060 - If X is a more-selector we have to make sure that S is not in the updated |
1060 - If X is a more-selector we have to make sure that S is not in the updated |
1061 subrecord. |
1061 subrecord. |
1062 *) |
1062 *) |
1063 val _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>select_update\<close> |
1063 val _ = Named_Target.global_setup (Simplifier.define_simproc \<^binding>\<open>select_update\<close> |
1064 {lhss = [\<^term>\<open>x::'a::{}\<close>], |
1064 {lhss = [\<^term>\<open>x::'a::{}\<close>], |
1065 passive = false, |
1065 passive = false, |
1066 proc = fn _ => fn ctxt => fn ct => |
1066 proc = fn _ => fn ctxt => fn ct => |
1067 let |
1067 let |
1068 val thy = Proof_Context.theory_of ctxt; |
1068 val thy = Proof_Context.theory_of ctxt; |
1113 (Logic.list_all (vars, Logic.mk_equals (sel $ trm, trm')))) |
1113 (Logic.list_all (vars, Logic.mk_equals (sel $ trm, trm')))) |
1114 | NONE => NONE) |
1114 | NONE => NONE) |
1115 end |
1115 end |
1116 else NONE |
1116 else NONE |
1117 | _ => NONE) |
1117 | _ => NONE) |
1118 end})); |
1118 end}); |
1119 |
1119 |
1120 val simproc = |
1120 val simproc = |
1121 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("select_update", Position.none)); |
1121 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("select_update", Position.none)); |
1122 |
1122 |
1123 fun get_upd_acc_cong_thm upd acc thy ss = |
1123 fun get_upd_acc_cong_thm upd acc thy ss = |
1163 (2) "r(|M:= M r|) = r" |
1163 (2) "r(|M:= M r|) = r" |
1164 |
1164 |
1165 In both cases "more" updates complicate matters: for this reason |
1165 In both cases "more" updates complicate matters: for this reason |
1166 we omit considering further updates if doing so would introduce |
1166 we omit considering further updates if doing so would introduce |
1167 both a more update and an update to a field within it.*) |
1167 both a more update and an update to a field within it.*) |
1168 val _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>update\<close> |
1168 val _ = Named_Target.global_setup (Simplifier.define_simproc \<^binding>\<open>update\<close> |
1169 {lhss = [\<^term>\<open>x::'a::{}\<close>], |
1169 {lhss = [\<^term>\<open>x::'a::{}\<close>], |
1170 passive = false, |
1170 passive = false, |
1171 proc = fn _ => fn ctxt => fn ct => |
1171 proc = fn _ => fn ctxt => fn ct => |
1172 let |
1172 let |
1173 val thy = Proof_Context.theory_of ctxt; |
1173 val thy = Proof_Context.theory_of ctxt; |
1281 if simp orelse commuted then |
1281 if simp orelse commuted then |
1282 SOME |
1282 SOME |
1283 (prove_unfold_defs thy upd_funs noops' [simproc] |
1283 (prove_unfold_defs thy upd_funs noops' [simproc] |
1284 (Logic.list_all (vars, Logic.mk_equals (lhs, rhs)))) |
1284 (Logic.list_all (vars, Logic.mk_equals (lhs, rhs)))) |
1285 else NONE |
1285 else NONE |
1286 end})); |
1286 end}); |
1287 |
1287 |
1288 val upd_simproc = |
1288 val upd_simproc = |
1289 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("update", Position.none)); |
1289 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("update", Position.none)); |
1290 |
1290 |
1291 end; |
1291 end; |
1304 |
1304 |
1305 eq_simproc split_simp_tac |
1305 eq_simproc split_simp_tac |
1306 Complexity: #components * #updates #updates |
1306 Complexity: #components * #updates #updates |
1307 *) |
1307 *) |
1308 |
1308 |
1309 val _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>eq\<close> |
1309 val _ = Named_Target.global_setup (Simplifier.define_simproc \<^binding>\<open>eq\<close> |
1310 {lhss = [\<^term>\<open>r = s\<close>], |
1310 {lhss = [\<^term>\<open>r = s\<close>], |
1311 passive = false, |
1311 passive = false, |
1312 proc = fn _ => fn ctxt => fn ct => |
1312 proc = fn _ => fn ctxt => fn ct => |
1313 (case Thm.term_of ct of |
1313 (case Thm.term_of ct of |
1314 \<^Const_>\<open>HOL.eq T for _ _\<close> => |
1314 \<^Const_>\<open>HOL.eq T for _ _\<close> => |
1316 "" => NONE |
1316 "" => NONE |
1317 | name => |
1317 | name => |
1318 (case get_equalities (Proof_Context.theory_of ctxt) name of |
1318 (case get_equalities (Proof_Context.theory_of ctxt) name of |
1319 NONE => NONE |
1319 NONE => NONE |
1320 | SOME thm => SOME (thm RS @{thm Eq_TrueI}))) |
1320 | SOME thm => SOME (thm RS @{thm Eq_TrueI}))) |
1321 | _ => NONE)})); |
1321 | _ => NONE)}); |
1322 |
1322 |
1323 val eq_simproc = |
1323 val eq_simproc = |
1324 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("eq", Position.none)); |
1324 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("eq", Position.none)); |
1325 |
1325 |
1326 |
1326 |
1358 else NONE |
1358 else NONE |
1359 end) |
1359 end) |
1360 else NONE |
1360 else NONE |
1361 | _ => NONE)}; |
1361 | _ => NONE)}; |
1362 |
1362 |
1363 val _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>ex_sel_eq\<close> |
1363 val _ = Named_Target.global_setup (Simplifier.define_simproc \<^binding>\<open>ex_sel_eq\<close> |
1364 {lhss = [\<^term>\<open>Ex t\<close>], |
1364 {lhss = [\<^term>\<open>Ex t\<close>], |
1365 passive = false, |
1365 passive = false, |
1366 proc = fn _ => fn ctxt => fn ct => |
1366 proc = fn _ => fn ctxt => fn ct => |
1367 let |
1367 let |
1368 val thy = Proof_Context.theory_of ctxt; |
1368 val thy = Proof_Context.theory_of ctxt; |
1397 (fn {context = ctxt', ...} => |
1397 (fn {context = ctxt', ...} => |
1398 simp_tac (put_simpset (get_simpset thy) ctxt' |
1398 simp_tac (put_simpset (get_simpset thy) ctxt' |
1399 addsimps @{thms simp_thms} addsimprocs [split_simproc (K ~1)]) 1)) |
1399 addsimps @{thms simp_thms} addsimprocs [split_simproc (K ~1)]) 1)) |
1400 end handle TERM _ => NONE) |
1400 end handle TERM _ => NONE) |
1401 | _ => NONE) |
1401 | _ => NONE) |
1402 end})); |
1402 end}); |
1403 |
1403 |
1404 val ex_sel_eq_simproc = |
1404 val ex_sel_eq_simproc = |
1405 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("ex_sel_eq", Position.none)); |
1405 #2 (Simplifier.check_simproc (Context.the_local_context ()) ("ex_sel_eq", Position.none)); |
1406 |
1406 |
1407 val _ = Theory.setup (map_theory_simpset (fn ctxt => ctxt delsimprocs [ex_sel_eq_simproc])); |
1407 val _ = Theory.setup (map_theory_simpset (fn ctxt => ctxt delsimprocs [ex_sel_eq_simproc])); |