390 "(\<Squnion>b. A b) = A True \<squnion> A False" |
390 "(\<Squnion>b. A b) = A True \<squnion> A False" |
391 by (simp add: UNIV_bool SUP_empty SUP_insert sup_commute) |
391 by (simp add: UNIV_bool SUP_empty SUP_insert sup_commute) |
392 |
392 |
393 end |
393 end |
394 |
394 |
395 class complete_boolean_algebra = boolean_algebra + complete_lattice |
395 class complete_distrib_lattice = complete_lattice + |
|
396 assumes inf_Sup: "a \<sqinter> \<Squnion>B = (\<Squnion>b\<in>B. a \<sqinter> b)" |
|
397 assumes sup_Inf: "a \<squnion> \<Sqinter>B = (\<Sqinter>b\<in>B. a \<squnion> b)" |
|
398 begin |
|
399 |
|
400 (*lemma dual_complete_distrib_lattice: |
|
401 "class.complete_distrib_lattice Sup Inf (op \<ge>) (op >) sup inf \<top> \<bottom>" |
|
402 apply (rule class.complete_distrib_lattice.intro) |
|
403 apply (fact dual_complete_lattice) |
|
404 apply (rule class.complete_distrib_lattice_axioms.intro) |
|
405 apply (simp_all add: inf_Sup sup_Inf)*) |
|
406 |
|
407 subclass distrib_lattice proof -- {* Question: is it sufficient to include @{class distrib_lattice} |
|
408 and proof @{fact inf_Sup} and @{fact sup_Inf} from that? *} |
|
409 fix a b c |
|
410 from sup_Inf have "a \<squnion> \<Sqinter>{b, c} = (\<Sqinter>d\<in>{b, c}. a \<squnion> d)" . |
|
411 then show "a \<squnion> b \<sqinter> c = (a \<squnion> b) \<sqinter> (a \<squnion> c)" by (simp add: INF_def Inf_binary) |
|
412 qed |
|
413 |
|
414 end |
|
415 |
|
416 class complete_boolean_algebra = boolean_algebra + complete_lattice -- {* Question: is this |
|
417 also a @{class complete_distrib_lattice}? *} |
396 begin |
418 begin |
397 |
419 |
398 lemma dual_complete_boolean_algebra: |
420 lemma dual_complete_boolean_algebra: |
399 "class.complete_boolean_algebra Sup Inf (op \<ge>) (op >) sup inf \<top> \<bottom> (\<lambda>x y. x \<squnion> - y) uminus" |
421 "class.complete_boolean_algebra Sup Inf (op \<ge>) (op >) sup inf \<top> \<bottom> (\<lambda>x y. x \<squnion> - y) uminus" |
400 by (rule class.complete_boolean_algebra.intro, rule dual_complete_lattice, rule dual_boolean_algebra) |
422 by (rule class.complete_boolean_algebra.intro, rule dual_complete_lattice, rule dual_boolean_algebra) |
519 fix P :: "'a \<Rightarrow> bool" |
541 fix P :: "'a \<Rightarrow> bool" |
520 show "(\<Squnion>x\<in>A. P x) \<longleftrightarrow> (\<exists>x\<in>A. P x)" |
542 show "(\<Squnion>x\<in>A. P x) \<longleftrightarrow> (\<exists>x\<in>A. P x)" |
521 by (auto simp add: Bex_def SUP_def Sup_bool_def) |
543 by (auto simp add: Bex_def SUP_def Sup_bool_def) |
522 qed |
544 qed |
523 |
545 |
|
546 instance bool :: "{complete_distrib_lattice, complete_boolean_algebra}" proof |
|
547 qed (auto simp add: Inf_bool_def Sup_bool_def) |
|
548 |
524 instantiation "fun" :: (type, complete_lattice) complete_lattice |
549 instantiation "fun" :: (type, complete_lattice) complete_lattice |
525 begin |
550 begin |
526 |
551 |
527 definition |
552 definition |
528 "\<Sqinter>A = (\<lambda>x. \<Sqinter>{y. \<exists>f\<in>A. y = f x})" |
553 "\<Sqinter>A = (\<lambda>x. \<Sqinter>f\<in>A. f x)" |
529 |
554 |
530 lemma Inf_apply: |
555 lemma Inf_apply: |
531 "(\<Sqinter>A) x = \<Sqinter>{y. \<exists>f\<in>A. y = f x}" |
556 "(\<Sqinter>A) x = (\<Sqinter>f\<in>A. f x)" |
532 by (simp add: Inf_fun_def) |
557 by (simp add: Inf_fun_def) |
533 |
558 |
534 definition |
559 definition |
535 "\<Squnion>A = (\<lambda>x. \<Squnion>{y. \<exists>f\<in>A. y = f x})" |
560 "\<Squnion>A = (\<lambda>x. \<Squnion>f\<in>A. f x)" |
536 |
561 |
537 lemma Sup_apply: |
562 lemma Sup_apply: |
538 "(\<Squnion>A) x = \<Squnion>{y. \<exists>f\<in>A. y = f x}" |
563 "(\<Squnion>A) x = (\<Squnion>f\<in>A. f x)" |
539 by (simp add: Sup_fun_def) |
564 by (simp add: Sup_fun_def) |
540 |
565 |
541 instance proof |
566 instance proof |
542 qed (auto simp add: le_fun_def Inf_apply Sup_apply |
567 qed (auto simp add: le_fun_def Inf_apply Sup_apply intro: INF_leI le_SUP_I le_INF_I SUP_leI) |
543 intro: Inf_lower Sup_upper Inf_greatest Sup_least) |
|
544 |
568 |
545 end |
569 end |
546 |
570 |
547 lemma INF_apply: |
571 lemma INF_apply: |
548 "(\<Sqinter>y\<in>A. f y) x = (\<Sqinter>y\<in>A. f y x)" |
572 "(\<Sqinter>y\<in>A. f y) x = (\<Sqinter>y\<in>A. f y x)" |
549 by (auto intro: arg_cong [of _ _ Inf] simp add: INF_def Inf_apply) |
573 by (auto intro: arg_cong [of _ _ Inf] simp add: INF_def Inf_apply) |
550 |
574 |
551 lemma SUP_apply: |
575 lemma SUP_apply: |
552 "(\<Squnion>y\<in>A. f y) x = (\<Squnion>y\<in>A. f y x)" |
576 "(\<Squnion>y\<in>A. f y) x = (\<Squnion>y\<in>A. f y x)" |
553 by (auto intro: arg_cong [of _ _ Sup] simp add: SUP_def Sup_apply) |
577 by (auto intro: arg_cong [of _ _ Sup] simp add: SUP_def Sup_apply) |
|
578 |
|
579 instance "fun" :: (type, complete_distrib_lattice) complete_distrib_lattice proof |
|
580 qed (auto simp add: inf_apply sup_apply Inf_apply Sup_apply INF_def SUP_def inf_Sup sup_Inf image_image) |
554 |
581 |
555 instance "fun" :: (type, complete_boolean_algebra) complete_boolean_algebra .. |
582 instance "fun" :: (type, complete_boolean_algebra) complete_boolean_algebra .. |
556 |
583 |
557 |
584 |
558 subsection {* Inter *} |
585 subsection {* Inter *} |