section‹Defining algebraic domains by ideal completion›
theory Completion imports Cfun begin
subsection‹Ideals over a preorder›
locale preorder = fixes r :: "'a::type → 'a → bool" (infix‹⪯›50) assumes r_refl: "x ⪯ x" assumes r_trans: "[x ⪯ y; y ⪯ z]==> x ⪯ z" begin
definition
ideal :: "'a set → bool"where "ideal A = ((∃x. x ∈ A) ∧ (∀x∈A. ∀y∈A. ∃z∈A. x ⪯ z ∧ y ⪯ z) ∧ (∀x y. x ⪯ y ⟶ y ∈ A ⟶ x ∈ A))"
lemma idealI: assumes"∃x. x ∈ A" assumes"∧x y. [x ∈ A; y ∈ A]==>∃z∈A. x ⪯ z ∧ y ⪯ z" assumes"∧x y. [x ⪯ y; y ∈ A]==> x ∈ A" shows"ideal A" unfolding ideal_def using assms by fast
lemma idealD1: "ideal A ==>∃x. x ∈ A" unfolding ideal_def by fast
lemma idealD2: "[ideal A; x ∈ A; y ∈ A]==>∃z∈A. x ⪯ z ∧ y ⪯ z" unfolding ideal_def by fast
lemma idealD3: "[ideal A; x ⪯ y; y ∈ A]==> x ∈ A" unfolding ideal_def by fast
lemma extension_lemma: fixes f :: "'a::type → 'c" assumes f_mono: "∧a b. a ⪯ b ==> f a ⊑ f b" shows"∃u. f ` rep x <<| u" proof - obtain Y where Y: "∀i. Y i ⪯ Y (Suc i)" and x: "x = (⊔i. principal (Y i))" by (rule obtain_principal_chain [of x]) have chain: "chain (λi. f (Y i))" by (rule chainI, simp add: f_mono Y) have rep_x: "rep x = (∪n. {a. a ⪯ Y n})" by (simp add: x rep_lub Y rep_principal) have"f ` rep x <<| (⊔n. f (Y n))" apply (rule is_lubI) apply (rule ub_imageI) subgoalfor a apply (clarsimp simp add: rep_x) apply (drule f_mono) apply (erule below_lub [OF chain]) done apply (rule lub_below [OF chain]) subgoalfor… n apply (drule ub_imageD [where x="Y n"]) apply (simp add: rep_x, fast intro: r_refl) apply assumption done done thenshow ?thesis .. qed
lemma extension_beta: fixes f :: "'a::type → 'c" assumes f_mono: "∧a b. a ⪯ b ==> f a ⊑ f b" shows"extension f⋅x = lub (f ` rep x)" unfolding extension_def proof (rule beta_cfun) have lub: "∧x. ∃u. f ` rep x <<| u" using f_mono by (rule extension_lemma) show cont: "cont (λx. lub (f ` rep x))" apply (rule contI2) apply (rule monofunI) apply (rule is_lub_thelub_ex [OF lub ub_imageI]) apply (rule is_ub_thelub_ex [OF lub imageI]) apply (erule (1) subsetD [OF rep_mono]) apply (rule is_lub_thelub_ex [OF lub ub_imageI]) apply (simp add: rep_lub, clarify) apply (erule rev_below_trans [OF is_ub_thelub]) apply (erule is_ub_thelub_ex [OF lub imageI]) done qed
lemma extension_principal: fixes f :: "'a::type → 'c" assumes f_mono: "∧a b. a ⪯ b ==> f a ⊑ f b" shows"extension f⋅(principal a) = f a" apply (subst extension_beta, erule f_mono) apply (subst rep_principal) apply (rule lub_eqI) apply (rule is_lub_maximal) apply (rule ub_imageI) apply (simp add: f_mono) apply (rule imageI) apply (simp add: r_refl) done
lemma extension_mono: assumes f_mono: "∧a b. a ⪯ b ==> f a ⊑ f b" assumes g_mono: "∧a b. a ⪯ b ==> g a ⊑ g b" assumes below: "∧a. f a ⊑ g a" shows"extension f ⊑ extension g" apply (rule cfun_belowI) apply (simp only: extension_beta f_mono g_mono) apply (rule is_lub_thelub_ex) apply (rule extension_lemma, erule f_mono) apply (rule ub_imageI) subgoalfor x a apply (rule below_trans [OF below]) apply (rule is_ub_thelub_ex) apply (rule extension_lemma, erule g_mono) apply (erule imageI) done done
lemma cont_extension: assumes f_mono: "∧a b x. a ⪯ b ==> f x a ⊑ f x b" assumes f_cont: "∧a. cont (λx. f x a)" shows"cont (λx. extension (λa. f x a))" apply (rule contI2) apply (rule monofunI) apply (rule extension_mono, erule f_mono, erule f_mono) apply (erule cont2monofunE [OF f_cont]) apply (rule cfun_belowI) apply (rule principal_induct, simp) apply (simp only: contlub_cfun_fun) apply (simp only: extension_principal f_mono) apply (simp add: cont2contlubE [OF f_cont]) done
end
lemma (in preorder) typedef_ideal_completion: fixes Abs :: "'a set → 'b" assumes type: "type_definition Rep Abs {S. ideal S}" assumes below: "∧x y. x ⊑ y ⟷ Rep x ⊆ Rep y" assumes principal: "∧a. principal a = Abs {b. b ⪯ a}" assumes countable: "∃f::'a → nat. inj f" shows"ideal_completion r principal Rep" proof interpret type_definition Rep Abs "{S. ideal S}"by fact fix a b :: 'a and x y :: 'b and Y :: "nat → 'b" show"ideal (Rep x)" using Rep [of x] by simp show"chain Y ==> Rep (⊔i. Y i) = (∪i. Rep (Y i))" using type below by (rule typedef_ideal_rep_lub) show"Rep (principal a) = {b. b ⪯ a}" by (simp add: principal Abs_inverse ideal_principal) show"Rep x ⊆ Rep y ==> x ⊑ y" by (simp only: below) show"∃f::'a → nat. inj f" by (rule countable) qed
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.