src/HOL/Tools/record.ML
changeset 78792 103467dc5117
parent 78115 f360ee6ce670
child 78795 f7e972d567f3
equal deleted inserted replaced
78791:4f7dce5c1a81 78792:103467dc5117
  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  _ = Theory.setup (Named_Target.theory_map (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     proc = fn _ => fn ctxt => fn ct =>
  1066     proc = fn _ => fn ctxt => fn ct =>
  1066       let
  1067       let
  1067         val thy = Proof_Context.theory_of ctxt;
  1068         val thy = Proof_Context.theory_of ctxt;
  1068         val t = Thm.term_of ct;
  1069         val t = Thm.term_of ct;
  1069       in
  1070       in
  1164   In both cases "more" updates complicate matters: for this reason
  1165   In both cases "more" updates complicate matters: for this reason
  1165   we omit considering further updates if doing so would introduce
  1166   we omit considering further updates if doing so would introduce
  1166   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.*)
  1167 val  _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>update\<close>
  1168 val  _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>update\<close>
  1168    {lhss = [\<^term>\<open>x::'a::{}\<close>],
  1169    {lhss = [\<^term>\<open>x::'a::{}\<close>],
       
  1170     passive = false,
  1169     proc = fn _ => fn ctxt => fn ct =>
  1171     proc = fn _ => fn ctxt => fn ct =>
  1170       let
  1172       let
  1171         val thy = Proof_Context.theory_of ctxt;
  1173         val thy = Proof_Context.theory_of ctxt;
  1172         val t = Thm.term_of ct;
  1174         val t = Thm.term_of ct;
  1173         (*We can use more-updators with other updators as long
  1175         (*We can use more-updators with other updators as long
  1304  Complexity: #components * #updates     #updates
  1306  Complexity: #components * #updates     #updates
  1305 *)
  1307 *)
  1306 
  1308 
  1307 val  _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>eq\<close>
  1309 val  _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>eq\<close>
  1308    {lhss = [\<^term>\<open>r = s\<close>],
  1310    {lhss = [\<^term>\<open>r = s\<close>],
       
  1311     passive = false,
  1309     proc = fn _ => fn ctxt => fn ct =>
  1312     proc = fn _ => fn ctxt => fn ct =>
  1310       (case Thm.term_of ct of
  1313       (case Thm.term_of ct of
  1311         \<^Const_>\<open>HOL.eq T for _ _\<close> =>
  1314         \<^Const_>\<open>HOL.eq T for _ _\<close> =>
  1312           (case rec_id ~1 T of
  1315           (case rec_id ~1 T of
  1313             "" => NONE
  1316             "" => NONE
  1357           else NONE
  1360           else NONE
  1358       | _ => NONE)};
  1361       | _ => NONE)};
  1359 
  1362 
  1360 val  _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>ex_sel_eq\<close>
  1363 val  _ = Theory.setup (Named_Target.theory_map (Simplifier.define_simproc \<^binding>\<open>ex_sel_eq\<close>
  1361    {lhss = [\<^term>\<open>Ex t\<close>],
  1364    {lhss = [\<^term>\<open>Ex t\<close>],
       
  1365     passive = false,
  1362     proc = fn _ => fn ctxt => fn ct =>
  1366     proc = fn _ => fn ctxt => fn ct =>
  1363       let
  1367       let
  1364         val thy = Proof_Context.theory_of ctxt;
  1368         val thy = Proof_Context.theory_of ctxt;
  1365         val t = Thm.term_of ct;
  1369         val t = Thm.term_of ct;
  1366         fun mkeq (lr, T, (sel, Tsel), x) i =
  1370         fun mkeq (lr, T, (sel, Tsel), x) i =