1340 Complexity: #components * #updates #updates |
1340 Complexity: #components * #updates #updates |
1341 *) |
1341 *) |
1342 val eq_simproc = |
1342 val eq_simproc = |
1343 Simplifier.simproc_global @{theory HOL} "record_eq_simp" ["r = s"] |
1343 Simplifier.simproc_global @{theory HOL} "record_eq_simp" ["r = s"] |
1344 (fn thy => fn _ => fn t => |
1344 (fn thy => fn _ => fn t => |
1345 (case t of Const (@{const_name "op ="}, Type (_, [T, _])) $ _ $ _ => |
1345 (case t of Const (@{const_name HOL.eq}, Type (_, [T, _])) $ _ $ _ => |
1346 (case rec_id ~1 T of |
1346 (case rec_id ~1 T of |
1347 "" => NONE |
1347 "" => NONE |
1348 | name => |
1348 | name => |
1349 (case get_equalities thy name of |
1349 (case get_equalities thy name of |
1350 NONE => NONE |
1350 NONE => NONE |
1403 if not (loose_bvar1 (x, 0)) |
1403 if not (loose_bvar1 (x, 0)) |
1404 then Free ("x" ^ string_of_int i, range_type Tsel) |
1404 then Free ("x" ^ string_of_int i, range_type Tsel) |
1405 else raise TERM ("", [x]); |
1405 else raise TERM ("", [x]); |
1406 val sel' = Const (sel, Tsel) $ Bound 0; |
1406 val sel' = Const (sel, Tsel) $ Bound 0; |
1407 val (l, r) = if lr then (sel', x') else (x', sel'); |
1407 val (l, r) = if lr then (sel', x') else (x', sel'); |
1408 in Const (@{const_name "op ="}, Teq) $ l $ r end |
1408 in Const (@{const_name HOL.eq}, Teq) $ l $ r end |
1409 else raise TERM ("", [Const (sel, Tsel)]); |
1409 else raise TERM ("", [Const (sel, Tsel)]); |
1410 |
1410 |
1411 fun dest_sel_eq (Const (@{const_name "op ="}, Teq) $ (Const (sel, Tsel) $ Bound 0) $ X) = |
1411 fun dest_sel_eq (Const (@{const_name HOL.eq}, Teq) $ (Const (sel, Tsel) $ Bound 0) $ X) = |
1412 (true, Teq, (sel, Tsel), X) |
1412 (true, Teq, (sel, Tsel), X) |
1413 | dest_sel_eq (Const (@{const_name "op ="}, Teq) $ X $ (Const (sel, Tsel) $ Bound 0)) = |
1413 | dest_sel_eq (Const (@{const_name HOL.eq}, Teq) $ X $ (Const (sel, Tsel) $ Bound 0)) = |
1414 (false, Teq, (sel, Tsel), X) |
1414 (false, Teq, (sel, Tsel), X) |
1415 | dest_sel_eq _ = raise TERM ("", []); |
1415 | dest_sel_eq _ = raise TERM ("", []); |
1416 in |
1416 in |
1417 (case t of |
1417 (case t of |
1418 Const (@{const_name Ex}, Tex) $ Abs (s, T, t) => |
1418 Const (@{const_name Ex}, Tex) $ Abs (s, T, t) => |
1843 fun add_code ext_tyco vs extT ext simps inject thy = |
1843 fun add_code ext_tyco vs extT ext simps inject thy = |
1844 let |
1844 let |
1845 val eq = |
1845 val eq = |
1846 (HOLogic.mk_Trueprop o HOLogic.mk_eq) |
1846 (HOLogic.mk_Trueprop o HOLogic.mk_eq) |
1847 (Const (@{const_name HOL.equal}, extT --> extT --> HOLogic.boolT), |
1847 (Const (@{const_name HOL.equal}, extT --> extT --> HOLogic.boolT), |
1848 Const (@{const_name "op ="}, extT --> extT --> HOLogic.boolT)); |
1848 Const (@{const_name HOL.eq}, extT --> extT --> HOLogic.boolT)); |
1849 fun tac eq_def = |
1849 fun tac eq_def = |
1850 Class.intro_classes_tac [] |
1850 Class.intro_classes_tac [] |
1851 THEN (Simplifier.rewrite_goals_tac [Simpdata.mk_eq eq_def]) |
1851 THEN (Simplifier.rewrite_goals_tac [Simpdata.mk_eq eq_def]) |
1852 THEN ALLGOALS (rtac @{thm refl}); |
1852 THEN ALLGOALS (rtac @{thm refl}); |
1853 fun mk_eq thy eq_def = Simplifier.rewrite_rule |
1853 fun mk_eq thy eq_def = Simplifier.rewrite_rule |