Theory MLSS_Decidable

theory MLSS_Decidable
  imports Place_Realisation Syntactic_Description
begin

theorem MLSS_decidable:
  "(∃𝒜. satisfiable_normalized_MLSS_clause 𝒞 𝒜) ⟷
   (∃PI atp. adequate_place_framework 𝒞 PI atp)"  
proof
  assume "∃𝒜. satisfiable_normalized_MLSS_clause 𝒞 𝒜"
  then obtain 𝒜 where "satisfiable_normalized_MLSS_clause 𝒞 𝒜" by blast
  with satisfiable_normalized_MLSS_clause.syntactic_description_is_adequate
  show "∃PI atp. adequate_place_framework 𝒞 PI atp" by blast
next
  assume "∃PI atp. adequate_place_framework 𝒞 PI atp"
  then obtain PI atp where "adequate_place_framework 𝒞 PI atp" by blast
  then have "finite PI"
    by (simp add: adequate_place_framework.finite_PI)
  with u_exists[of PI "card PI"] obtain u
    where "(∀x∈PI. ∀y∈PI. x ≠ y ⟶ u x ≠ u y) ∧ (∀x∈PI. card PI ≤ hcard (u x))"
    by presburger
  with ‹adequate_place_framework 𝒞 PI atp›
  have "place_realization 𝒞 PI atp u"
    unfolding place_realization_def place_realization_axioms_def by blast
  with place_realization.ℳ_sat_𝒞 obtain ℳ where ℳ: "∀lt∈𝒞. interp Isa ℳ lt"
    by blast
  have "satisfiable_normalized_MLSS_clause 𝒞 ℳ"
  proof -
    from ‹adequate_place_framework 𝒞 PI atp› have "normalized_MLSS_clause 𝒞"
      unfolding adequate_place_framework_def by blast
    moreover
    from ‹normalized_MLSS_clause 𝒞› have "finite (⋃ (vars ` 𝒞))"
      unfolding normalized_MLSS_clause_def
      by (simp add: finite_vars_fm)
    then have "proper_Venn_regions (⋃ (vars ` 𝒞))"
      by unfold_locales blast
    ultimately
    show ?thesis
      unfolding satisfiable_normalized_MLSS_clause_def satisfiable_normalized_MLSS_clause_axioms_def
      using ℳ by blast
  qed
  then show "∃𝒜. satisfiable_normalized_MLSS_clause 𝒞 𝒜" by blast
qed

end