Theory MSOinHOL_experiments_classic

theory MSOinHOL_experiments_classic
  imports
    MSOinHOL_deep
    MSOinHOL_shallow
    MSOinHOL_shallow_minimal
begin

abbreviation "(x::V)  1"
abbreviation "(y::V)  2"
abbreviation "(z::V)  3"
abbreviation "(u::V)  4"
abbreviation "(v::V)  5"
abbreviation "(X::V2)  1"
abbreviation "(Y::V2)  2"
abbreviation "(Z::V2)  3"

consts P :: R

subsubsection ‹Boolean closure (B\"uchi 1960; Thomas 1997) under @{text "⊨d'"}

lemma complement_d:
  "d' (d2X. d2Z. dx. (Zd(x) d ¬d Xd(x)))"
  unfolding DefD
  apply (intro allI, simp add: SetMod_def EnvMod_def, intro allI)
  subgoal for S
    by (rule exI[of _ "λd. ¬ S d"]) (auto simp: SetMod_def EnvMod_def)
  done

lemma intersection_d:
  "d' (d2X. d2Y. d2Z. dx. (Zd(x) d (Xd(x) d Yd(x))))"
  unfolding DefD
  apply (intro allI, simp add: SetMod_def EnvMod_def, intro allI)
  subgoal for S Sa
    by (rule exI[of _ "λd. S d  Sa d"])
       (auto simp: SetMod_def EnvMod_def)
  done

lemma union_d:
  "d' (d2X. d2Y. d2Z. dx. (Zd(x) d (Xd(x) d Yd(x))))"
  unfolding DefD
  apply (intro allI, simp add: SetMod_def EnvMod_def, intro allI)
  subgoal for S Sa
    by (rule exI[of _ "λd. S d  Sa d"])
       (auto simp: SetMod_def EnvMod_def)
  done

subsubsection ‹Graph operations (Courcelle 2012)›

lemma separation_d:
  "d' (d2X. d2Z. dx. (Zd(x) d (Xd(x) d Pd(x,x))))"
  unfolding DefD
  apply (intro allI, simp add: SetMod_def EnvMod_def, intro allI)
  subgoal for I S
    by (rule exI[of _ "λd. S d  I P d d"])
       (auto simp: SetMod_def EnvMod_def)
  done

lemma image_d:
  "d' (d2X. d2Y. dx. (Yd(x) d dy. (Xd(y) d Pd(y,x))))"
  unfolding DefD
  apply (intro allI, simp add: SetMod_def EnvMod_def, intro allI)
  subgoal for I S
    by (rule exI[of _ "λd. d'. S d'  I P d' d"])
       (auto simp: SetMod_def EnvMod_def)
  done

lemma preimage_d:
  "d' (d2X. d2Y. dx. (Yd(x) d dy. (Pd(x,y) d Xd(y))))"
  unfolding DefD
  apply (intro allI, simp add: SetMod_def EnvMod_def, intro allI)
  subgoal for I S
    by (rule exI[of _ "λd. d'. I P d d'  S d'"])
       (auto simp: SetMod_def EnvMod_def)
  done

text ‹Reachability (Basin and Klarlund 1995): not universally valid;
  reflexive variant is.›

lemma reachability_not_valid_d:
  "d' (d2Z. ((Zd(x) d (du. (Zd(u) d dv. (Pd(u,v) d Zd(v))))) d Zd(y)))"
  unfolding DefD apply simp nitpick oops

lemma reachability_reflexive_d:
  "d' (d2Z. ((Zd(x) d (du. (Zd(u) d dv. (Pd(u,v) d Zd(v))))) d Zd(x)))"
  unfolding DefD by simp

text ‹2-colorability (Thomas 1997): refuted on the triangle K3
  (the complete graph on three vertices).›

lemma two_colorability_not_valid_d:
  "d' (d2Z. dx. dy. (Pd(x,y) d (Zd(x) d ¬d Zd(y))))"
  unfolding DefD apply simp nitpick oops

subsubsection ‹Maximal-shallow embedding›

text ‹Same landmarks in the maximal-shallow embedding: structurally
  identical proofs.›

lemma complement_s:
  "s' (s2X. s2Z. sx. (Zs(x) s ¬s Xs(x)))"
  unfolding DefS
  apply (intro allI, simp, intro allI)
  subgoal for S by (rule exI[of _ "λd. ¬ S d"]) auto
  done

lemma intersection_s:
  "s' (s2X. s2Y. s2Z. sx. (Zs(x) s (Xs(x) s Ys(x))))"
  unfolding DefS
  apply (intro allI, simp, intro allI)
  subgoal for S Sa by (rule exI[of _ "λd. S d  Sa d"]) auto
  done

lemma union_s:
  "s' (s2X. s2Y. s2Z. sx. (Zs(x) s (Xs(x) s Ys(x))))"
  unfolding DefS
  apply (intro allI, simp, intro allI)
  subgoal for S Sa by (rule exI[of _ "λd. S d  Sa d"]) auto
  done

lemma separation_s:
  "s' (s2X. s2Z. sx. (Zs(x) s (Xs(x) s Ps(x,x))))"
  unfolding DefS
  apply (intro allI, simp, intro allI)
  subgoal for I S by (rule exI[of _ "λd. S d  I P d d"]) auto
  done

lemma image_s:
  "s' (s2X. s2Y. sx. (Ys(x) s (sy. (Xs(y) s Ps(y,x)))))"
  unfolding DefS
  apply (intro allI, simp, intro allI)
  subgoal for I S
    by (rule exI[of _ "λd. d'. S d'  I P d' d"]) auto
  done

lemma preimage_s:
  "s' (s2X. s2Y. sx. (Ys(x) s (sy. (Ps(x,y) s Xs(y)))))"
  unfolding DefS
  apply (intro allI, simp, intro allI)
  subgoal for I S
    by (rule exI[of _ "λd. d'. I P d d'  S d'"]) auto
  done

lemma reachability_not_valid_s:
  "s' (s2Z. ((Zs(x) s (su. (Zs(u) s (sv. (Ps(u,v) s Zs(v)))))) s Zs(y)))"
  unfolding DefS apply (intro allI) apply simp nitpick oops

lemma reachability_reflexive_s:
  "s' (s2Z. ((Zs(x) s (su. (Zs(u) s (sv. (Ps(u,v) s Zs(v)))))) s Zs(x)))"
  unfolding DefS by simp

lemma two_colorability_not_valid_s:
  "s' (s2Z. sx. sy. (Ps(x,y) s (Zs(x) s ¬s Zs(y))))"
  unfolding DefS apply (intro allI) apply simp nitpick oops

subsubsection ‹Minimal-shallow embedding›

text ‹Minimal embedding: SO quantifier ranges over the countable
  Range GG› (via nat›), not all of Pow(D)›.  Nitpick can only certify
  a POTENTIAL countermodel.›

lemma complement_m_not_valid:
  "m (m2X. m2Z. mx. (Zm(x) m ¬m Xm(x)))"
  unfolding DefM nitpick[expect=potential] oops

lemma intersection_m_not_valid:
  "m (m2X. m2Y. m2Z. mx. (Zm(x) m (Xm(x) m Ym(x))))"
  unfolding DefM nitpick[expect=potential] oops

lemma reachability_not_valid_m:
  "m (m2Z. ((Zm(x) m (mu. (Zm(u) m (mv. (Pm(u,v) m Zm(v)))))) m Zm(y)))"
  unfolding DefM nitpick[expect=potential] oops

text ‹Reflexive reachability: the conclusion is the first conjunct of the
  antecedent; genuinely valid.›

lemma reachability_reflexive_m:
  "m (m2Z. ((Zm(x) m (mu. (Zm(u) m (mv. (Pm(u,v) m Zm(v)))))) m Zm(x)))"
  unfolding DefM by simp

lemma two_colorability_not_valid_m:
  "m (m2Z. mx. my. (Pm(x,y) m (Zm(x) m ¬m Zm(y))))"
  unfolding DefM nitpick[expect=potential] oops

end