Theory Reduced_MLSS_Formula_Singleton_Model_Property

theory Reduced_MLSS_Formula_Singleton_Model_Property
  imports Syntactic_Description Place_Realisation MLSSmf_to_MLSS
begin

locale satisfiable_normalized_MLSS_clause_with_vars_for_proper_Venn_regions =
  satisfiable_normalized_MLSS_clause π’ž π’œ for π’ž π’œ +
    fixes U :: "'a set"
    ―‹The collection of variables representing
       the proper Venn regions of the "original" variable set of the MLSSmf clauseβ€Ί
  assumes U_subset_V: "U βŠ† V"
      and no_overlap_within_U: "⟦u1 ∈ U; u2 ∈ U; u1 β‰  u2⟧ ⟹ π’œ u1 βŠ“ π’œ u2 = 0"
      and U_collect_places_neq: "AF (Var x =s Var y) ∈ π’ž ⟹
          βˆƒL M. L βŠ† U ∧ M βŠ† U ∧ π’œ x = ⨆HF (π’œ ` L) ∧ π’œ y = ⨆HF (π’œ ` M)"
      and U_collect_places_single: "AT (Var x =s Single (Var y)) ∈ π’ž ⟹
          βˆƒL M. L βŠ† U ∧ M βŠ† U ∧ π’œ x = ⨆HF (π’œ ` L) ∧ π’œ y = ⨆HF (π’œ ` M)"
begin

interpretation 𝔅: adequate_place_framework π’ž PI atp
  using syntactic_description_is_adequate by blast

lemma fact_1:
  assumes "u1 ∈ U"
      and "u2 ∈ U"
      and "u1 β‰  u2"
      and "Ο€ ∈ PI"
    shows "Β¬ (Ο€ u1 ∧ Ο€ u2)"
proof (rule ccontr)
  assume "Β¬ Β¬ (Ο€ u1 ∧ Ο€ u2)"
  then have "Ο€ u1" "Ο€ u2" by blast+
  from β€ΉΟ€ ∈ PIβ€Ί obtain Οƒ where "Οƒ ∈ Ξ£" "Ο€ = Ο€β‡˜Οƒβ‡™" by auto
  then have "Οƒ β‰  0" by fastforce
  from β€ΉΟ€ = Ο€β‡˜Οƒβ‡™β€Ί β€ΉΟ€ u1β€Ί β€ΉΟ€ u2β€Ί have "Οƒ ≀ π’œ u1" "Οƒ ≀ π’œ u2" by simp+
  with β€ΉΟƒ β‰  0β€Ί have "π’œ u1 βŠ“ π’œ u2 β‰  0" by blast
  with no_overlap_within_U show False
    using β€Ήu1 ∈ Uβ€Ί β€Ήu2 ∈ Uβ€Ί β€Ήu1 β‰  u2β€Ί by blast
qed

fun place_eq :: "('a β‡’ bool) β‡’ ('a β‡’ bool) β‡’ bool" where
  "place_eq Ο€1 Ο€2 ⟷ (βˆ€x ∈ V. Ο€1 x = Ο€2 x)"

fun place_sim :: "('a β‡’ bool) β‡’ ('a β‡’ bool) β‡’ bool" (infixl "∼" 50) where
  "place_sim Ο€1 Ο€2 ⟷ place_eq Ο€1 Ο€2 ∨ (βˆƒu ∈ U. Ο€1 u ∧ Ο€2 u)"

abbreviation "rel_place_sim ≑ {(Ο€1, Ο€2) ∈ PI Γ— PI. Ο€1 ∼ Ο€2}"

lemma place_sim_rel_equiv_on_PI: "equiv PI rel_place_sim"
proof (rule equivI)
  have "rel_place_sim βŠ† PI Γ— PI" by blast
  moreover
  have "(Ο€, Ο€) ∈ rel_place_sim" if "Ο€ ∈ PI" for Ο€
    using that by fastforce
  ultimately
  show "refl_on PI rel_place_sim" using refl_onI by blast
  
  show "sym rel_place_sim"
  proof (rule symI)
    fix Ο€1 Ο€2 assume "(Ο€1, Ο€2) ∈ rel_place_sim"
    then have "Ο€1 ∈ PI" "Ο€2 ∈ PI" "Ο€1 ∼ Ο€2" by blast+
    then show "(Ο€2, Ο€1) ∈ rel_place_sim" by auto
  qed
  
  show "trans rel_place_sim"
  proof (rule transI)
    fix Ο€1 Ο€2 Ο€3
    assume "(Ο€1, Ο€2) ∈ rel_place_sim" "(Ο€2, Ο€3) ∈ rel_place_sim"
    then have "Ο€1 ∈ PI" "Ο€2 ∈ PI" "Ο€3 ∈ PI" "Ο€1 ∼ Ο€2" "Ο€2 ∼ Ο€3" by blast+
    then consider "place_eq Ο€1 Ο€2 ∧ place_eq Ο€2 Ο€3" | "place_eq Ο€1 Ο€2 ∧ (βˆƒu ∈ U. Ο€2 u ∧ Ο€3 u)"
      | "(βˆƒu ∈ U. Ο€1 u ∧ Ο€2 u) ∧ place_eq Ο€2 Ο€3" | "(βˆƒu ∈ U. Ο€1 u ∧ Ο€2 u) ∧ (βˆƒu ∈ U. Ο€2 u ∧ Ο€3 u)"
      by auto
    then have "Ο€1 ∼ Ο€3"
    proof (cases)
      case 1
      then have "place_eq Ο€1 Ο€3" by auto
      then show ?thesis by auto
    next
      case 2
      then obtain u where "u ∈ U" "Ο€2 u" "Ο€3 u" by blast
      with U_subset_V have "u ∈ V" by blast
      with 2 have "Ο€1 u ⟷ Ο€2 u" by force
      with β€ΉΟ€2 uβ€Ί have "Ο€1 u" by blast
      with β€Ήu ∈ Uβ€Ί β€ΉΟ€3 uβ€Ί
      show ?thesis by auto
    next
      case 3
      then obtain u where "u ∈ U" "Ο€1 u" "Ο€2 u" by blast
      with U_subset_V have "u ∈ V" by blast
      with 3 have "Ο€2 u ⟷ Ο€3 u" by force
      with β€ΉΟ€2 uβ€Ί have "Ο€3 u" by blast
      with β€Ήu ∈ Uβ€Ί β€ΉΟ€1 uβ€Ί
      show ?thesis by auto
    next
      case 4
      then obtain u1 u2 where "u1 ∈ U" "Ο€1 u1" "Ο€2 u1" and "u2 ∈ U" "Ο€2 u2" "Ο€3 u2"
        by blast
      with fact_1 have "u1 = u2"
        using β€ΉΟ€2 ∈ PIβ€Ί by blast
      with β€ΉΟ€3 u2β€Ί have "Ο€3 u1" by blast
      with β€ΉΟ€1 u1β€Ί β€Ήu1 ∈ Uβ€Ί show ?thesis
        by auto
    qed
    with β€ΉΟ€1 ∈ PIβ€Ί β€ΉΟ€2 ∈ PIβ€Ί β€ΉΟ€3 ∈ PIβ€Ί
    show "(Ο€1, Ο€3) ∈ rel_place_sim" by blast
  qed
qed

lemma refl_sim:
  assumes "a ∈ PI"
      and "b ∈ PI"
      and "a ∼ b"
    shows "b ∼ a"
  using assms by auto

lemma trans_sim:
  assumes "a ∈ PI"
      and "b ∈ PI"
      and "c ∈ PI"
      and "a ∼ b"
      and "b ∼ c"
    shows "a ∼ c"
proof -
  from assms have "(a, b) ∈ rel_place_sim" "(b, c) ∈ rel_place_sim"
    by blast+
  with place_sim_rel_equiv_on_PI have "(a, c) ∈ rel_place_sim"
    using equivE transE
    by (smt (verit, ccfv_SIG))
  then show "a ∼ c" by blast
qed

lemma fact_2:
  assumes "x ∈ V"
      and exL: "βˆƒL βŠ† U. π’œ x = ⨆HF (π’œ ` L)"
      and "Ο€1 ∈ PI"
      and "Ο€2 ∈ PI"
      and "Ο€1 ∼ Ο€2"
    shows "Ο€1 x ⟷ Ο€2 x"
proof (cases "place_eq Ο€1 Ο€2")
  case True
  with β€Ήx ∈ Vβ€Ί show ?thesis by force
next
  case False
  with β€ΉΟ€1 ∼ Ο€2β€Ί obtain u where "u ∈ U" "Ο€1 u" "Ο€2 u" by auto
  from exL obtain L where "L βŠ† U" "π’œ x = ⨆HF (π’œ ` L)" by blast
  from β€ΉL βŠ† Uβ€Ί U_subset_V finite_V have "finite L"
    by (simp add: finite_subset)

  have "Ο€ x ⟷ u ∈ L" if "Ο€ u" "Ο€ ∈ PI" for Ο€
  proof -
    from β€ΉΟ€ ∈ PIβ€Ί obtain Οƒ where "Ο€ = Ο€β‡˜Οƒβ‡™" "Οƒ ∈ Ξ£" by auto
    with β€ΉΟ€ uβ€Ί have "Οƒ ≀ π’œ u"
      using β€Ήu ∈ Uβ€Ί U_subset_V by auto
    have "Οƒ ≀ π’œ x ⟷ u ∈ L"
    proof (standard)
      assume "Οƒ ≀ π’œ x"
      {assume "u βˆ‰ L"
        then have "βˆ€v ∈ L. v β‰  u" by blast
        with no_overlap_within_U have "βˆ€v ∈ L. π’œ v βŠ“ π’œ u = 0"
          using β€ΉL βŠ† Uβ€Ί β€Ήu ∈ Uβ€Ί by auto
        with β€ΉΟƒ ≀ π’œ uβ€Ί have "βˆ€v ∈ L. π’œ v βŠ“ Οƒ = 0" by blast
        then have "⨆HF (π’œ ` L) βŠ“ Οƒ = 0"
          using finite_V U_subset_V β€ΉL βŠ† Uβ€Ί by auto
        with β€Ήπ’œ x = ⨆HF (π’œ ` L)β€Ί have "π’œ x βŠ“ Οƒ = 0" by argo
        with β€ΉΟƒ ≀ π’œ xβ€Ί have False
          using β€ΉΟƒ ∈ Ξ£β€Ί mem_Ξ£_not_empty by blast
      }
      then show "u ∈ L" by blast
    next
      assume "u ∈ L"
      with β€ΉΟƒ ≀ π’œ uβ€Ί have "Οƒ ≀ ⨆HF (π’œ ` L)"
        using β€Ήfinite Lβ€Ί by force
      with β€Ήπ’œ x = ⨆HF (π’œ ` L)β€Ί show "Οƒ ≀ π’œ x" by simp
    qed
    with β€ΉΟ€ = Ο€β‡˜Οƒβ‡™β€Ί show "Ο€ x ⟷ u ∈ L"
      using β€Ήx ∈ Vβ€Ί associated_place.simps by blast
  qed
  with β€ΉΟ€1 ∈ PIβ€Ί β€ΉΟ€1 uβ€Ί β€ΉΟ€2 ∈ PIβ€Ί β€ΉΟ€2 uβ€Ί
  have "Ο€1 x ⟷ u ∈ L" "Ο€2 x ⟷ u ∈ L" by blast+
  then show ?thesis by blast
qed

lemma U_collect_places_single': "y ∈ W ⟹ βˆƒL. L βŠ† U ∧ π’œ y = ⨆HF (π’œ ` L)"
  using U_collect_places_single
  by (meson memW_E)

definition PI' :: "('a β‡’ bool) set" where
  "PI' ≑ (λπs. SOME Ο€. Ο€ ∈ Ο€s) ` (PI // rel_place_sim)"

definition rep :: "('a β‡’ bool) β‡’ ('a β‡’ bool)" where
  "rep Ο€ = (SOME Ο€'. Ο€' ∈ rel_place_sim `` {Ο€})"

lemma range_rep:
  assumes "Ο€ ∈ PI"
    shows "rep Ο€ ∈ PI'"
  using assms
  unfolding PI'_def rep_def
  using quotientI[where ?x = Ο€ and ?A = PI and ?r = rel_place_sim]
  by blast

lemma PI'_eq_image_of_rep_on_PI: "PI' = rep ` PI"
proof (standard; standard)
  fix Ο€ assume "Ο€ ∈ PI'"
  then obtain Ο€s where "Ο€s ∈ PI // rel_place_sim" "Ο€ = (SOME Ο€. Ο€ ∈ Ο€s)"
    unfolding PI'_def by blast
  then obtain Ο€0 where "Ο€s = rel_place_sim `` {Ο€0}" "Ο€0 ∈ PI"
    using quotientE[where ?A = PI and ?r = rel_place_sim and ?X = Ο€s]
    by blast
  with β€ΉΟ€ = (SOME Ο€. Ο€ ∈ Ο€s)β€Ί have "Ο€ = rep Ο€0"
    unfolding rep_def by blast
 with β€ΉΟ€0 ∈ PIβ€Ί show "Ο€ ∈ rep ` PI" by blast
next
  fix Ο€ assume "Ο€ ∈ rep ` PI"
  then obtain Ο€0 where "Ο€0 ∈ PI" "Ο€ = rep Ο€0" by blast
  then show "Ο€ ∈ PI'" using range_rep by blast
qed

lemma rep_sim:
  assumes "Ο€ ∈ PI"
    shows "Ο€ ∼ rep Ο€"
      and "rep Ο€ ∼ Ο€"
proof -
  from β€ΉΟ€ ∈ PIβ€Ί have "Ο€ ∈ rel_place_sim `` {Ο€}" by fastforce
  then obtain Ο€' where "Ο€' = rep Ο€" by blast
  with someI[of "Ξ»x. x ∈ rel_place_sim `` {Ο€}"] have "Ο€' ∈ rel_place_sim `` {Ο€}"
    using β€ΉΟ€ ∈ rel_place_sim `` {Ο€}β€Ί
    unfolding rep_def by fast
  with β€ΉΟ€' = rep Ο€β€Ί show "Ο€ ∼ rep Ο€" by fast
  with place_sim_rel_equiv_on_PI show "rep Ο€ ∼ Ο€"
    by (metis (full_types) place_eq.simps place_sim.elims(1))
qed

lemma PI'_subset_PI: "PI' βŠ† PI"
  unfolding PI'_def
  using equiv_Eps_preserves place_sim_rel_equiv_on_PI by blast

lemma sim_self:
  assumes "Ο€ ∈ PI'"
      and "Ο€' ∈ PI'"
      and "Ο€ ∼ Ο€'"
    shows "Ο€' = Ο€"
proof -
  from β€ΉΟ€ ∼ Ο€'β€Ί have "(Ο€, Ο€') ∈ rel_place_sim"
    using β€ΉΟ€ ∈ PI'β€Ί β€ΉΟ€' ∈ PI'β€Ί PI'_subset_PI by blast
  from β€ΉΟ€ ∈ PI'β€Ί obtain Ο€s where "Ο€s ∈ PI // rel_place_sim" "Ο€ = (SOME Ο€. Ο€ ∈ Ο€s)"
    unfolding PI'_def by blast
  then have "Ο€ ∈ Ο€s"
    using equiv_Eps_in place_sim_rel_equiv_on_PI by blast
  from β€ΉΟ€' ∈ PI'β€Ί obtain Ο€s' where "Ο€s' ∈ PI // rel_place_sim" "Ο€' = (SOME Ο€. Ο€ ∈ Ο€s')"
    unfolding PI'_def by blast
  then have "Ο€' ∈ Ο€s'"
    using equiv_Eps_in place_sim_rel_equiv_on_PI by blast
  from place_sim_rel_equiv_on_PI β€ΉΟ€s ∈ PI // rel_place_simβ€Ί β€ΉΟ€s' ∈ PI // rel_place_simβ€Ί
       β€ΉΟ€ ∈ Ο€sβ€Ί β€ΉΟ€' ∈ Ο€s'β€Ί β€Ή(Ο€, Ο€') ∈ rel_place_simβ€Ί
  have "Ο€s = Ο€s'"
    using quotient_eqI[where ?A = PI and ?r = rel_place_sim and ?x = Ο€ and ?X = Ο€s and ?y = Ο€' and ?Y = Ο€s']
    by fast
  with β€ΉΟ€ = (SOME Ο€. Ο€ ∈ Ο€s)β€Ί β€ΉΟ€' = (SOME Ο€. Ο€ ∈ Ο€s')β€Ί show "Ο€' = Ο€"
    by auto
qed

fun atp_f' :: "'a β‡’ ('a β‡’ bool)" where
  "atp_f' w = rep (atp_f w)"

definition "atp' = {(y, atp_f' y)|y. y ∈ W}"
declare atp'_def [simp]

lemma range_atp_f':
  assumes "w ∈ W"
  shows "atp_f' w ∈ PI'"
proof -
  from β€Ήw ∈ Wβ€Ί range_atp_f have "atp_f w ∈ PI" by blast
  then have "rel_place_sim `` {atp_f w} ∈ PI // rel_place_sim"
    using quotientI by fast
  then show ?thesis unfolding PI'_def
    apply (simp only: atp_f'.simps rep_def)
    by (smt (verit, best) Eps_cong atp_f'.elims image_insert insert_iff mk_disjoint_insert)
qed

lemma rep_at:
  assumes "Ο€ ∈ PI"
      and "(y, Ο€) ∈ atp"
    shows "(y, rep Ο€) ∈ atp'"
proof -
  from β€Ή(y, Ο€) ∈ atpβ€Ί have "atp_f y = Ο€" by auto
  from β€Ή(y, Ο€) ∈ atpβ€Ί have "y ∈ W" by auto
  with W_subset_V have "y ∈ V" by fast
  from β€Ή(y, Ο€) ∈ atpβ€Ί obtain x where "AT (Var x =s Single (Var y)) ∈ π’ž" "x ∈ V"
    using memW_E by fastforce
  with U_collect_places_single have "βˆƒL. L βŠ† U ∧ π’œ x = ⨆HF (π’œ ` L)" by meson
  with fact_2 have "Ο€1 x ⟷ Ο€2 x" if "Ο€1 ∼ Ο€2" "Ο€1 ∈ PI" "Ο€2 ∈ PI" for Ο€1 Ο€2
    using β€Ήx ∈ Vβ€Ί that by blast
  with rep_sim have "(rep Ο€) x ⟷ Ο€ x"
    using PI'_subset_PI β€ΉΟ€ ∈ PIβ€Ί range_rep by blast
  
  from 𝔅.C5_1[where ?x = x and ?y = y] have "Ο€ x" "βˆ€Ο€'∈PI. Ο€' β‰  Ο€ ⟢ Β¬ Ο€' x"
    using β€ΉAT (Var x =s Single (Var y)) ∈ π’žβ€Ί β€Ή(y, Ο€) ∈ atpβ€Ί by fastforce+
  
  from β€ΉΟ€ xβ€Ί β€Ή(rep Ο€) x ⟷ Ο€ xβ€Ί have "(rep Ο€) x" by blast
  with β€Ήβˆ€Ο€'∈PI. Ο€' β‰  Ο€ ⟢ Β¬ Ο€' xβ€Ί have "rep Ο€ = Ο€"
    using range_rep PI'_subset_PI β€ΉΟ€ ∈ PIβ€Ί by blast
  then have "atp_f' y = rep Ο€"
    using β€Ήatp_f y = Ο€β€Ί by (simp only: atp_f'.simps)
  then show "(y, rep Ο€) ∈ atp'"
    using β€Ήy ∈ Wβ€Ί
    by (metis (mono_tags, lifting) atp'_def mem_Collect_eq)
qed

interpretation 𝔅': adequate_place_framework π’ž PI' atp'
proof -
  from PI'_subset_PI 𝔅.PI_subset_places_V
  have PI'_subset_places_V: "PI' βŠ† places V" by blast

  have dom_atp': "Domain atp' = W" by auto
  have range_atp': "Range atp' βŠ† PI'"
  proof -
    {fix y lt assume "lt ∈ π’ž" "y ∈ singleton_vars lt"
      then have "rep (atp_f y) ∈ PI'"
        using range_atp_f[of y] range_rep[of "atp_f y"]
        by blast
    }
    then show ?thesis by auto
  qed

  from 𝔅.single_valued_atp
  have single_valued_atp': "single_valued atp'"
    unfolding single_valued_def atp'_def
    apply (simp only: atp_f'.simps)
    by blast

  from PI'_subset_PI have "place_membership π’ž PI' βŠ† place_membership π’ž PI" by auto
  with 𝔅.membership_irreflexive have membership_irreflexive:
    "(Ο€, Ο€) βˆ‰ place_membership π’ž PI'" for Ο€
    by blast

  from PI'_subset_PI have subgraph: "subgraph (place_mem_graph π’ž PI') (place_mem_graph π’ž PI)"
  proof -
    have "verts (place_mem_graph π’ž PI') = PI'" by simp
    moreover
    have "verts (place_mem_graph π’ž PI) = PI" by simp
    ultimately
    have verts: "verts (place_mem_graph π’ž PI') βŠ† verts (place_mem_graph π’ž PI)"
      using PI'_subset_PI by presburger

    have "arcs (place_mem_graph π’ž PI') = place_membership π’ž PI'" by simp
    moreover
    have "arcs (place_mem_graph π’ž PI) = place_membership π’ž PI" by simp
    moreover
    have "place_membership π’ž PI' βŠ† place_membership π’ž PI"
      using PI'_subset_PI by auto
    ultimately
    have arcs: "arcs (place_mem_graph π’ž PI') βŠ† arcs (place_mem_graph π’ž PI)" by blast

    have "compatible (place_mem_graph π’ž PI) (place_mem_graph π’ž PI')"
      unfolding compatible_def by simp
    with verts arcs show "subgraph (place_mem_graph π’ž PI') (place_mem_graph π’ž PI)"
      unfolding subgraph_def
      using place_mem_graph_wf_digraph
      by blast
  qed

  from 𝔅.C6 have "βˆ„c. pre_digraph.cycle (place_mem_graph π’ž PI) c"
    using dag.acyclic by blast
  then have "βˆ„c. pre_digraph.cycle (place_mem_graph π’ž PI') c"
    using subgraph wf_digraph.subgraph_cycle by blast
  then have C6: "dag (place_mem_graph π’ž PI')"
    using β€Ήdag (place_mem_graph π’ž PI)β€Ί dag_axioms_def dag_def digraph.digraph_subgraph subgraph
    by blast

  from 𝔅.C1_1 PI'_subset_PI
  have C1_1: "βˆƒn. AT (Var x =s βˆ… n) ∈ π’ž ⟹ βˆ€Ο€ ∈ PI'. Β¬ Ο€ x" for x
    by fast

  from 𝔅.C1_2 PI'_subset_PI
  have C1_2: "AT (Var x =s Var y) ∈ π’ž ⟹ βˆ€Ο€ ∈ PI'. Ο€ x ⟷ Ο€ y" for x y
    by fast

  from 𝔅.C2 PI'_subset_PI
  have C2: "AT (Var x =s Var y βŠ”s Var z) ∈ π’ž ⟹ βˆ€Ο€ ∈ PI'. Ο€ x ⟷ Ο€ y ∨ Ο€ z" for x y z
    by fast

  from 𝔅.C3 PI'_subset_PI
  have C3: "AT (Var x =s Var y -s Var z) ∈ π’ž ⟹ βˆ€Ο€ ∈ PI'. Ο€ x ⟷ Ο€ y ∧ Β¬ Ο€ z" for x y z
    by fast

  have C4: "AF (Var x =s Var y) ∈ π’ž ⟹ βˆƒΟ€ ∈ PI'. Ο€ x ⟷ Β¬ Ο€ y" for x y
  proof -
    assume neq: "AF (Var x =s Var y) ∈ π’ž"
    with 𝔅.C4 obtain Ο€ where "Ο€ ∈ PI" "Ο€ x ⟷ Β¬ Ο€ y" by blast
    from neq have "x ∈ V" "y ∈ V" by fastforce+
    from neq U_collect_places_neq[where ?x = x and ?y = y] fact_2[of x]
    have sim_Ο€_x: "Ο€1 x = Ο€2 x" if "Ο€1 ∈ PI" "Ο€2 ∈ PI" "Ο€1 ∼ Ο€2" for Ο€1 Ο€2
      using that β€Ήx ∈ Vβ€Ί by blast
    from neq U_collect_places_neq[where ?x = x and ?y = y] fact_2[of y]
    have sim_Ο€_y: "Ο€1 y = Ο€2 y" if "Ο€1 ∈ PI" "Ο€2 ∈ PI" "Ο€1 ∼ Ο€2" for Ο€1 Ο€2
      using that β€Ήy ∈ Vβ€Ί by blast
    from β€ΉΟ€ ∈ PIβ€Ί have "rep Ο€ ∈ PI'" using range_rep by blast
    then have "rep Ο€ ∈ PI" using PI'_subset_PI by blast

    from rep_sim sim_Ο€_x have "(rep Ο€) x ⟷ Ο€ x"
      using β€Ήrep Ο€ ∈ PIβ€Ί β€ΉΟ€ ∈ PIβ€Ί by blast
    moreover
    from rep_sim sim_Ο€_y have "Ο€ y ⟷ (rep Ο€) y"
      using β€Ήrep Ο€ ∈ PIβ€Ί β€ΉΟ€ ∈ PIβ€Ί by blast
    ultimately
    have "(rep Ο€) x ⟷ Β¬ (rep Ο€) y"
      using β€ΉΟ€ x ⟷ Β¬ Ο€ yβ€Ί by blast
    with β€Ήrep Ο€ ∈ PI'β€Ί show ?thesis by blast
  qed

  have C5_1: "βˆƒΟ€. (y, Ο€) ∈ atp' ∧ Ο€ x ∧ (βˆ€Ο€' ∈ PI'. Ο€' β‰  Ο€ ⟢ Β¬ Ο€' x)"
    if "AT (Var x =s Single (Var y)) ∈ π’ž" for x y
  proof -
    from that have "y ∈ W" "x ∈ V" "y ∈ V" by fastforce+
    from that 𝔅.C5_1[where ?y = y and ?x = x]
    obtain Ο€ where Ο€: "(y, Ο€) ∈ atp" "Ο€ x" "βˆ€Ο€' ∈ PI. Ο€' β‰  Ο€ ⟢ Β¬ Ο€' x"
      by blast
    with 𝔅.range_atp have "Ο€ ∈ PI" by fast
    then have "rep Ο€ ∈ PI'" using range_rep by blast
    from rep_sim have "rep Ο€ ∼ Ο€" using β€ΉΟ€ ∈ PIβ€Ί by fast
    with U_collect_places_single β€ΉΟ€ xβ€Ί fact_2 have "(rep Ο€) x"
      using β€Ήx ∈ Vβ€Ί β€ΉΟ€ ∈ PIβ€Ί β€Ήrep Ο€ ∈ PI'β€Ί PI'_subset_PI that
      by blast
    with Ο€ have "rep Ο€ = Ο€"
      using β€Ήrep Ο€ ∈ PI'β€Ί PI'_subset_PI by blast
    with Ο€ show ?thesis
      using β€Ήrep Ο€ ∈ PI'β€Ί PI'_subset_PI
      by (metis rep_at subset_iff)
  qed

  have C5_2: "βˆ€Ο€ ∈ PI'. Ο€ y ⟷ Ο€ z" if "y ∈ W" "z ∈ W" and at'_eq: "βˆƒΟ€. (y, Ο€) ∈ atp' ∧ (z, Ο€) ∈ atp'" for y z
  proof
    fix Ο€ assume "Ο€ ∈ PI'"
    from at'_eq obtain Ο€' where Ο€': "atp_f' y = Ο€'" "atp_f' z = Ο€'"
      by (simp only: atp'_def) fast
    with range_atp_f' β€Ήy ∈ Wβ€Ί have "Ο€' ∈ PI'" by blast
    from Ο€' have "atp_f' y ∼ atp_f' z"
      apply (simp only: atp_f'.simps place_sim.simps place_eq.simps)
      by blast
    moreover
    from rep_sim have "atp_f' y ∼ atp_f y"
      using atp_f'.simps range_atp_f that(1) by presburger
    moreover
    from rep_sim have "atp_f' z ∼ atp_f z"
      using atp_f'.simps range_atp_f that(2) by presburger
    ultimately
    have "atp_f y ∼ atp_f z"
      using trans_sim[of "atp_f y" "atp_f' y" "atp_f' z"]
      using trans_sim[of "atp_f y" "atp_f' z" "atp_f z"]
      using refl_sim[of "atp_f' y" "atp_f y"]
      using range_atp_f[of y] range_atp_f[of z] range_atp_f' PI'_subset_PI that(1-2)
      by (meson subset_iff)
    then consider "atp_f y = atp_f z" | "βˆƒu ∈ U. atp_f y u ∧ atp_f z u"
      by force
    then show "Ο€ y ⟷ Ο€ z"
    proof (cases)
      case 1
      then have "βˆƒΟ€. (y, Ο€) ∈ atp ∧ (z, Ο€) ∈ atp"
        using atp_def β€Ήy ∈ Wβ€Ί β€Ήz ∈ Wβ€Ί by blast
      with 𝔅.C5_2 have "βˆ€Ο€ ∈ PI. Ο€ y ⟷ Ο€ z"
        using β€Ήy ∈ Wβ€Ί β€Ήz ∈ Wβ€Ί by presburger
      with β€ΉΟ€ ∈ PI'β€Ί PI'_subset_PI show "Ο€ y ⟷ Ο€ z"
        by fast
    next
      case 2
      then obtain u where "u ∈ U" "atp_f y u" "atp_f z u" by blast
      then have "π’œ y ∈ π’œ u" "π’œ z ∈ π’œ u"
        by (simp add: less_eq_hf_def)+
      from β€Ήy ∈ Wβ€Ί obtain x1 where x1_single_y: "AT (Var x1 =s Single (Var y)) ∈ π’ž"
        using memW_E by blast
      with π’œ_sat_π’ž have "π’œ x1 = HF {π’œ y}" by fastforce
      then have "π’œ y ∈ π’œ x1" by simp      
      from x1_single_y U_collect_places_single obtain L where "L βŠ† U" "π’œ x1 = ⨆HF (π’œ ` L)"
        by meson
      with β€Ήπ’œ y ∈ π’œ x1β€Ί obtain u' where "u' ∈ L" "π’œ y ∈ π’œ u'" by auto
      from β€Ήπ’œ x1 = ⨆HF (π’œ ` L)β€Ί β€Ήu' ∈ Lβ€Ί have "π’œ u' ≀ π’œ x1"
        using β€Ήπ’œ y ∈ π’œ x1β€Ί by auto
      with β€Ήπ’œ x1 = HF {π’œ y}β€Ί β€Ήπ’œ y ∈ π’œ u'β€Ί have "π’œ u' = HF {π’œ y}" by auto
      with β€Ήπ’œ y ∈ π’œ uβ€Ί β€Ήu ∈ Uβ€Ί β€Ήu' ∈ Lβ€Ί β€ΉL βŠ† Uβ€Ί no_overlap_within_U
      have "u' = u" by fastforce
      with β€Ήπ’œ u' = HF {π’œ y}β€Ί β€Ήπ’œ z ∈ π’œ uβ€Ί have "π’œ y = π’œ z" by simp
      with realise_same_implies_eq_under_all_Ο€[of y z Ο€] show ?thesis
        using β€Ήy ∈ Wβ€Ί β€Ήz ∈ Wβ€Ί W_subset_V β€ΉΟ€ ∈ PI'β€Ί PI'_subset_PI by blast
    qed
  qed

  have C5_3: "βˆƒΟ€. (y, Ο€) ∈ atp' ∧ (y', Ο€) ∈ atp'"
    if "y ∈ W" "y' ∈ W" "βˆ€Ο€' ∈ PI'. Ο€' y' ⟷ Ο€' y" for y' y
  proof -
    from β€Ήβˆ€Ο€' ∈ PI'. Ο€' y' ⟷ Ο€' yβ€Ί have "βˆ€Ο€ ∈ PI. rep Ο€ y' ⟷ rep Ο€ y"
      by (metis range_rep)
    {fix Ο€ assume "Ο€ ∈ PI"
      with β€Ήβˆ€Ο€' ∈ PI'. Ο€' y' ⟷ Ο€' yβ€Ί have "rep Ο€ y' ⟷ rep Ο€ y"
        using range_rep by fast
      from β€ΉΟ€ ∈ PIβ€Ί PI'_subset_PI range_rep have "rep Ο€ ∈ PI" by blast
      from U_collect_places_single'[of y'] fact_2[of y' "rep Ο€" Ο€] rep_sim[of Ο€]
      have "rep Ο€ y' ⟷ Ο€ y'"
        using β€Ήy' ∈ Wβ€Ί W_subset_V β€ΉΟ€ ∈ PIβ€Ί β€Ήrep Ο€ ∈ PIβ€Ί
        by blast
      from U_collect_places_single'[of y] fact_2[of y "rep Ο€" Ο€] rep_sim[of Ο€]
      have "rep Ο€ y ⟷ Ο€ y"
        using β€Ήy ∈ Wβ€Ί W_subset_V β€ΉΟ€ ∈ PIβ€Ί β€Ήrep Ο€ ∈ PIβ€Ί
        by blast
      from β€Ήrep Ο€ y' ⟷ rep Ο€ yβ€Ί β€Ήrep Ο€ y' ⟷ Ο€ y'β€Ί β€Ήrep Ο€ y ⟷ Ο€ yβ€Ί
      have "Ο€ y ⟷ Ο€ y'" by blast
    }
    with 𝔅.C5_3 obtain Ο€ where "(y, Ο€) ∈ atp" "(y', Ο€) ∈ atp"
      using β€Ήy ∈ Wβ€Ί β€Ήy' ∈ Wβ€Ί by blast
    then have "(y, rep Ο€) ∈ atp'" "(y', rep Ο€) ∈ atp'"
      by (meson Range_iff 𝔅.range_atp rep_at subset_iff)+
    then show ?thesis by fast
  qed

  have "Ο€ = Ο€β‡˜HF {0}⇙" if "Ο€ ∈ Range atp' - Range (place_membership π’ž PI')" for Ο€
  proof -
    from that obtain y where "(y, Ο€) ∈ atp'" by blast
    then have "y ∈ W" "Ο€ ∈ PI'"
      using dom_atp' range_atp' by blast+
    from β€Ή(y, Ο€) ∈ atp'β€Ί have "Ο€ = rep (atp_f y)" by simp
    from β€Ήy ∈ Wβ€Ί obtain x where lt_in_π’ž: "AT (Var x =s Single (Var y)) ∈ π’ž"
      using memW_E by blast
    with π’œ_sat_π’ž have "π’œ x = HF {π’œ y}" by fastforce
    then have "Οƒβ‡˜y⇙ ≀ π’œ x" by simp
    with lt_in_π’ž have "atp_f y x" by force
    with β€ΉΟ€ = rep (atp_f y)β€Ί fact_2[of x] rep_sim[of "atp_f y"] U_collect_places_single[of x y]
    have "Ο€ x"
      using lt_in_π’ž β€ΉΟ€ ∈ PI'β€Ί PI'_subset_PI β€Ήy ∈ Wβ€Ί
      by (smt (verit, best) 𝔅.PI_subset_places_V places_domain range_atp_f rev_contra_hsubsetD)

    have "βˆ€Ο€ ∈ PI. Β¬ Ο€ y"
    proof (rule ccontr)
      assume "Β¬ (βˆ€Ο€βˆˆPI. Β¬ Ο€ y)"
      then obtain Ο€' where "Ο€' ∈ PI" "Ο€' y" by blast
      with U_collect_places_single'[of y] fact_2[of y "rep Ο€'" Ο€'] rep_sim[of Ο€']
      have "rep Ο€' y"
        using β€Ήy ∈ Wβ€Ί PI'_subset_PI W_subset_V range_rep by blast
      with β€ΉAT (Var x =s Single (Var y)) ∈ π’žβ€Ί β€ΉΟ€ xβ€Ί
      have "(rep Ο€', Ο€) ∈ place_membership π’ž PI'"
        using β€ΉΟ€ ∈ PI'β€Ί β€ΉΟ€' ∈ PIβ€Ί range_rep
        by (simp only: place_membership.simps) blast
      then have "Ο€ ∈ Range (place_membership π’ž PI')" by blast
      with that show False by blast
    qed
    have "βˆ€Ξ± ∈ β„’ V y. proper_Venn_region Ξ± = 0"
    proof (rule ccontr)
      assume "Β¬ (βˆ€Ξ± ∈ β„’ V y. proper_Venn_region Ξ± = 0)"
      then obtain Ξ± where Ξ±: "Ξ± ∈ β„’ V y" "proper_Venn_region Ξ± β‰  0" by blast
      then have "y ∈ α" "α ∈ P+ V" by auto
      with β€Ήproper_Venn_region Ξ± β‰  0β€Ί have "proper_Venn_region Ξ± ≀ π’œ y"
        using proper_Venn_region_subset_variable_iff
        by (meson mem_P_plus_subset subset_iff)
      then have "Ο€β‡˜proper_Venn_region α⇙ y"
        using W_subset_V β€Ήy ∈ Wβ€Ί by auto
      with β€Ήβˆ€Ο€ ∈ PI. Β¬ Ο€ yβ€Ί show False
        using Ξ± by auto
    qed
    then have "⨆HF (proper_Venn_region ` β„’ V y) = 0"
      by fastforce
    with variable_as_composition_of_proper_Venn_regions[of y]
    have "π’œ y = 0"
      using β€Ήy ∈ Wβ€Ί W_subset_V by auto
    with β€Ήπ’œ x = HF {π’œ y}β€Ί have "π’œ x = HF {0}" by argo

    from β€ΉΟ€ ∈ PI'β€Ί PI'_subset_PI obtain Οƒ where "Οƒ ∈ Ξ£" "Ο€ = Ο€β‡˜Οƒβ‡™"
      by (metis PI_def image_iff in_mono)
    with β€ΉΟ€ xβ€Ί have "Οƒ β‰  0" "Οƒ ≀ π’œ x" by simp+
    with β€Ήπ’œ x = HF {0}β€Ί have "Οƒ = HF {0}" by fastforce
    with β€ΉΟ€ = Ο€β‡˜Οƒβ‡™β€Ί show "Ο€ = Ο€β‡˜HF {0}⇙" by blast
  qed
  then have C7:
    "βŸ¦Ο€1 ∈ Range atp' - Range (place_membership π’ž PI');
      Ο€2 ∈ Range atp' - Range (place_membership π’ž PI')⟧ ⟹ Ο€1 = Ο€2" for Ο€1 Ο€2
    by blast

  from PI'_subset_places_V dom_atp' range_atp' single_valued_atp'
       membership_irreflexive C6
       C1_1 C1_2 C2 C3 C4 C5_1 C5_2 C5_3 C7
  show "adequate_place_framework π’ž PI' atp'"
    apply intro_locales
    unfolding adequate_place_framework_axioms_def
    by blast
qed

lemma singleton_model_for_normalized_reduced_literals:
  "βˆƒβ„³. βˆ€lt ∈ π’ž. interp Isa β„³ lt ∧ (βˆ€u ∈ U. hcard (β„³ u) ≀ 1)"
proof -
  from 𝔅'.finite_PI have "finite (PI' - Range atp')" by blast
  with u_exists[of "PI' - Range atp'" "card PI'"] obtain u where
    "βŸ¦Ο€1 ∈ PI' - Range atp'; Ο€2 ∈ PI' - Range atp'; Ο€1 β‰  Ο€2⟧ ⟹ u Ο€1 β‰  u Ο€2"
    "Ο€ ∈ PI' - Range atp' ⟹ hcard (u Ο€) β‰₯ card PI'"
  for Ο€1 Ο€2 Ο€
    by blast
  then have "place_realization π’ž PI' atp' u"
    by unfold_locales blast+
  
  {fix x assume "x ∈ U"
    then have "Ο€1 = Ο€2" if "Ο€1 x" "Ο€2 x" "Ο€1 ∈ PI'" "Ο€2 ∈ PI'" for Ο€1 Ο€2
      using sim_self that by auto
    then consider "{Ο€ ∈ PI'. Ο€ x} = {}" | "(βˆƒΟ€. {Ο€ ∈ PI'. Ο€ x} = {Ο€})"
      by blast
    then have "hcard (place_realization.β„³ π’ž PI' atp' u x) ≀ 1"
    proof (cases)
      case 1
      then have "place_realization.β„³ π’ž PI' atp' u x = 0"
        using β€Ήplace_realization π’ž PI' atp' uβ€Ί "place_realization.β„³.simps"
        by fastforce
      then show ?thesis by simp
    next
      case 2
      then obtain Ο€ where "{Ο€ ∈ PI'. Ο€ x} = {Ο€}" "Ο€ ∈ PI'" by auto
      then have "place_realization.β„³ π’ž PI' atp' u x = ⨆HF (place_realization.place_realise π’ž PI' atp' u ` {Ο€})"
        using β€Ήplace_realization π’ž PI' atp' uβ€Ί "place_realization.β„³.simps"
        by fastforce
      also have "... = ⨆HF {place_realization.place_realise π’ž PI' atp' u Ο€}"
        by simp
      finally have "place_realization.β„³ π’ž PI' atp' u x = ⨆HF {place_realization.place_realise π’ž PI' atp' u Ο€}" .
      moreover
      from place_realization.place_realise_singleton[of π’ž PI' atp' u]
      have "hcard (place_realization.place_realise π’ž PI' atp' u Ο€) = 1"
        using β€Ήplace_realization π’ž PI' atp' uβ€Ί β€ΉΟ€ ∈ PI'β€Ί by blast
      then obtain c where "place_realization.place_realise π’ž PI' atp' u Ο€ = HF {c}"
        using hcard_1E[of "place_realization.place_realise π’ž PI' atp' u Ο€"]
        by fastforce
      ultimately
      have "place_realization.β„³ π’ž PI' atp' u x = ⨆HF {HF {c}}"
        by presburger
      also have "... = HF {c}" by fastforce
      also have "hcard ... = 1"
        by (simp add: hcard_def)
      finally show ?thesis by linarith
    qed
  }
  moreover
  from place_realization.β„³_sat_π’ž
  have "βˆ€lt ∈ π’ž. interp Isa (place_realization.β„³ π’ž PI' atp' u) lt"
    using β€Ήplace_realization π’ž PI' atp' uβ€Ί by fastforce
  ultimately
  show ?thesis by blast
qed

end

theorem singleton_model_for_reduced_MLSS_clause:
  assumes norm_π’ž: "normalized_MLSSmf_clause π’ž"
      and V: "V = varsm π’ž"
      and π’œ_model: "normalized_MLSSmf_clause.is_model_for_reduced_dnf π’ž π’œ"
    shows "βˆƒβ„³. normalized_MLSSmf_clause.is_model_for_reduced_dnf π’ž β„³ ∧
                (βˆ€Ξ± ∈ P+ V. hcard (β„³ vβ‡˜Ξ±β‡™) ≀ 1)"
proof -
  from norm_π’ž interpret normalized_MLSSmf_clause π’ž by blast
  interpret proper_Venn_regions V "π’œ ∘ Solo"
    using V by unfold_locales blast

  from π’œ_model have "βˆ€fm∈introduce_v. interp Isa π’œ fm"
    unfolding is_model_for_reduced_dnf_def reduced_dnf_def
    by blast
  with eval_v have π’œ_v: "βˆ€Ξ± ∈ P+ V. π’œ vβ‡˜Ξ±β‡™ = proper_Venn_region Ξ±"
    using V V_def proper_Venn_region.simps by auto

  from π’œ_model have "βˆ€lt ∈ introduce_UnionOfVennRegions. interp Isa π’œ lt"
    unfolding is_model_for_reduced_dnf_def reduced_dnf_def by blast
  then have "βˆ€a ∈ restriction_on_UnionOfVennRegions Ξ±s. Isa π’œ a"
    if "αs ∈ set all_V_set_lists" for αs
    unfolding introduce_UnionOfVennRegions_def
    using that by simp
  with eval_UnionOfVennRegions have π’œ_UnionOfVennRegions:
    "π’œ (UnionOfVennRegions Ξ±s) = ⨆HF (π’œ ` VennRegion ` set Ξ±s)"
    if "αs ∈ set all_V_set_lists" for αs
    using that by (simp add: Sup.SUP_image)

  have Solo_variable_as_composition_of_v:
    "βˆƒL βŠ† {vβ‡˜Ξ±β‡™ |Ξ±. Ξ± ∈ P+ V}. π’œ z = ⨆HF (π’œ ` L)" if "βˆƒz' ∈ V. z = Solo z'" for z
  proof -
    from that obtain z' where "z' ∈ V" "z = Solo z'" by blast
    then have "VennRegion ` β„’ V z' βŠ† {vβ‡˜Ξ±β‡™ |Ξ±. Ξ± ∈ P+ V}" by fastforce
    moreover
    from π’œ_v have "βˆ€Ξ± ∈ β„’ V z'. π’œ vβ‡˜Ξ±β‡™ = proper_Venn_region Ξ±"
      using β„’_subset_P_plus finite_V by fast
    then have "⨆HF (π’œ ` (VennRegion ` β„’ V z')) = ⨆HF (proper_Venn_region ` β„’ V z')"
      using HUnion_eq[where ?S = "β„’ V z'" and ?f = "π’œ ∘ VennRegion" and ?g = proper_Venn_region]
      by (simp add: image_comp)
    moreover
    from variable_as_composition_of_proper_Venn_regions
    have "(π’œ ∘ Solo) z' = ⨆HF (proper_Venn_region ` β„’ V z')"
      using β€Ήz' ∈ Vβ€Ί by presburger
    with β€Ήz = Solo z'β€Ί have "π’œ z = ⨆HF (proper_Venn_region ` β„’ V z')" by simp
    ultimately
    have "VennRegion ` β„’ V z' βŠ† {vβ‡˜Ξ±β‡™ |Ξ±. Ξ± ∈ P+ V} ∧ π’œ z = ⨆HF (π’œ ` VennRegion ` β„’ V z')"
      by simp
    then show ?thesis by blast
  qed

  from π’œ_model obtain clause where clause:
    "clause ∈ reduced_dnf" "βˆ€lt ∈ clause. interp Isa π’œ lt"
    unfolding is_model_for_reduced_dnf_def by blast
  with reduced_dnf_normalized have "normalized_MLSS_clause clause" by blast
  with clause
  have "satisfiable_normalized_MLSS_clause_with_vars_for_proper_Venn_regions clause π’œ {vβ‡˜Ξ±β‡™ |Ξ±. Ξ± ∈ P+ V}"
  proof (unfold_locales, goal_cases)
    case 1
    then show ?case
      using normalized_MLSS_clause.norm_π’ž by blast
  next
    case 2
    then show ?case
      by (simp add: normalized_MLSS_clause.finite_π’ž)
  next
    case 3
    then show ?case
      by (simp add: finite_vars_fm normalized_MLSS_clause.finite_π’ž)
  next
    case 4
    then show ?case by simp
  next
    case 5
    from β€Ήclause ∈ reduced_dnfβ€Ί normalized_clause_contains_all_v_Ξ±
    have "βˆ€Ξ±βˆˆP+ V. vβ‡˜Ξ±β‡™ ∈ ⋃ (vars ` clause)"
      using V V_def by simp
    then show ?case by blast      
  next
    case (6 x y)
    then obtain Ξ± Ξ² where Ξ±Ξ²: "Ξ± ∈ P+ V" "Ξ² ∈ P+ V" "x = vβ‡˜Ξ±β‡™" "y = vβ‡˜Ξ²β‡™"
      by blast
    with β€Ήx β‰  yβ€Ί have "Ξ± β‰  Ξ²" by blast

    from Ξ±Ξ² have "Ξ± βŠ† V" "Ξ² βŠ† V" by auto

    from π’œ_model have "βˆ€fm∈introduce_v. interp Isa π’œ fm"
      unfolding is_model_for_reduced_dnf_def reduced_dnf_def by blast
    with Ξ±Ξ² eval_v have "π’œ x = proper_Venn_region Ξ±" "π’œ y = proper_Venn_region Ξ²"
      using V V_def proper_Venn_region.simps by auto
    with proper_Venn_region_disjoint β€ΉΞ± β‰  Ξ²β€Ί
    show ?case
      using β€ΉΞ± βŠ† Vβ€Ί β€ΉΞ² βŠ† Vβ€Ί by presburger
  next
    case (7 x y)
    from β€ΉAF (Var x =s Var y) ∈ clauseβ€Ί β€Ήclause ∈ reduced_dnfβ€Ί
    consider "AF (Var x =s Var y) ∈ reduce_clause" | "βˆƒclause ∈ introduce_w. AF (Var x =s Var y) ∈ clause"
      unfolding reduced_dnf_def introduce_v_def introduce_UnionOfVennRegions_def by blast
    then show ?case
    proof (cases)
      case 1
      then obtain lt where lt: "lt ∈ set π’ž" "AF (Var x =s Var y) ∈ reduce_literal lt"
        unfolding reduce_clause_def by blast
      then obtain a where "lt = AFm a"
        by (cases lt rule: reduce_literal.cases) auto
      from β€Ήlt ∈ set π’žβ€Ί norm_π’ž have "norm_literal lt" by blast
      with β€Ήlt = AFm aβ€Ί norm_literal_neq
      obtain x' y' where lt: "lt = AFm (Varm x' =m Varm y')" by blast
      then have "reduce_literal lt = {AF (Var (Solo x') =s Var (Solo y'))}"
        by simp
      with β€ΉAF (Var x =s Var y) ∈ reduce_literal ltβ€Ί have "x = Solo x'" "y = Solo y'"
        by simp+
      from lt β€Ήlt ∈ set π’žβ€Ί have "x' ∈ V" "y' ∈ V"
        using V by fastforce+

      from Solo_variable_as_composition_of_v show ?thesis
        using β€Ήx = Solo x'β€Ί β€Ήy = Solo y'β€Ί β€Ήx' ∈ Vβ€Ί β€Ήy' ∈ Vβ€Ί
        by (smt (verit, best))
    next
      case 2
      with lt_in_clause_in_introduce_w_E obtain l' m' f
        where l': "l' ∈ set all_V_set_lists"
          and m': "m' ∈ set all_V_set_lists"
          and f: "f ∈ set F_list"
          and "AF (Var x =s Var y) ∈ set (restriction_on_FunOfUnionOfVennRegions l' m' f)"
        by blast
      then have "AF (Var x =s Var y) = AF (Var (UnionOfVennRegions l') =s Var (UnionOfVennRegions m'))"
        by auto
      then have "x = UnionOfVennRegions l'" "y = UnionOfVennRegions m'" by blast+
      with π’œ_UnionOfVennRegions l' m'
      have "π’œ x = ⨆HF (π’œ ` VennRegion ` set l')" "π’œ y = ⨆HF (π’œ ` VennRegion ` set m')"
        by blast+
      moreover
      from l' set_all_V_set_lists have "set l' βŠ† P+ V"
        using V V_def by auto
      then have "VennRegion ` set l' βŠ† {vβ‡˜Ξ±β‡™ |Ξ±. Ξ± ∈ P+ V}"
        by blast
      moreover
      from m' set_all_V_set_lists have "set m' βŠ† P+ V"
        using V V_def by auto
      then have "VennRegion ` set m' βŠ† {vβ‡˜Ξ±β‡™ |Ξ±. Ξ± ∈ P+ V}"
        by blast
      ultimately
      show ?thesis by blast
    qed
  next
    case (8 x y)
    then consider "AT (Var x =s Single (Var y)) ∈ introduce_v"
      | "βˆƒclause ∈ introduce_w. AT (Var x =s Single (Var y)) ∈ clause"
      | "AT (Var x =s Single (Var y)) ∈ introduce_UnionOfVennRegions"
      | "AT (Var x =s Single (Var y)) ∈ reduce_clause"
      unfolding reduced_dnf_def by blast
    then show ?case
    proof (cases)
      case 1
      have "Var x =s Single (Var y) β‰  restriction_on_v Ξ±" for Ξ±
        by simp
      moreover
      have "Var x =s Single (Var y) βˆ‰ restriction_on_InterOfVars xs" for xs
        by (induction xs rule: restriction_on_InterOfVars.induct) auto
      then have "Var x =s Single (Var y) βˆ‰ (restriction_on_InterOfVars ∘ var_set_to_list) Ξ±" for Ξ±
        by simp
      moreover
      have "Var x =s Single (Var y) βˆ‰ restriction_on_UnionOfVars xs" for xs
        by (induction xs rule: restriction_on_UnionOfVars.induct) auto
      then have "Var x =s Single (Var y) βˆ‰ (restriction_on_UnionOfVars ∘ var_set_to_list) Ξ±" for Ξ±
        by simp
      ultimately
      have "AT (Var x =s Single (Var y)) βˆ‰ introduce_v"
        unfolding introduce_v_def by blast
      with 1 show ?thesis by blast
    next
      case 2
      with lt_in_clause_in_introduce_w_E obtain l' m' f
        where "AT (Var x =s Single (Var y)) ∈ set (restriction_on_FunOfUnionOfVennRegions l' m' f)"
        by blast
      moreover
      have "AT (Var x =s Single (Var y)) βˆ‰ set (restriction_on_FunOfUnionOfVennRegions l' m' f)"
        by simp
      ultimately
      show ?thesis by blast
    next
      case 3
      have "Var x =s Single (Var y) βˆ‰ restriction_on_UnionOfVennRegions Ξ±s" for Ξ±s
        by (induction Ξ±s rule: restriction_on_UnionOfVennRegions.induct) auto
      then have "AT (Var x =s Single (Var y)) βˆ‰ introduce_UnionOfVennRegions"
        unfolding introduce_UnionOfVennRegions_def by blast
      with 3 show ?thesis by blast
    next
      case 4
      then obtain lt where "lt ∈ set π’ž" and reduce_lt: "AT (Var x =s Single (Var y)) ∈ reduce_literal lt"
        unfolding reduce_clause_def by blast
      with norm_π’ž have "norm_literal lt" by blast
      then have "βˆƒx' y'. lt = ATm (Varm x' =m Singlem (Varm y'))"
        apply (cases lt rule: norm_literal.cases)
        using reduce_lt by auto
      then obtain x' y' where lt: "lt = ATm (Varm x' =m Singlem (Varm y'))" by blast
      with reduce_lt have "x = Solo x'" "y = Solo y'" by simp+
      from β€Ήlt ∈ set π’žβ€Ί lt have "x' ∈ V" "y' ∈ V"
        using V by fastforce+
      from Solo_variable_as_composition_of_v show ?thesis
        using β€Ήx = Solo x'β€Ί β€Ήy = Solo y'β€Ί β€Ήx' ∈ Vβ€Ί β€Ήy' ∈ Vβ€Ί
        by (smt (verit, best))
    qed
  qed
  then show ?thesis
    using satisfiable_normalized_MLSS_clause_with_vars_for_proper_Venn_regions.singleton_model_for_normalized_reduced_literals
    unfolding is_model_for_reduced_dnf_def
    by (smt (verit) V V_def clause(1) introduce_v_subset_reduced_fms mem_Collect_eq subset_iff v_Ξ±_in_vars_introduce_v)
qed

end