Theory Abstract_Consistency_Property
chapter ‹Abstract Consistency Properties›
theory Abstract_Consistency_Property imports
"HOL-Cardinals.Cardinal_Order_Relation"
begin
section ‹Utility›
lemma Set_Diff_Un: ‹X - (Y ∪ Z) = X - Y - Z›
by blast
lemma infinite_diff_finite: ‹finite A ⟹ infinite (- B) ⟹ infinite (- (A ∪ B))›
by (metis Compl_Diff_eq double_complement finite_Diff2 sup_commute)
lemma infinite_Diff_fin_Un: ‹infinite (X - Y) ⟹ finite Z ⟹ infinite (X - (Z ∪ Y))›
by (simp add: Set_Diff_Un Un_commute)
lemma infinite_Diff_subset: ‹infinite (X - A) ⟹ B ⊆ A ⟹ infinite (X - B)›
by (meson Diff_cancel Diff_eq_empty_iff Diff_mono infinite_super)
lemma finite_bound:
fixes X :: ‹('a :: size) set›
assumes ‹finite X› ‹X ≠ {}›
shows ‹∃x ∈ X. ∀y ∈ X. size y ≤ size x›
using assms by (induct X rule: finite_induct) force+
lemma infinite_UNIV_size:
fixes f :: ‹('a :: size) ⇒ 'a›
assumes ‹⋀x. size x < size (f x)›
shows ‹infinite (UNIV :: 'a set)›
proof
assume ‹finite (UNIV :: 'a set)›
then obtain x :: 'a where ‹∀y :: 'a. size y ≤ size x›
using finite_bound by fastforce
moreover have ‹size x < size (f x)›
using assms .
ultimately show False
using leD by blast
qed
lemma infinite_left: ‹finite C ⟹ infinite A ⟹ |A| ≤o |- B| ⟹ |A| ≤o |- (C ∪ B)|›
by (metis (no_types, opaque_lifting) Compl_Diff_eq card_of_infinite_diff_finite card_of_ordLeq_finite
double_complement ordIso_iff_ordLeq ordLeq_transitive sup_commute)
lemma card_of_infinite_smaller_Union:
assumes ‹∀x. |f x| <o |X|› ‹infinite X›
shows ‹|⋃x ∈ X. f x| ≤o |X|›
using assms by (metis (full_types) Field_card_of card_of_UNION_ordLeq_infinite
card_of_well_order_on ordLeq_iff_ordLess_or_ordIso ordLess_or_ordLeq)
context wo_rel
begin
lemma underS_bound: ‹a ∈ underS c ⟹ b ∈ underS c ⟹ a ∈ under b ∨ b ∈ under a›
by (meson BNF_Least_Fixpoint.underS_Field REFL Refl_under_in in_mono under_ofilter ofilter_linord)
lemma finite_underS_bound:
assumes ‹finite X› ‹X ⊆ underS a› ‹X ≠ {}›
shows ‹∃a ∈ X. ∀b ∈ X. b ∈ under a›
using assms
proof (induct X rule: finite_induct)
case (insert x F)
then show ?case
proof (cases ‹F = {}›)
case True
then show ?thesis
using insert underS_bound by fast
next
case False
then show ?thesis
using insert underS_bound by (metis TRANS insert_absorb insert_iff insert_subset under_trans)
qed
qed simp
lemma finite_bound_under:
assumes ‹finite p› ‹p ⊆ (⋃a ∈ Field r. f a)›
shows ‹∃b. p ⊆ (⋃a ∈ under b. f a)›
using assms
proof (induct rule: finite_induct)
case (insert x p)
then obtain b where ‹p ⊆ (⋃a ∈ under b. f a)›
by fast
moreover obtain b' where ‹x ∈ f b'› ‹b' ∈ Field r›
using insert(4) by blast
then have ‹x ∈ (⋃a ∈ under b'. f a)›
using REFL Refl_under_in by fast
ultimately have ‹{x} ∪ p ⊆ (⋃a ∈ under b. f a) ∪ (⋃a ∈ under b'. f a)›
by fast
then show ?case
by (metis SUP_union Un_commute insert_is_Un sup.absorb_iff2 ofilter_linord under_ofilter)
qed simp
lemma underS_trans: ‹a ∈ underS b ⟹ b ∈ underS c ⟹ a ∈ underS c›
by (meson ANTISYM TRANS underS_underS_trans)
definition is_chain :: ‹('a ⇒ 'a set) ⇒ bool› where
‹is_chain f ≡ ∀a ∈ Field r. ∀b ∈ Field r. b ∈ under a ⟶ f b ⊆ f a›
lemma is_chainD: ‹is_chain f ⟹ b ∈ under a ⟹ x ∈ f b ⟹ x ∈ f a›
unfolding is_chain_def by (metis equals0D subsetD under_Field under_empty)
lemma chain_index:
assumes ch: ‹is_chain f› and fin: ‹finite F› and ne: ‹Field r ≠ {}›
shows ‹F ⊆ (⋃a ∈ Field r. f a) ⟹ ∃a ∈ Field r. F ⊆ f a›
using fin
proof (induct rule: finite_induct)
case empty
then show ?case
using ne by blast
next
case (insert x F)
then have ‹∃a ∈ Field r. F ⊆ f a› ‹∃b ∈ Field r. x ∈ f b› ‹F ⊆ (⋃x ∈ Field r. f x)›
using ch by simp_all
then obtain a and b where f: ‹F ⊆ f a› ‹x ∈ f b› and nm: ‹a ∈ Field r› ‹b ∈ Field r›
by blast
have ‹b ∈ under (max2 a b)› ‹a ∈ under (max2 a b)›
using nm by (meson REFL Refl_under_in TRANS max2_greater_among subset_iff under_incl_iff)+
have ‹x ∈ f (max2 a b)›
using is_chainD ch ‹b ∈ under (max2 a b)› f(2) by blast
moreover have ‹F ⊆ f (max2 a b)›
using is_chainD ch ‹a ∈ local.under (max2 a b)› f(1) by blast
ultimately show ?case
using nm unfolding max2_def by auto
qed
end
section ‹Finite Character›
definition close :: ‹'a set set ⇒ 'a set set› where
‹close C ≡ {S. (∃S' ∈ C. S ⊆ S')}›
definition subset_closed :: ‹'a set set ⇒ bool› where
‹subset_closed C ≡ ∀S' ∈ C. ∀S ⊆ S'. S ∈ C›
lemma subset_in_close: ‹S ⊆ S' ⟹ x ∪ S' ∈ C ⟹ x ∪ S ∈ close C›
unfolding close_def by blast
lemma close_closed: ‹subset_closed (close C)›
unfolding close_def subset_closed_def by blast
lemma close_subset: ‹C ⊆ close C›
unfolding close_def by blast
definition finite_char :: ‹'a set set ⇒ bool› where
‹finite_char C ≡ ∀S. S ∈ C ⟷ (∀S' ⊆ S. finite S' ⟶ S' ∈ C)›
definition mk_finite_char :: ‹'a set set ⇒ 'a set set› where
‹mk_finite_char C ≡ {S. (∀S' ⊆ S. finite S' ⟶ S' ∈ C)}›
lemma finite_char: ‹finite_char (mk_finite_char C)›
unfolding finite_char_def mk_finite_char_def by blast
lemma finite_char_closed: ‹finite_char C ⟹ subset_closed C›
unfolding finite_char_def subset_closed_def by (meson order_trans)
lemma finite_char_subset: ‹subset_closed C ⟹ C ⊆ mk_finite_char C›
unfolding mk_finite_char_def subset_closed_def by blast
lemma (in wo_rel) chain_union_closed:
assumes ‹finite_char C› ‹is_chain f› ‹∀a ∈ Field r. f a ∈ C› ‹Field r ≠ {}›
shows ‹(⋃a ∈ Field r. f a) ∈ C›
using assms chain_index unfolding finite_char_def by metis
definition maximal :: ‹'a set set ⇒ 'a set ⇒ bool› where
‹maximal C S ⟷ (∀S' ∈ C. S ⊆ S' ⟶ S = S')›
section ‹Consistency Properties›
locale Params =
fixes map_fm :: ‹('x ⇒ 'x) ⇒ 'fm ⇒ 'fm›
and params_fm :: ‹'fm ⇒ 'x set›
and is_param :: ‹'x ⇒ bool›
assumes map_fm_id: ‹map_fm id = id›
and finite_params_fm [simp]: ‹⋀p. finite (params_fm p)›
and map_params_fm: ‹⋀f g p. (∀x ∈ params_fm p. f x = g x) ⟹ map_fm f p = map_fm g p›
begin
definition is_subst :: ‹('x ⇒ 'x) ⇒ bool› where
‹is_subst f ≡ ∀x. is_param x ⟷ is_param (f x)›
lemma is_subst_id [intro]: ‹is_subst id›
unfolding is_subst_def by simp
definition mk_alt_consistency :: ‹'fm set set ⇒ 'fm set set› where
‹mk_alt_consistency C ≡ {S. (∃f. is_subst f ∧ map_fm f ` S ∈ C)}›
lemma mk_alt_consistency_subset: ‹C ⊆ mk_alt_consistency C›
unfolding mk_alt_consistency_def
proof
fix x
assume ‹x ∈ C›
then have ‹map_fm id ` x ∈ C›
using map_fm_id by simp
then have ‹∃f. is_subst f ∧ map_fm f ` x ∈ C›
by blast
then show ‹x ∈ {S. ∃f. is_subst f ∧ map_fm f ` S ∈ C}›
by blast
qed
lemma mk_alt_consistency_closed:
assumes ‹subset_closed C›
shows ‹subset_closed (mk_alt_consistency C)›
unfolding subset_closed_def mk_alt_consistency_def
proof safe
fix S S' f
assume ‹is_subst f› ‹map_fm f ` S' ∈ C› ‹S ⊆ S'›
moreover have ‹map_fm f ` S ⊆ map_fm f ` S'›
using ‹S ⊆ S'› by blast
moreover have ‹∀S' ∈ C. ∀S ⊆ S'. S ∈ C›
using ‹subset_closed C› unfolding subset_closed_def by blast
ultimately show ‹∃f. is_subst f ∧ map_fm f ` S ∈ C›
by blast
qed
abbreviation params :: ‹'fm set ⇒ 'x set› where
‹params S ≡ ⋃p ∈ S. params_fm p›
lemma infinite_params: ‹infinite (U - params B) ⟹ infinite (U - params (set ps ∪ B))›
using finite_params_fm by (metis List.finite_set UN_Un finite_UN_I infinite_Diff_fin_Un)
lemma infinite_params_left:
assumes ‹infinite A› ‹|A| ≤o |U - params S|›
shows ‹|A| ≤o |U - params (set ps ∪ S)|›
proof -
have ‹infinite (U - params S)›
using assms card_of_ordLeq_infinite by blast
then have ‹|U - params S| =o |U - params (set ps ∪ S)|›
by (simp add: Set_Diff_Un Un_commute card_of_infinite_diff_finite ordIso_symmetric)
then show ?thesis
using assms(2) ordLeq_ordIso_trans by blast
qed
definition enough_new :: ‹'fm set ⇒ bool› where
‹enough_new S ≡ |UNIV :: 'fm set| ≤o |Collect is_param - params S|›
lemma enough_new_countable:
assumes ‹∃to_nat :: 'fm ⇒ nat. inj to_nat› ‹infinite (Collect is_param - params S)›
shows ‹enough_new S›
unfolding enough_new_def using assms
by (meson UNIV_I card_of_ordLeqI infinite_iff_card_of_nat ordLeq_transitive)
lemma enough_new_all_param:
assumes ‹|UNIV :: 'fm set| ≤o |UNIV - params S|› ‹⋀x. is_param x›
shows ‹enough_new S›
unfolding enough_new_def using assms by (simp add: Collect_cong)
end