1229 by (simp add: add_sup_inf_distribs sup_ACI |
1229 by (simp add: add_sup_inf_distribs sup_ACI |
1230 pprt_def nprt_def diff_minus abs_lattice) |
1230 pprt_def nprt_def diff_minus abs_lattice) |
1231 qed |
1231 qed |
1232 |
1232 |
1233 subclass pordered_ab_group_add_abs |
1233 subclass pordered_ab_group_add_abs |
1234 proof - |
1234 proof |
1235 have abs_ge_zero [simp]: "\<And>a. 0 \<le> \<bar>a\<bar>" |
1235 have abs_ge_zero [simp]: "\<And>a. 0 \<le> \<bar>a\<bar>" |
1236 proof - |
1236 proof - |
1237 fix a b |
1237 fix a b |
1238 have a: "a \<le> \<bar>a\<bar>" and b: "- a \<le> \<bar>a\<bar>" by (auto simp add: abs_lattice) |
1238 have a: "a \<le> \<bar>a\<bar>" and b: "- a \<le> \<bar>a\<bar>" by (auto simp add: abs_lattice) |
1239 show "0 \<le> \<bar>a\<bar>" by (rule add_mono [OF a b, simplified]) |
1239 show "0 \<le> \<bar>a\<bar>" by (rule add_mono [OF a b, simplified]) |
1240 qed |
1240 qed |
1241 have abs_leI: "\<And>a b. a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b" |
1241 have abs_leI: "\<And>a b. a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b" |
1242 by (simp add: abs_lattice le_supI) |
1242 by (simp add: abs_lattice le_supI) |
1243 show ?thesis |
1243 fix a b |
1244 proof |
1244 show "0 \<le> \<bar>a\<bar>" by simp |
1245 fix a |
1245 show "a \<le> \<bar>a\<bar>" |
1246 show "0 \<le> \<bar>a\<bar>" by simp |
1246 by (auto simp add: abs_lattice) |
1247 next |
1247 show "\<bar>-a\<bar> = \<bar>a\<bar>" |
1248 fix a |
1248 by (simp add: abs_lattice sup_commute) |
1249 show "a \<le> \<bar>a\<bar>" |
1249 show "a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b" by (fact abs_leI) |
1250 by (auto simp add: abs_lattice) |
1250 show "\<bar>a + b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>" |
1251 next |
1251 proof - |
1252 fix a |
1252 have g:"abs a + abs b = sup (a+b) (sup (-a-b) (sup (-a+b) (a + (-b))))" (is "_=sup ?m ?n") |
1253 show "\<bar>-a\<bar> = \<bar>a\<bar>" |
1253 by (simp add: abs_lattice add_sup_inf_distribs sup_ACI diff_minus) |
1254 by (simp add: abs_lattice sup_commute) |
1254 have a:"a+b <= sup ?m ?n" by (simp) |
1255 next |
1255 have b:"-a-b <= ?n" by (simp) |
1256 fix a b |
1256 have c:"?n <= sup ?m ?n" by (simp) |
1257 show "a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b" by (erule abs_leI) |
1257 from b c have d: "-a-b <= sup ?m ?n" by(rule order_trans) |
1258 next |
1258 have e:"-a-b = -(a+b)" by (simp add: diff_minus) |
1259 fix a b |
1259 from a d e have "abs(a+b) <= sup ?m ?n" |
1260 show "\<bar>a + b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>" |
1260 by (drule_tac abs_leI, auto) |
1261 proof - |
1261 with g[symmetric] show ?thesis by simp |
1262 have g:"abs a + abs b = sup (a+b) (sup (-a-b) (sup (-a+b) (a + (-b))))" (is "_=sup ?m ?n") |
1262 qed |
1263 by (simp add: abs_lattice add_sup_inf_distribs sup_ACI diff_minus) |
|
1264 have a:"a+b <= sup ?m ?n" by (simp) |
|
1265 have b:"-a-b <= ?n" by (simp) |
|
1266 have c:"?n <= sup ?m ?n" by (simp) |
|
1267 from b c have d: "-a-b <= sup ?m ?n" by(rule order_trans) |
|
1268 have e:"-a-b = -(a+b)" by (simp add: diff_minus) |
|
1269 from a d e have "abs(a+b) <= sup ?m ?n" |
|
1270 by (drule_tac abs_leI, auto) |
|
1271 with g[symmetric] show ?thesis by simp |
|
1272 qed |
|
1273 qed auto |
|
1274 qed |
1263 qed |
1275 |
1264 |
1276 end |
1265 end |
1277 |
1266 |
1278 lemma sup_eq_if: |
1267 lemma sup_eq_if: |