equal
deleted
inserted
replaced
1543 (* uint_arith_tac: reduce to arithmetic on int, try to solve by arith *) |
1543 (* uint_arith_tac: reduce to arithmetic on int, try to solve by arith *) |
1544 ML \<open> |
1544 ML \<open> |
1545 fun uint_arith_simpset ctxt = |
1545 fun uint_arith_simpset ctxt = |
1546 ctxt addsimps @{thms uint_arith_simps} |
1546 ctxt addsimps @{thms uint_arith_simps} |
1547 delsimps @{thms word_uint.Rep_inject} |
1547 delsimps @{thms word_uint.Rep_inject} |
1548 |> fold Splitter.add_split @{thms split_if_asm} |
1548 |> fold Splitter.add_split @{thms if_split_asm} |
1549 |> fold Simplifier.add_cong @{thms power_False_cong} |
1549 |> fold Simplifier.add_cong @{thms power_False_cong} |
1550 |
1550 |
1551 fun uint_arith_tacs ctxt = |
1551 fun uint_arith_tacs ctxt = |
1552 let |
1552 let |
1553 fun arith_tac' n t = |
1553 fun arith_tac' n t = |
1746 "p < a + s \<Longrightarrow> a <= a + s \<Longrightarrow> K udvd s \<Longrightarrow> K udvd p - a \<Longrightarrow> a <= p \<Longrightarrow> |
1746 "p < a + s \<Longrightarrow> a <= a + s \<Longrightarrow> K udvd s \<Longrightarrow> K udvd p - a \<Longrightarrow> a <= p \<Longrightarrow> |
1747 0 < K \<Longrightarrow> p <= p + K & p + K <= a + s" |
1747 0 < K \<Longrightarrow> p <= p + K & p + K <= a + s" |
1748 using [[simproc del: linordered_ring_less_cancel_factor]] |
1748 using [[simproc del: linordered_ring_less_cancel_factor]] |
1749 apply (unfold udvd_def) |
1749 apply (unfold udvd_def) |
1750 apply clarify |
1750 apply clarify |
1751 apply (simp add: uint_arith_simps split: split_if_asm) |
1751 apply (simp add: uint_arith_simps split: if_split_asm) |
1752 prefer 2 |
1752 prefer 2 |
1753 apply (insert uint_range' [of s])[1] |
1753 apply (insert uint_range' [of s])[1] |
1754 apply arith |
1754 apply arith |
1755 apply (drule add.commute [THEN xtr1]) |
1755 apply (drule add.commute [THEN xtr1]) |
1756 apply (simp add: diff_less_eq [symmetric]) |
1756 apply (simp add: diff_less_eq [symmetric]) |
2045 try to solve via arith *) |
2045 try to solve via arith *) |
2046 ML \<open> |
2046 ML \<open> |
2047 fun unat_arith_simpset ctxt = |
2047 fun unat_arith_simpset ctxt = |
2048 ctxt addsimps @{thms unat_arith_simps} |
2048 ctxt addsimps @{thms unat_arith_simps} |
2049 delsimps @{thms word_unat.Rep_inject} |
2049 delsimps @{thms word_unat.Rep_inject} |
2050 |> fold Splitter.add_split @{thms split_if_asm} |
2050 |> fold Splitter.add_split @{thms if_split_asm} |
2051 |> fold Simplifier.add_cong @{thms power_False_cong} |
2051 |> fold Simplifier.add_cong @{thms power_False_cong} |
2052 |
2052 |
2053 fun unat_arith_tacs ctxt = |
2053 fun unat_arith_tacs ctxt = |
2054 let |
2054 let |
2055 fun arith_tac' n t = |
2055 fun arith_tac' n t = |
4215 note rrp = trans [symmetric, OF rotate_rotate rotate_eq_lem] |
4215 note rrp = trans [symmetric, OF rotate_rotate rotate_eq_lem] |
4216 note rrrp = trans [symmetric, OF rotater_add [symmetric] rotater_eq_lem] |
4216 note rrrp = trans [symmetric, OF rotater_add [symmetric] rotater_eq_lem] |
4217 |
4217 |
4218 show ?thesis |
4218 show ?thesis |
4219 apply (unfold word_rot_defs) |
4219 apply (unfold word_rot_defs) |
4220 apply (simp only: split: split_if) |
4220 apply (simp only: split: if_split) |
4221 apply (safe intro!: abl_cong) |
4221 apply (safe intro!: abl_cong) |
4222 apply (simp_all only: to_bl_rotl [THEN word_bl.Rep_inverse'] |
4222 apply (simp_all only: to_bl_rotl [THEN word_bl.Rep_inverse'] |
4223 to_bl_rotl |
4223 to_bl_rotl |
4224 to_bl_rotr [THEN word_bl.Rep_inverse'] |
4224 to_bl_rotr [THEN word_bl.Rep_inverse'] |
4225 to_bl_rotr) |
4225 to_bl_rotr) |