header {* Normalization of MSO Formulas *}
theory MSO_Normalization
imports MSO
begin
context MSO
begin
fun nNot where
"nNot (Not φ) = φ"
| "nNot (And φ1 φ2) = Or (nNot φ1) (nNot φ2)"
| "nNot (Or φ1 φ2) = And (nNot φ1) (nNot φ2)"
| "nNot φ = Not φ"
primrec norm where
"norm (Q a m) = Q a m"
| "norm (Less m n) = Less m n"
| "norm (In m M) = In m M"
| "norm (Or φ ψ) = Or (norm φ) (norm ψ)"
| "norm (And φ ψ) = And (norm φ) (norm ψ)"
| "norm (Not φ) = nNot (norm φ)"
| "norm (Exists φ) = Exists (norm φ)"
| "norm (EXISTS φ) = EXISTS (norm φ)"
lemma satisfies_nNot[simp]: "satisfies (w, I) (nNot φ) = satisfies (w,I) (Not φ)"
by (induct φ rule: nNot.induct) auto
lemma FOV_nNot[simp]: "FOV (nNot φ) = FOV (Not φ)"
by (induct φ rule: nNot.induct) auto
lemma SOV_nNot[simp]: "SOV (nNot φ) = SOV (Not φ)"
by (induct φ rule: nNot.induct) auto
lemma pre_wf_formula_nNot[simp]: "pre_wf_formula n (nNot φ) = pre_wf_formula n (Not φ)"
by (induct φ rule: nNot.induct) auto
lemma FOV_norm[simp]: "FOV (norm φ) = FOV φ"
by (induct φ) auto
lemma SOV_norm[simp]: "SOV (norm φ) = SOV φ"
by (induct φ) auto
lemma pre_wf_formula_norm[simp]: "pre_wf_formula n (norm φ) = pre_wf_formula n φ"
by (induct φ arbitrary: n) auto
lemma satisfies_norm[simp]: "satisfies (w, I) (norm φ) = satisfies (w, I) φ"
by (induct φ arbitrary: I) auto
lemma lang⇣M⇣S⇣O_norm[simp]: "lang⇣M⇣S⇣O n (norm φ) = lang⇣M⇣S⇣O n φ"
unfolding lang⇣M⇣S⇣O_def by auto
end
end