| author | haftmann | 
| Thu, 07 Apr 2011 13:01:27 +0200 | |
| changeset 42272 | a46a13b4be5f | 
| parent 41528 | 276078f01ada | 
| child 42463 | f270e3e18be5 | 
| permissions | -rw-r--r-- | 
| 24197 | 1 | (* Title: HOL/Library/Abstract_Rat.thy | 
| 2 | Author: Amine Chaieb | |
| 3 | *) | |
| 4 | ||
| 5 | header {* Abstract rational numbers *}
 | |
| 6 | ||
| 7 | theory Abstract_Rat | |
| 36411 | 8 | imports Complex_Main | 
| 24197 | 9 | begin | 
| 10 | ||
| 11 | types Num = "int \<times> int" | |
| 25005 | 12 | |
| 13 | abbreviation | |
| 14 |   Num0_syn :: Num ("0\<^sub>N")
 | |
| 15 | where "0\<^sub>N \<equiv> (0, 0)" | |
| 16 | ||
| 17 | abbreviation | |
| 18 |   Numi_syn :: "int \<Rightarrow> Num" ("_\<^sub>N")
 | |
| 19 | where "i\<^sub>N \<equiv> (i, 1)" | |
| 24197 | 20 | |
| 21 | definition | |
| 22 | isnormNum :: "Num \<Rightarrow> bool" | |
| 23 | where | |
| 31706 | 24 | "isnormNum = (\<lambda>(a,b). (if a = 0 then b = 0 else b > 0 \<and> gcd a b = 1))" | 
| 24197 | 25 | |
| 26 | definition | |
| 27 | normNum :: "Num \<Rightarrow> Num" | |
| 28 | where | |
| 29 | "normNum = (\<lambda>(a,b). (if a=0 \<or> b = 0 then (0,0) else | |
| 31706 | 30 | (let g = gcd a b | 
| 24197 | 31 | in if b > 0 then (a div g, b div g) else (- (a div g), - (b div g)))))" | 
| 32 | ||
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 33 | declare gcd_dvd1_int[presburger] | 
| 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 34 | declare gcd_dvd2_int[presburger] | 
| 24197 | 35 | lemma normNum_isnormNum [simp]: "isnormNum (normNum x)" | 
| 36 | proof - | |
| 37 | have " \<exists> a b. x = (a,b)" by auto | |
| 38 | then obtain a b where x[simp]: "x = (a,b)" by blast | |
| 39 |   {assume "a=0 \<or> b = 0" hence ?thesis by (simp add: normNum_def isnormNum_def)}  
 | |
| 40 | moreover | |
| 41 |   {assume anz: "a \<noteq> 0" and bnz: "b \<noteq> 0" 
 | |
| 31706 | 42 | let ?g = "gcd a b" | 
| 24197 | 43 | let ?a' = "a div ?g" | 
| 44 | let ?b' = "b div ?g" | |
| 31706 | 45 | let ?g' = "gcd ?a' ?b'" | 
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 46 | from anz bnz have "?g \<noteq> 0" by simp with gcd_ge_0_int[of a b] | 
| 41528 | 47 | have gpos: "?g > 0" by arith | 
| 27668 | 48 | have gdvd: "?g dvd a" "?g dvd b" by arith+ | 
| 24197 | 49 | from zdvd_mult_div_cancel[OF gdvd(1)] zdvd_mult_div_cancel[OF gdvd(2)] | 
| 50 | anz bnz | |
| 31706 | 51 | have nz':"?a' \<noteq> 0" "?b' \<noteq> 0" | 
| 52 | by - (rule notI, simp)+ | |
| 27668 | 53 | from anz bnz have stupid: "a \<noteq> 0 \<or> b \<noteq> 0" by arith | 
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 54 | from div_gcd_coprime_int[OF stupid] have gp1: "?g' = 1" . | 
| 24197 | 55 | from bnz have "b < 0 \<or> b > 0" by arith | 
| 56 | moreover | |
| 57 |     {assume b: "b > 0"
 | |
| 27668 | 58 | from b have "?b' \<ge> 0" | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 59 | by (presburger add: pos_imp_zdiv_nonneg_iff[OF gpos]) | 
| 27668 | 60 | with nz' have b': "?b' > 0" by arith | 
| 24197 | 61 | from b b' anz bnz nz' gp1 have ?thesis | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 62 | by (simp add: isnormNum_def normNum_def Let_def split_def fst_conv snd_conv)} | 
| 24197 | 63 |     moreover {assume b: "b < 0"
 | 
| 64 |       {assume b': "?b' \<ge> 0" 
 | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 65 | from gpos have th: "?g \<ge> 0" by arith | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 66 | from mult_nonneg_nonneg[OF th b'] zdvd_mult_div_cancel[OF gdvd(2)] | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 67 | have False using b by arith } | 
| 24197 | 68 | hence b': "?b' < 0" by (presburger add: linorder_not_le[symmetric]) | 
| 69 | from anz bnz nz' b b' gp1 have ?thesis | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 70 | by (simp add: isnormNum_def normNum_def Let_def split_def)} | 
| 24197 | 71 | ultimately have ?thesis by blast | 
| 72 | } | |
| 73 | ultimately show ?thesis by blast | |
| 74 | qed | |
| 75 | ||
| 76 | text {* Arithmetic over Num *}
 | |
| 77 | ||
| 78 | definition | |
| 79 | Nadd :: "Num \<Rightarrow> Num \<Rightarrow> Num" (infixl "+\<^sub>N" 60) | |
| 80 | where | |
| 81 | "Nadd = (\<lambda>(a,b) (a',b'). if a = 0 \<or> b = 0 then normNum(a',b') | |
| 82 | else if a'=0 \<or> b' = 0 then normNum(a,b) | |
| 83 | else normNum(a*b' + b*a', b*b'))" | |
| 84 | ||
| 85 | definition | |
| 86 | Nmul :: "Num \<Rightarrow> Num \<Rightarrow> Num" (infixl "*\<^sub>N" 60) | |
| 87 | where | |
| 31706 | 88 | "Nmul = (\<lambda>(a,b) (a',b'). let g = gcd (a*a') (b*b') | 
| 24197 | 89 | in (a*a' div g, b*b' div g))" | 
| 90 | ||
| 91 | definition | |
| 92 |   Nneg :: "Num \<Rightarrow> Num" ("~\<^sub>N")
 | |
| 93 | where | |
| 94 | "Nneg \<equiv> (\<lambda>(a,b). (-a,b))" | |
| 95 | ||
| 96 | definition | |
| 97 | Nsub :: "Num \<Rightarrow> Num \<Rightarrow> Num" (infixl "-\<^sub>N" 60) | |
| 98 | where | |
| 99 | "Nsub = (\<lambda>a b. a +\<^sub>N ~\<^sub>N b)" | |
| 100 | ||
| 101 | definition | |
| 102 | Ninv :: "Num \<Rightarrow> Num" | |
| 103 | where | |
| 104 | "Ninv \<equiv> \<lambda>(a,b). if a < 0 then (-b, \<bar>a\<bar>) else (b,a)" | |
| 105 | ||
| 106 | definition | |
| 107 | Ndiv :: "Num \<Rightarrow> Num \<Rightarrow> Num" (infixl "\<div>\<^sub>N" 60) | |
| 108 | where | |
| 109 | "Ndiv \<equiv> \<lambda>a b. a *\<^sub>N Ninv b" | |
| 110 | ||
| 111 | lemma Nneg_normN[simp]: "isnormNum x \<Longrightarrow> isnormNum (~\<^sub>N x)" | |
| 112 | by(simp add: isnormNum_def Nneg_def split_def) | |
| 113 | lemma Nadd_normN[simp]: "isnormNum (x +\<^sub>N y)" | |
| 114 | by (simp add: Nadd_def split_def) | |
| 115 | lemma Nsub_normN[simp]: "\<lbrakk> isnormNum y\<rbrakk> \<Longrightarrow> isnormNum (x -\<^sub>N y)" | |
| 116 | by (simp add: Nsub_def split_def) | |
| 117 | lemma Nmul_normN[simp]: assumes xn:"isnormNum x" and yn: "isnormNum y" | |
| 118 | shows "isnormNum (x *\<^sub>N y)" | |
| 119 | proof- | |
| 120 | have "\<exists>a b. x = (a,b)" and "\<exists> a' b'. y = (a',b')" by auto | |
| 121 | then obtain a b a' b' where ab: "x = (a,b)" and ab': "y = (a',b')" by blast | |
| 122 |   {assume "a = 0"
 | |
| 123 | hence ?thesis using xn ab ab' | |
| 31706 | 124 | by (simp add: isnormNum_def Let_def Nmul_def split_def)} | 
| 24197 | 125 | moreover | 
| 126 |   {assume "a' = 0"
 | |
| 127 | hence ?thesis using yn ab ab' | |
| 31706 | 128 | by (simp add: isnormNum_def Let_def Nmul_def split_def)} | 
| 24197 | 129 | moreover | 
| 130 |   {assume a: "a \<noteq>0" and a': "a'\<noteq>0"
 | |
| 131 | hence bp: "b > 0" "b' > 0" using xn yn ab ab' by (simp_all add: isnormNum_def) | |
| 132 | from mult_pos_pos[OF bp] have "x *\<^sub>N y = normNum (a*a', b*b')" | |
| 133 | using ab ab' a a' bp by (simp add: Nmul_def Let_def split_def normNum_def) | |
| 134 | hence ?thesis by simp} | |
| 135 | ultimately show ?thesis by blast | |
| 136 | qed | |
| 137 | ||
| 138 | lemma Ninv_normN[simp]: "isnormNum x \<Longrightarrow> isnormNum (Ninv x)" | |
| 25005 | 139 | by (simp add: Ninv_def isnormNum_def split_def) | 
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 140 | (cases "fst x = 0", auto simp add: gcd_commute_int) | 
| 24197 | 141 | |
| 142 | lemma isnormNum_int[simp]: | |
| 41528 | 143 | "isnormNum 0\<^sub>N" "isnormNum ((1::int)\<^sub>N)" "i \<noteq> 0 \<Longrightarrow> isnormNum (i\<^sub>N)" | 
| 31706 | 144 | by (simp_all add: isnormNum_def) | 
| 24197 | 145 | |
| 146 | ||
| 147 | text {* Relations over Num *}
 | |
| 148 | ||
| 149 | definition | |
| 150 |   Nlt0:: "Num \<Rightarrow> bool" ("0>\<^sub>N")
 | |
| 151 | where | |
| 152 | "Nlt0 = (\<lambda>(a,b). a < 0)" | |
| 153 | ||
| 154 | definition | |
| 155 |   Nle0:: "Num \<Rightarrow> bool" ("0\<ge>\<^sub>N")
 | |
| 156 | where | |
| 157 | "Nle0 = (\<lambda>(a,b). a \<le> 0)" | |
| 158 | ||
| 159 | definition | |
| 160 |   Ngt0:: "Num \<Rightarrow> bool" ("0<\<^sub>N")
 | |
| 161 | where | |
| 162 | "Ngt0 = (\<lambda>(a,b). a > 0)" | |
| 163 | ||
| 164 | definition | |
| 165 |   Nge0:: "Num \<Rightarrow> bool" ("0\<le>\<^sub>N")
 | |
| 166 | where | |
| 167 | "Nge0 = (\<lambda>(a,b). a \<ge> 0)" | |
| 168 | ||
| 169 | definition | |
| 170 | Nlt :: "Num \<Rightarrow> Num \<Rightarrow> bool" (infix "<\<^sub>N" 55) | |
| 171 | where | |
| 172 | "Nlt = (\<lambda>a b. 0>\<^sub>N (a -\<^sub>N b))" | |
| 173 | ||
| 174 | definition | |
| 175 | Nle :: "Num \<Rightarrow> Num \<Rightarrow> bool" (infix "\<le>\<^sub>N" 55) | |
| 176 | where | |
| 177 | "Nle = (\<lambda>a b. 0\<ge>\<^sub>N (a -\<^sub>N b))" | |
| 178 | ||
| 179 | definition | |
| 180 | "INum = (\<lambda>(a,b). of_int a / of_int b)" | |
| 181 | ||
| 41528 | 182 | lemma INum_int [simp]: "INum (i\<^sub>N) = ((of_int i) ::'a::field)" "INum 0\<^sub>N = (0::'a::field)" | 
| 24197 | 183 | by (simp_all add: INum_def) | 
| 184 | ||
| 185 | lemma isnormNum_unique[simp]: | |
| 186 | assumes na: "isnormNum x" and nb: "isnormNum y" | |
| 36409 | 187 |   shows "((INum x ::'a::{field_char_0, field_inverse_zero}) = INum y) = (x = y)" (is "?lhs = ?rhs")
 | 
| 24197 | 188 | proof | 
| 189 | have "\<exists> a b a' b'. x = (a,b) \<and> y = (a',b')" by auto | |
| 190 | then obtain a b a' b' where xy[simp]: "x = (a,b)" "y=(a',b')" by blast | |
| 191 | assume H: ?lhs | |
| 32456 
341c83339aeb
tuned the simp rules for Int involving insert and intervals.
 nipkow parents: 
31967diff
changeset | 192 |   {assume "a = 0 \<or> b = 0 \<or> a' = 0 \<or> b' = 0"
 | 
| 
341c83339aeb
tuned the simp rules for Int involving insert and intervals.
 nipkow parents: 
31967diff
changeset | 193 | hence ?rhs using na nb H | 
| 
341c83339aeb
tuned the simp rules for Int involving insert and intervals.
 nipkow parents: 
31967diff
changeset | 194 | by (simp add: INum_def split_def isnormNum_def split: split_if_asm)} | 
| 24197 | 195 | moreover | 
| 196 |   { assume az: "a \<noteq> 0" and bz: "b \<noteq> 0" and a'z: "a'\<noteq>0" and b'z: "b'\<noteq>0"
 | |
| 197 | from az bz a'z b'z na nb have pos: "b > 0" "b' > 0" by (simp_all add: isnormNum_def) | |
| 41528 | 198 | from H bz b'z have eq:"a * b' = a'*b" | 
| 24197 | 199 | by (simp add: INum_def eq_divide_eq divide_eq_eq of_int_mult[symmetric] del: of_int_mult) | 
| 41528 | 200 | from az a'z na nb have gcd1: "gcd a b = 1" "gcd b a = 1" "gcd a' b' = 1" "gcd b' a' = 1" | 
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 201 | by (simp_all add: isnormNum_def add: gcd_commute_int) | 
| 27668 | 202 | from eq have raw_dvd: "a dvd a'*b" "b dvd b'*a" "a' dvd a*b'" "b' dvd b*a'" | 
| 203 | apply - | |
| 204 | apply algebra | |
| 205 | apply algebra | |
| 206 | apply simp | |
| 207 | apply algebra | |
| 24197 | 208 | done | 
| 33657 | 209 | from zdvd_antisym_abs[OF coprime_dvd_mult_int[OF gcd1(2) raw_dvd(2)] | 
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 210 | coprime_dvd_mult_int[OF gcd1(4) raw_dvd(4)]] | 
| 41528 | 211 | have eq1: "b = b'" using pos by arith | 
| 24197 | 212 | with eq have "a = a'" using pos by simp | 
| 213 | with eq1 have ?rhs by simp} | |
| 214 | ultimately show ?rhs by blast | |
| 215 | next | |
| 216 | assume ?rhs thus ?lhs by simp | |
| 217 | qed | |
| 218 | ||
| 219 | ||
| 36409 | 220 | lemma isnormNum0[simp]: "isnormNum x \<Longrightarrow> (INum x = (0::'a::{field_char_0, field_inverse_zero})) = (x = 0\<^sub>N)"
 | 
| 24197 | 221 | unfolding INum_int(2)[symmetric] | 
| 222 | by (rule isnormNum_unique, simp_all) | |
| 223 | ||
| 36409 | 224 | lemma of_int_div_aux: "d ~= 0 ==> ((of_int x)::'a::field_char_0) / (of_int d) = | 
| 24197 | 225 | of_int (x div d) + (of_int (x mod d)) / ((of_int d)::'a)" | 
| 226 | proof - | |
| 227 | assume "d ~= 0" | |
| 228 | let ?t = "of_int (x div d) * ((of_int d)::'a) + of_int(x mod d)" | |
| 229 | let ?f = "\<lambda>x. x / of_int d" | |
| 230 | have "x = (x div d) * d + x mod d" | |
| 231 | by auto | |
| 232 | then have eq: "of_int x = ?t" | |
| 233 | by (simp only: of_int_mult[symmetric] of_int_add [symmetric]) | |
| 234 | then have "of_int x / of_int d = ?t / of_int d" | |
| 235 | using cong[OF refl[of ?f] eq] by simp | |
| 41528 | 236 | then show ?thesis by (simp add: add_divide_distrib algebra_simps `d ~= 0`) | 
| 24197 | 237 | qed | 
| 238 | ||
| 239 | lemma of_int_div: "(d::int) ~= 0 ==> d dvd n ==> | |
| 36409 | 240 | (of_int(n div d)::'a::field_char_0) = of_int n / of_int d" | 
| 24197 | 241 | apply (frule of_int_div_aux [of d n, where ?'a = 'a]) | 
| 242 | apply simp | |
| 30042 | 243 | apply (simp add: dvd_eq_mod_eq_0) | 
| 24197 | 244 | done | 
| 245 | ||
| 246 | ||
| 36409 | 247 | lemma normNum[simp]: "INum (normNum x) = (INum x :: 'a::{field_char_0, field_inverse_zero})"
 | 
| 24197 | 248 | proof- | 
| 249 | have "\<exists> a b. x = (a,b)" by auto | |
| 250 | then obtain a b where x[simp]: "x = (a,b)" by blast | |
| 251 |   {assume "a=0 \<or> b = 0" hence ?thesis
 | |
| 252 | by (simp add: INum_def normNum_def split_def Let_def)} | |
| 253 | moreover | |
| 254 |   {assume a: "a\<noteq>0" and b: "b\<noteq>0"
 | |
| 31706 | 255 | let ?g = "gcd a b" | 
| 24197 | 256 | from a b have g: "?g \<noteq> 0"by simp | 
| 257 | from of_int_div[OF g, where ?'a = 'a] | |
| 258 | have ?thesis by (auto simp add: INum_def normNum_def split_def Let_def)} | |
| 259 | ultimately show ?thesis by blast | |
| 260 | qed | |
| 261 | ||
| 36409 | 262 | lemma INum_normNum_iff: "(INum x ::'a::{field_char_0, field_inverse_zero}) = INum y \<longleftrightarrow> normNum x = normNum y" (is "?lhs = ?rhs")
 | 
| 24197 | 263 | proof - | 
| 264 | have "normNum x = normNum y \<longleftrightarrow> (INum (normNum x) :: 'a) = INum (normNum y)" | |
| 265 | by (simp del: normNum) | |
| 266 | also have "\<dots> = ?lhs" by simp | |
| 267 | finally show ?thesis by simp | |
| 268 | qed | |
| 269 | ||
| 36409 | 270 | lemma Nadd[simp]: "INum (x +\<^sub>N y) = INum x + (INum y :: 'a :: {field_char_0, field_inverse_zero})"
 | 
| 24197 | 271 | proof- | 
| 272 | let ?z = "0:: 'a" | |
| 273 | have " \<exists> a b. x = (a,b)" " \<exists> a' b'. y = (a',b')" by auto | |
| 274 | then obtain a b a' b' where x[simp]: "x = (a,b)" | |
| 275 | and y[simp]: "y = (a',b')" by blast | |
| 276 |   {assume "a=0 \<or> a'= 0 \<or> b =0 \<or> b' = 0" hence ?thesis 
 | |
| 277 | apply (cases "a=0",simp_all add: Nadd_def) | |
| 278 | apply (cases "b= 0",simp_all add: INum_def) | |
| 279 | apply (cases "a'= 0",simp_all) | |
| 280 | apply (cases "b'= 0",simp_all) | |
| 281 | done } | |
| 282 | moreover | |
| 283 |   {assume aa':"a \<noteq> 0" "a'\<noteq> 0" and bb': "b \<noteq> 0" "b' \<noteq> 0" 
 | |
| 284 |     {assume z: "a * b' + b * a' = 0"
 | |
| 285 | hence "of_int (a*b' + b*a') / (of_int b* of_int b') = ?z" by simp | |
| 286 | hence "of_int b' * of_int a / (of_int b * of_int b') + of_int b * of_int a' / (of_int b * of_int b') = ?z" by (simp add:add_divide_distrib) | |
| 287 | hence th: "of_int a / of_int b + of_int a' / of_int b' = ?z" using bb' aa' by simp | |
| 288 | from z aa' bb' have ?thesis | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 289 | by (simp add: th Nadd_def normNum_def INum_def split_def)} | 
| 24197 | 290 |     moreover {assume z: "a * b' + b * a' \<noteq> 0"
 | 
| 31706 | 291 | let ?g = "gcd (a * b' + b * a') (b*b')" | 
| 24197 | 292 | have gz: "?g \<noteq> 0" using z by simp | 
| 293 | have ?thesis using aa' bb' z gz | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 294 | of_int_div[where ?'a = 'a, OF gz gcd_dvd1_int[where x="a * b' + b * a'" and y="b*b'"]] of_int_div[where ?'a = 'a, | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32456diff
changeset | 295 | OF gz gcd_dvd2_int[where x="a * b' + b * a'" and y="b*b'"]] | 
| 41528 | 296 | by (simp add: Nadd_def INum_def normNum_def Let_def add_divide_distrib)} | 
| 24197 | 297 | ultimately have ?thesis using aa' bb' | 
| 41528 | 298 | by (simp add: Nadd_def INum_def normNum_def Let_def) } | 
| 24197 | 299 | ultimately show ?thesis by blast | 
| 300 | qed | |
| 301 | ||
| 36409 | 302 | lemma Nmul[simp]: "INum (x *\<^sub>N y) = INum x * (INum y:: 'a :: {field_char_0, field_inverse_zero}) "
 | 
| 24197 | 303 | proof- | 
| 304 | let ?z = "0::'a" | |
| 305 | have " \<exists> a b. x = (a,b)" " \<exists> a' b'. y = (a',b')" by auto | |
| 306 | then obtain a b a' b' where x: "x = (a,b)" and y: "y = (a',b')" by blast | |
| 307 |   {assume "a=0 \<or> a'= 0 \<or> b = 0 \<or> b' = 0" hence ?thesis 
 | |
| 308 | apply (cases "a=0",simp_all add: x y Nmul_def INum_def Let_def) | |
| 309 | apply (cases "b=0",simp_all) | |
| 310 | apply (cases "a'=0",simp_all) | |
| 311 | done } | |
| 312 | moreover | |
| 313 |   {assume z: "a \<noteq> 0" "a' \<noteq> 0" "b \<noteq> 0" "b' \<noteq> 0"
 | |
| 31706 | 314 | let ?g="gcd (a*a') (b*b')" | 
| 24197 | 315 | have gz: "?g \<noteq> 0" using z by simp | 
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 316 | from z of_int_div[where ?'a = 'a, OF gz gcd_dvd1_int[where x="a*a'" and y="b*b'"]] | 
| 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 317 | of_int_div[where ?'a = 'a , OF gz gcd_dvd2_int[where x="a*a'" and y="b*b'"]] | 
| 24197 | 318 | have ?thesis by (simp add: Nmul_def x y Let_def INum_def)} | 
| 319 | ultimately show ?thesis by blast | |
| 320 | qed | |
| 321 | ||
| 322 | lemma Nneg[simp]: "INum (~\<^sub>N x) = - (INum x ::'a:: field)" | |
| 323 | by (simp add: Nneg_def split_def INum_def) | |
| 324 | ||
| 36409 | 325 | lemma Nsub[simp]: shows "INum (x -\<^sub>N y) = INum x - (INum y:: 'a :: {field_char_0, field_inverse_zero})"
 | 
| 24197 | 326 | by (simp add: Nsub_def split_def) | 
| 327 | ||
| 36409 | 328 | lemma Ninv[simp]: "INum (Ninv x) = (1::'a :: field_inverse_zero) / (INum x)" | 
| 24197 | 329 | by (simp add: Ninv_def INum_def split_def) | 
| 330 | ||
| 36409 | 331 | lemma Ndiv[simp]: "INum (x \<div>\<^sub>N y) = INum x / (INum y ::'a :: {field_char_0, field_inverse_zero})" by (simp add: Ndiv_def)
 | 
| 24197 | 332 | |
| 333 | lemma Nlt0_iff[simp]: assumes nx: "isnormNum x" | |
| 36409 | 334 |   shows "((INum x :: 'a :: {field_char_0, linordered_field_inverse_zero})< 0) = 0>\<^sub>N x "
 | 
| 24197 | 335 | proof- | 
| 336 | have " \<exists> a b. x = (a,b)" by simp | |
| 337 | then obtain a b where x[simp]:"x = (a,b)" by blast | |
| 338 |   {assume "a = 0" hence ?thesis by (simp add: Nlt0_def INum_def) }
 | |
| 339 | moreover | |
| 340 |   {assume a: "a\<noteq>0" hence b: "(of_int b::'a) > 0" using nx by (simp add: isnormNum_def)
 | |
| 341 | from pos_divide_less_eq[OF b, where b="of_int a" and a="0::'a"] | |
| 342 | have ?thesis by (simp add: Nlt0_def INum_def)} | |
| 343 | ultimately show ?thesis by blast | |
| 344 | qed | |
| 345 | ||
| 346 | lemma Nle0_iff[simp]:assumes nx: "isnormNum x" | |
| 36409 | 347 |   shows "((INum x :: 'a :: {field_char_0, linordered_field_inverse_zero}) \<le> 0) = 0\<ge>\<^sub>N x"
 | 
| 24197 | 348 | proof- | 
| 349 | have " \<exists> a b. x = (a,b)" by simp | |
| 350 | then obtain a b where x[simp]:"x = (a,b)" by blast | |
| 351 |   {assume "a = 0" hence ?thesis by (simp add: Nle0_def INum_def) }
 | |
| 352 | moreover | |
| 353 |   {assume a: "a\<noteq>0" hence b: "(of_int b :: 'a) > 0" using nx by (simp add: isnormNum_def)
 | |
| 354 | from pos_divide_le_eq[OF b, where b="of_int a" and a="0::'a"] | |
| 355 | have ?thesis by (simp add: Nle0_def INum_def)} | |
| 356 | ultimately show ?thesis by blast | |
| 357 | qed | |
| 358 | ||
| 36409 | 359 | lemma Ngt0_iff[simp]:assumes nx: "isnormNum x" shows "((INum x :: 'a :: {field_char_0, linordered_field_inverse_zero})> 0) = 0<\<^sub>N x"
 | 
| 24197 | 360 | proof- | 
| 361 | have " \<exists> a b. x = (a,b)" by simp | |
| 362 | then obtain a b where x[simp]:"x = (a,b)" by blast | |
| 363 |   {assume "a = 0" hence ?thesis by (simp add: Ngt0_def INum_def) }
 | |
| 364 | moreover | |
| 365 |   {assume a: "a\<noteq>0" hence b: "(of_int b::'a) > 0" using nx by (simp add: isnormNum_def)
 | |
| 366 | from pos_less_divide_eq[OF b, where b="of_int a" and a="0::'a"] | |
| 367 | have ?thesis by (simp add: Ngt0_def INum_def)} | |
| 368 | ultimately show ?thesis by blast | |
| 369 | qed | |
| 370 | lemma Nge0_iff[simp]:assumes nx: "isnormNum x" | |
| 36409 | 371 |   shows "((INum x :: 'a :: {field_char_0, linordered_field_inverse_zero}) \<ge> 0) = 0\<le>\<^sub>N x"
 | 
| 24197 | 372 | proof- | 
| 373 | have " \<exists> a b. x = (a,b)" by simp | |
| 374 | then obtain a b where x[simp]:"x = (a,b)" by blast | |
| 375 |   {assume "a = 0" hence ?thesis by (simp add: Nge0_def INum_def) }
 | |
| 376 | moreover | |
| 377 |   {assume a: "a\<noteq>0" hence b: "(of_int b::'a) > 0" using nx by (simp add: isnormNum_def)
 | |
| 378 | from pos_le_divide_eq[OF b, where b="of_int a" and a="0::'a"] | |
| 379 | have ?thesis by (simp add: Nge0_def INum_def)} | |
| 380 | ultimately show ?thesis by blast | |
| 381 | qed | |
| 382 | ||
| 383 | lemma Nlt_iff[simp]: assumes nx: "isnormNum x" and ny: "isnormNum y" | |
| 36409 | 384 |   shows "((INum x :: 'a :: {field_char_0, linordered_field_inverse_zero}) < INum y) = (x <\<^sub>N y)"
 | 
| 24197 | 385 | proof- | 
| 386 | let ?z = "0::'a" | |
| 387 | have "((INum x ::'a) < INum y) = (INum (x -\<^sub>N y) < ?z)" using nx ny by simp | |
| 388 | also have "\<dots> = (0>\<^sub>N (x -\<^sub>N y))" using Nlt0_iff[OF Nsub_normN[OF ny]] by simp | |
| 389 | finally show ?thesis by (simp add: Nlt_def) | |
| 390 | qed | |
| 391 | ||
| 392 | lemma Nle_iff[simp]: assumes nx: "isnormNum x" and ny: "isnormNum y" | |
| 36409 | 393 |   shows "((INum x :: 'a :: {field_char_0, linordered_field_inverse_zero})\<le> INum y) = (x \<le>\<^sub>N y)"
 | 
| 24197 | 394 | proof- | 
| 395 | have "((INum x ::'a) \<le> INum y) = (INum (x -\<^sub>N y) \<le> (0::'a))" using nx ny by simp | |
| 396 | also have "\<dots> = (0\<ge>\<^sub>N (x -\<^sub>N y))" using Nle0_iff[OF Nsub_normN[OF ny]] by simp | |
| 397 | finally show ?thesis by (simp add: Nle_def) | |
| 398 | qed | |
| 399 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 400 | lemma Nadd_commute: | 
| 36409 | 401 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 402 | shows "x +\<^sub>N y = y +\<^sub>N x" | 
| 24197 | 403 | proof- | 
| 404 | have n: "isnormNum (x +\<^sub>N y)" "isnormNum (y +\<^sub>N x)" by simp_all | |
| 31964 | 405 | have "(INum (x +\<^sub>N y)::'a) = INum (y +\<^sub>N x)" by simp | 
| 24197 | 406 | with isnormNum_unique[OF n] show ?thesis by simp | 
| 407 | qed | |
| 408 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 409 | lemma [simp]: | 
| 36409 | 410 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 411 | shows "(0, b) +\<^sub>N y = normNum y" | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 412 | and "(a, 0) +\<^sub>N y = normNum y" | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 413 | and "x +\<^sub>N (0, b) = normNum x" | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 414 | and "x +\<^sub>N (a, 0) = normNum x" | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 415 | apply (simp add: Nadd_def split_def) | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 416 | apply (simp add: Nadd_def split_def) | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 417 | apply (subst Nadd_commute, simp add: Nadd_def split_def) | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 418 | apply (subst Nadd_commute, simp add: Nadd_def split_def) | 
| 24197 | 419 | done | 
| 420 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 421 | lemma normNum_nilpotent_aux[simp]: | 
| 36409 | 422 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 423 | assumes nx: "isnormNum x" | 
| 24197 | 424 | shows "normNum x = x" | 
| 425 | proof- | |
| 426 | let ?a = "normNum x" | |
| 427 | have n: "isnormNum ?a" by simp | |
| 31964 | 428 | have th:"INum ?a = (INum x ::'a)" by simp | 
| 24197 | 429 | with isnormNum_unique[OF n nx] | 
| 430 | show ?thesis by simp | |
| 431 | qed | |
| 432 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 433 | lemma normNum_nilpotent[simp]: | 
| 36409 | 434 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 435 | shows "normNum (normNum x) = normNum x" | 
| 24197 | 436 | by simp | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 437 | |
| 24197 | 438 | lemma normNum0[simp]: "normNum (0,b) = 0\<^sub>N" "normNum (a,0) = 0\<^sub>N" | 
| 439 | by (simp_all add: normNum_def) | |
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 440 | |
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 441 | lemma normNum_Nadd: | 
| 36409 | 442 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 443 | shows "normNum (x +\<^sub>N y) = x +\<^sub>N y" by simp | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 444 | |
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 445 | lemma Nadd_normNum1[simp]: | 
| 36409 | 446 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 447 | shows "normNum x +\<^sub>N y = x +\<^sub>N y" | 
| 24197 | 448 | proof- | 
| 449 | have n: "isnormNum (normNum x +\<^sub>N y)" "isnormNum (x +\<^sub>N y)" by simp_all | |
| 31964 | 450 | have "INum (normNum x +\<^sub>N y) = INum x + (INum y :: 'a)" by simp | 
| 24197 | 451 | also have "\<dots> = INum (x +\<^sub>N y)" by simp | 
| 452 | finally show ?thesis using isnormNum_unique[OF n] by simp | |
| 453 | qed | |
| 454 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 455 | lemma Nadd_normNum2[simp]: | 
| 36409 | 456 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 457 | shows "x +\<^sub>N normNum y = x +\<^sub>N y" | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 458 | proof- | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 459 | have n: "isnormNum (x +\<^sub>N normNum y)" "isnormNum (x +\<^sub>N y)" by simp_all | 
| 31964 | 460 | have "INum (x +\<^sub>N normNum y) = INum x + (INum y :: 'a)" by simp | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 461 | also have "\<dots> = INum (x +\<^sub>N y)" by simp | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 462 | finally show ?thesis using isnormNum_unique[OF n] by simp | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 463 | qed | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 464 | |
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 465 | lemma Nadd_assoc: | 
| 36409 | 466 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 467 | shows "x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)" | 
| 24197 | 468 | proof- | 
| 469 | have n: "isnormNum (x +\<^sub>N y +\<^sub>N z)" "isnormNum (x +\<^sub>N (y +\<^sub>N z))" by simp_all | |
| 31964 | 470 | have "INum (x +\<^sub>N y +\<^sub>N z) = (INum (x +\<^sub>N (y +\<^sub>N z)) :: 'a)" by simp | 
| 24197 | 471 | with isnormNum_unique[OF n] show ?thesis by simp | 
| 472 | qed | |
| 473 | ||
| 474 | lemma Nmul_commute: "isnormNum x \<Longrightarrow> isnormNum y \<Longrightarrow> x *\<^sub>N y = y *\<^sub>N x" | |
| 31952 
40501bb2d57c
renamed lemmas: nat_xyz/int_xyz -> xyz_nat/xyz_int
 nipkow parents: 
31706diff
changeset | 475 | by (simp add: Nmul_def split_def Let_def gcd_commute_int mult_commute) | 
| 24197 | 476 | |
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 477 | lemma Nmul_assoc: | 
| 36409 | 478 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 479 | assumes nx: "isnormNum x" and ny:"isnormNum y" and nz:"isnormNum z" | 
| 24197 | 480 | shows "x *\<^sub>N y *\<^sub>N z = x *\<^sub>N (y *\<^sub>N z)" | 
| 481 | proof- | |
| 482 | from nx ny nz have n: "isnormNum (x *\<^sub>N y *\<^sub>N z)" "isnormNum (x *\<^sub>N (y *\<^sub>N z))" | |
| 483 | by simp_all | |
| 31964 | 484 | have "INum (x +\<^sub>N y +\<^sub>N z) = (INum (x +\<^sub>N (y +\<^sub>N z)) :: 'a)" by simp | 
| 24197 | 485 | with isnormNum_unique[OF n] show ?thesis by simp | 
| 486 | qed | |
| 487 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 488 | lemma Nsub0: | 
| 36409 | 489 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 490 | assumes x: "isnormNum x" and y:"isnormNum y" shows "(x -\<^sub>N y = 0\<^sub>N) = (x = y)" | 
| 24197 | 491 | proof- | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 492 |   { fix h :: 'a
 | 
| 31964 | 493 | from isnormNum_unique[where 'a = 'a, OF Nsub_normN[OF y], where y="0\<^sub>N"] | 
| 494 | have "(x -\<^sub>N y = 0\<^sub>N) = (INum (x -\<^sub>N y) = (INum 0\<^sub>N :: 'a)) " by simp | |
| 495 | also have "\<dots> = (INum x = (INum y :: 'a))" by simp | |
| 24197 | 496 | also have "\<dots> = (x = y)" using x y by simp | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 497 | finally show ?thesis . } | 
| 24197 | 498 | qed | 
| 499 | ||
| 500 | lemma Nmul0[simp]: "c *\<^sub>N 0\<^sub>N = 0\<^sub>N" " 0\<^sub>N *\<^sub>N c = 0\<^sub>N" | |
| 501 | by (simp_all add: Nmul_def Let_def split_def) | |
| 502 | ||
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 503 | lemma Nmul_eq0[simp]: | 
| 36409 | 504 |   assumes "SORT_CONSTRAINT('a::{field_char_0, field_inverse_zero})"
 | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 505 | assumes nx:"isnormNum x" and ny: "isnormNum y" | 
| 24197 | 506 | shows "(x*\<^sub>N y = 0\<^sub>N) = (x = 0\<^sub>N \<or> y = 0\<^sub>N)" | 
| 507 | proof- | |
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 508 |   { fix h :: 'a
 | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 509 | have " \<exists> a b a' b'. x = (a,b) \<and> y= (a',b')" by auto | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 510 | then obtain a b a' b' where xy[simp]: "x = (a,b)" "y = (a',b')" by blast | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 511 | have n0: "isnormNum 0\<^sub>N" by simp | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 512 | show ?thesis using nx ny | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 513 | apply (simp only: isnormNum_unique[where ?'a = 'a, OF Nmul_normN[OF nx ny] n0, symmetric] Nmul[where ?'a = 'a]) | 
| 41528 | 514 | by (simp add: INum_def split_def isnormNum_def split: split_if_asm) | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 515 | } | 
| 24197 | 516 | qed | 
| 517 | lemma Nneg_Nneg[simp]: "~\<^sub>N (~\<^sub>N c) = c" | |
| 518 | by (simp add: Nneg_def split_def) | |
| 519 | ||
| 520 | lemma Nmul1[simp]: | |
| 521 | "isnormNum c \<Longrightarrow> 1\<^sub>N *\<^sub>N c = c" | |
| 41528 | 522 | "isnormNum c \<Longrightarrow> c *\<^sub>N (1\<^sub>N) = c" | 
| 24197 | 523 | apply (simp_all add: Nmul_def Let_def split_def isnormNum_def) | 
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 524 | apply (cases "fst c = 0", simp_all, cases c, simp_all)+ | 
| 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 525 | done | 
| 24197 | 526 | |
| 28615 
4c8fa015ec7f
explicit SORT_CONSTRAINT for proofs depending implicitly on certain sorts;
 wenzelm parents: 
27668diff
changeset | 527 | end |