[STATEMENT]
theorem lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_rexp_of: "wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>)"
   (is "_ \<Longrightarrow> _ = ?L n \<phi>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>)
[PROOF STEP]
proof (induct \<phi> arbitrary: n)
[PROOF STATE]
proof (state)
goal (8 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FQ x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ x1 x2) = lang n (rexp_of n (FQ x1 x2))
 2. \<And>x1 x2 n. wf_formula n (FLess x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess x1 x2) = lang n (rexp_of n (FLess x1 x2))
 3. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 5. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 6. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 7. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 8. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FQ a m)
[PROOF STATE]
proof (state)
this:
wf_formula n (FQ a m)

goal (8 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FQ x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ x1 x2) = lang n (rexp_of n (FQ x1 x2))
 2. \<And>x1 x2 n. wf_formula n (FLess x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess x1 x2) = lang n (rexp_of n (FLess x1 x2))
 3. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 5. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 6. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 7. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 8. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) = lang n (rexp_of n (FQ a m))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
obtain w I where
      *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FQ a m)" "length I = n" "(w, I) \<Turnstile> FQ a m"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FQ a m); length I = n; (w, I) \<Turnstile> FQ a m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FQ a m) \<and> (w, I) \<Turnstile> FQ a m}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FQ a m); length I = n; (w, I) \<Turnstile> FQ a m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)
length I = n
(w, I) \<Turnstile> FQ a m

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
hence x_alt: "x = map (case_prod (enc_atom I)) (zip [0 ..< length x] (stake (length x) (w @- sconst any)))"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)
length I = n
(w, I) \<Turnstile> FQ a m

goal (1 subgoal):
 1. x = map2 (enc_atom I) [0..<length x] (stake (length x) (w @- sconst any))
[PROOF STEP]
by (intro encD) auto
[PROOF STATE]
proof (state)
this:
x = map2 (enc_atom I) [0..<length x] (stake (length x) (w @- sconst any))

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from FQ(1) *(2,4)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FQ a m)
wf_interp_for_formula (w, I) (FQ a m)
(w, I) \<Turnstile> FQ a m
[PROOF STEP]
obtain p where p: "I ! m = Inl p"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FQ a m)
wf_interp_for_formula (w, I) (FQ a m)
(w, I) \<Turnstile> FQ a m

goal (1 subgoal):
 1. (\<And>p. I ! m = Inl p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: all_set_conv_all_nth split: sum.splits)
[PROOF STATE]
proof (state)
this:
I ! m = Inl p

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with FQ(1) *
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FQ a m)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)
length I = n
(w, I) \<Turnstile> FQ a m
I ! m = Inl p
[PROOF STEP]
have p_less: "p < length x"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FQ a m)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)
length I = n
(w, I) \<Turnstile> FQ a m
I ! m = Inl p

goal (1 subgoal):
 1. p < length x
[PROOF STEP]
by (auto simp del: stream_enc.simps intro: trans_less_add1[OF less_length_cut_same_Inl])
[PROOF STATE]
proof (state)
this:
p < length x

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
hence enc_atom: "x ! p = enc_atom I p ((w @- sconst any) !! p)" (is "_ = enc_atom _ _ ?p")
[PROOF STATE]
proof (prove)
using this:
p < length x

goal (1 subgoal):
 1. x ! p = enc_atom I p ((w @- sconst any) !! p)
[PROOF STEP]
by (subst x_alt, simp)
[PROOF STATE]
proof (state)
this:
x ! p = enc_atom I p ((w @- sconst any) !! p)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with *(1) p_less(1)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
[PROOF STEP]
have "x = take p x @ [enc_atom I p ?p] @ drop (p + 1) x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[PROOF STEP]
using id_take_nth_drop[of p x]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
p < length x \<Longrightarrow> x = take p x @ x ! p # drop (Suc p) x

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from *(2,3,4) FQ(1) p
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FQ a m)
length I = n
(w, I) \<Turnstile> FQ a m
wf_formula n (FQ a m)
I ! m = Inl p
[PROOF STEP]
have "[enc_atom I p ?p] \<in> lang n (Atom (AQ m a))"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FQ a m)
length I = n
(w, I) \<Turnstile> FQ a m
wf_formula n (FQ a m)
I ! m = Inl p

goal (1 subgoal):
 1. [enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))
[PROOF STEP]
by (auto simp del: lang.simps intro!: enc_atom_lang_AQ)
[PROOF STATE]
proof (state)
this:
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FQ a m)
length I = n
[PROOF STEP]
have "take p x \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FQ a m)
length I = n

goal (1 subgoal):
 1. take p x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_takeD)
[PROOF STATE]
proof (state)
this:
take p x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
take p x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FQ a m)
length I = n
[PROOF STEP]
have "drop (Suc p) x \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FQ a m)
length I = n

goal (1 subgoal):
 1. drop (Suc p) x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_dropD)
[PROOF STATE]
proof (state)
this:
drop (Suc p) x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) \<Longrightarrow> x \<in> lang n (rexp_of n (FQ a m))
 2. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
show "x \<in> ?L n (FQ a m)"
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FQ a m))
[PROOF STEP]
using *(1,2,3)
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FQ a m))
[PROOF STEP]
unfolding rexp_of.simps lang.simps(6,9) rexp_of_list.simps lang_ENC_formula[OF FQ]
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (AQ m a))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp.Not Zero) @@ lang n (Atom (AQ m a)) @@ lang n (rexp.Not Zero) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FQ a m)}
[PROOF STEP]
by (auto elim: ssubst simp del: o_apply append.simps lang.simps enc.simps)
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FQ a m))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
let ?x = "x @- sconst (any, replicate n False)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
assume x: "x \<in> ?L n (FQ a m)"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FQ a m))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with FQ
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FQ a m)
x \<in> lang n (rexp_of n (FQ a m))
[PROOF STEP]
obtain w I where
      I: "x \<in> enc (w, I)" "length I = n" "wf_interp_for_formula (w, I) (FQ a m)"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FQ a m)
x \<in> lang n (rexp_of n (FQ a m))

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FQ a m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding rexp_of.simps lang.simps lang_ENC_formula[OF FQ]
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FQ a m)
x \<in> lang n (TIMES [rexp.Not Zero, Atom (AQ m a), rexp.Not Zero]) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FQ a m)}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FQ a m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
hence stream_enc: "stream_enc (w, I) = ?x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. stream_enc (w, I) = x @- sconst (any, replicate n False)
[PROOF STEP]
using stream_enc_enc
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
\<lbrakk>\<forall>x\<in>set ?I. case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P; ?v \<in> enc (?w, ?I)\<rbrakk> \<Longrightarrow> stream_enc (?w, ?I) = ?v @- sconst (any, replicate (length ?I) False)

goal (1 subgoal):
 1. stream_enc (w, I) = x @- sconst (any, replicate n False)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
stream_enc (w, I) = x @- sconst (any, replicate n False)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from I FQ
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
wf_formula n (FQ a m)
[PROOF STEP]
obtain p where m: "I ! m = Inl p" "m < length I"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
wf_formula n (FQ a m)

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>I ! m = Inl p; m < length I\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto split: sum.splits)
[PROOF STATE]
proof (state)
this:
I ! m = Inl p
m < length I

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
I ! m = Inl p
m < length I
[PROOF STEP]
have "wf_interp_for_formula (dec_word ?x, stream_dec n {m} ?x) (FQ a m)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
I ! m = Inl p
m < length I

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
[PROOF STEP]
unfolding I(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
I ! m = Inl p
m < length I

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
[PROOF STEP]
using enc_wf_interp[OF FQ(1)[folded I(2)]]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
I ! m = Inl p
m < length I
\<lbrakk>wf_interp_for_formula (?w, I) (FQ a m); ?x \<in> enc (?w, I)\<rbrakk> \<Longrightarrow> wf_interp_for_formula (dec_word (?x @- sconst (any, replicate (length I) False)), stream_dec (length I) (FOV (FQ a m)) (?x @- sconst (any, replicate (length I) False))) (FQ a m)

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FQ a m))
[PROOF STEP]
obtain u1 u u2 where "x = u1 @ u @ u2" "u \<in> lang n (Atom (AQ m a))"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FQ a m))

goal (1 subgoal):
 1. (\<And>u1 u u2. \<lbrakk>x = u1 @ u @ u2; u \<in> lang n (Atom (AQ m a))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding rexp_of.simps lang.simps rexp_of_list.simps
[PROOF STATE]
proof (prove)
using this:
x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (AQ m a) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) \<inter> lang n (ENC n (FOV (FQ a m)))

goal (1 subgoal):
 1. (\<And>u1 u u2. \<lbrakk>x = u1 @ u @ u2; u \<in> {[x] |x. lookup (AQ m a) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using concE
[PROOF STATE]
proof (prove)
using this:
x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (AQ m a) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) \<inter> lang n (ENC n (FOV (FQ a m)))
\<lbrakk>?w \<in> ?A @@ ?B; \<And>u v. \<lbrakk>u \<in> ?A; v \<in> ?B; ?w = u @ v\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>u1 u u2. \<lbrakk>x = u1 @ u @ u2; u \<in> {[x] |x. lookup (AQ m a) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x = u1 @ u @ u2
u \<in> lang n (Atom (AQ m a))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with FQ(1)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FQ a m)
x = u1 @ u @ u2
u \<in> lang n (Atom (AQ m a))
[PROOF STEP]
obtain v where v: "x = u1 @ [v] @ u2" "snd v ! m" "fst v = a"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FQ a m)
x = u1 @ u @ u2
u \<in> lang n (Atom (AQ m a))

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>x = u1 @ [v] @ u2; snd v ! m; fst v = a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using AQ_D[of u n m a]
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FQ a m)
x = u1 @ u @ u2
u \<in> lang n (Atom (AQ m a))
\<lbrakk>u \<in> lang n (Atom (AQ m a)); m < n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> \<exists>x. u = [x] \<and> fst x = a \<and> snd x ! m

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>x = u1 @ [v] @ u2; snd v ! m; fst v = a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a
[PROOF STEP]
have u: "length u1 < length x"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a

goal (1 subgoal):
 1. length u1 < length x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length u1 < length x

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
length u1 < length x

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a
[PROOF STEP]
have "snd (x ! length u1) ! m"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a

goal (1 subgoal):
 1. snd (x ! length u1) ! m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd (x ! length u1) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
snd (x ! length u1) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
[PROOF STEP]
have "p < length x" "snd (x ! p) ! m"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. p < length x &&& snd (x ! p) ! m
[PROOF STEP]
by (auto dest: enc_Inl simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
p < length x
snd (x ! p) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p < length x
snd (x ! p) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
[PROOF STEP]
have ex1: "\<exists>!p. snd (stream_enc (w, I) !! p) ! m"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. \<exists>!p. snd (stream_enc (w, I) !! p) ! m
[PROOF STEP]
by (intro stream_enc_unique) auto
[PROOF STATE]
proof (state)
this:
\<exists>!p. snd (stream_enc (w, I) !! p) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd (stream_enc (w, I) !! p) ! m
[PROOF STEP]
have "p = length u1"
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd (stream_enc (w, I) !! p) ! m

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
unfolding stream_enc
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
using u I(3)
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m
length u1 < length x
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a
[PROOF STEP]
have "v = x ! length u1"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2
snd v ! m
fst v = a

goal (1 subgoal):
 1. v = x ! length u1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v = x ! length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with u
[PROOF STATE]
proof (chain)
picking this:
length u1 < length x
v = x ! length u1
[PROOF STEP]
have "?x !! length u1 = v"
[PROOF STATE]
proof (prove)
using this:
length u1 < length x
v = x ! length u1

goal (1 subgoal):
 1. (x @- sconst (any, replicate n False)) !! length u1 = v
[PROOF STEP]
by (auto simp: shift_snth)
[PROOF STATE]
proof (state)
this:
(x @- sconst (any, replicate n False)) !! length u1 = v

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
with * m I v(3)
[PROOF STATE]
proof (chain)
picking this:
p = length u1
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
fst v = a
(x @- sconst (any, replicate n False)) !! length u1 = v
[PROOF STEP]
have "(dec_word ?x, stream_dec n {m} ?x) \<Turnstile> FQ a m"
[PROOF STATE]
proof (prove)
using this:
p = length u1
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
fst v = a
(x @- sconst (any, replicate n False)) !! length u1 = v

goal (1 subgoal):
 1. (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m
[PROOF STEP]
using stream_enc_enc[OF _ I(1), symmetric] less_length_cut_same[of w "any" "length u1" a]
[PROOF STATE]
proof (prove)
using this:
p = length u1
I ! m = Inl p
m < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
fst v = a
(x @- sconst (any, replicate n False)) !! length u1 = v
\<forall>x\<in>set I. case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> x @- sconst (any, replicate (length I) False) = stream_enc (w, I)
(w @- sconst any) !! length u1 = a \<Longrightarrow> a = any \<or> length u1 < length (cut_same any (w @- sconst any)) \<and> w ! length u1 = a

goal (1 subgoal):
 1. (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m
[PROOF STEP]
by (auto simp del: enc.simps stream_enc.simps simp: dec_word_stream_enc dest!:
        stream_dec_enc_Inl stream_dec_not_Inr split: sum.splits)
        (auto simp: smap2_alt cut_same_def)
[PROOF STATE]
proof (state)
this:
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from m I(2)
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
length I = n
[PROOF STEP]
have stream_enc_dec: "stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
length I = n

goal (1 subgoal):
 1. stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
[PROOF STEP]
by (intro stream_enc_dec)
          (auto simp: smap2_alt sdrop_snth shift_snth intro: stream_enc_unique,
           auto simp: smap2_szip stream.set_map)
[PROOF STATE]
proof (state)
this:
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
from I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)
[PROOF STEP]
have "wf_word n x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. wf_word n x
[PROOF STEP]
unfolding wf_word
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. x \<in> lists ((set \<circ> \<sigma> \<Sigma>) n)
[PROOF STEP]
by (auto elim: enc_set_\<sigma> simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
wf_word n x

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FQ a m)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x
[PROOF STEP]
show "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FQ a m) \<and> (w, I) \<Turnstile> FQ a m}
[PROOF STEP]
using m I(1,3)
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FQ a m)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FQ a m
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x
I ! m = Inl p
m < length I
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FQ a m)

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FQ a m) \<and> (w, I) \<Turnstile> FQ a m}
[PROOF STEP]
by (auto simp del: enc.simps stream_enc.simps intro!: exI[of _ "enc (dec_word ?x, stream_dec n {m} ?x)"],
          fastforce simp del: enc.simps stream_enc.simps,
          auto simp del: stream_enc.simps simp: stream_enc[symmetric] I(2))
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FQ a m) = lang n (rexp_of n (FQ a m))

goal (7 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FLess x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess x1 x2) = lang n (rexp_of n (FLess x1 x2))
 2. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 4. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 5. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 6. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 7. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FLess x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess x1 x2) = lang n (rexp_of n (FLess x1 x2))
 2. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 4. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 5. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 6. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 7. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FLess m m')
[PROOF STATE]
proof (state)
this:
wf_formula n (FLess m m')

goal (7 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FLess x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess x1 x2) = lang n (rexp_of n (FLess x1 x2))
 2. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 4. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 5. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 6. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 7. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
[PROOF STEP]
proof (cases "m = m'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = m' \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
 2. m \<noteq> m' \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
m \<noteq> m'

goal (2 subgoals):
 1. m = m' \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
 2. m \<noteq> m' \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m \<noteq> m'

goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
obtain w I where
        *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FLess m m')" "length I = n" "(w, I) \<Turnstile> FLess m m'"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FLess m m'); length I = n; (w, I) \<Turnstile> FLess m m'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FLess m m') \<and> (w, I) \<Turnstile> FLess m m'}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FLess m m'); length I = n; (w, I) \<Turnstile> FLess m m'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')
length I = n
(w, I) \<Turnstile> FLess m m'

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
hence x_alt: "x = map (case_prod (enc_atom I)) (zip [0 ..< length x] (stake (length x) (w @- sconst any)))"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')
length I = n
(w, I) \<Turnstile> FLess m m'

goal (1 subgoal):
 1. x = map2 (enc_atom I) [0..<length x] (stake (length x) (w @- sconst any))
[PROOF STEP]
by (intro encD) auto
[PROOF STATE]
proof (state)
this:
x = map2 (enc_atom I) [0..<length x] (stake (length x) (w @- sconst any))

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from FLess(1) *(2,4)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FLess m m')
wf_interp_for_formula (w, I) (FLess m m')
(w, I) \<Turnstile> FLess m m'
[PROOF STEP]
obtain p q where pq: "I ! m = Inl p" "I ! m' = Inl q" "p < q"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FLess m m')
wf_interp_for_formula (w, I) (FLess m m')
(w, I) \<Turnstile> FLess m m'

goal (1 subgoal):
 1. (\<And>p q. \<lbrakk>I ! m = Inl p; I ! m' = Inl q; p < q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: all_set_conv_all_nth split: sum.splits)
[PROOF STATE]
proof (state)
this:
I ! m = Inl p
I ! m' = Inl q
p < q

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
with FLess(1) *(1,2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FLess m m')
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')
length I = n
I ! m = Inl p
I ! m' = Inl q
p < q
[PROOF STEP]
have pq_less: "p < length x" "q < length x"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FLess m m')
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')
length I = n
I ! m = Inl p
I ! m' = Inl q
p < q

goal (1 subgoal):
 1. p < length x &&& q < length x
[PROOF STEP]
by (auto simp del: stream_enc.simps intro!: trans_less_add1[OF less_length_cut_same_Inl])
[PROOF STATE]
proof (state)
this:
p < length x
q < length x

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
hence enc_atom: "x ! p = enc_atom I p ((w @- sconst any) !! p)" (is "_ = enc_atom _ _ ?p")
                      "x ! q = enc_atom I q ((w @- sconst any) !! q)" (is "_ = enc_atom _ _ ?q")
[PROOF STATE]
proof (prove)
using this:
p < length x
q < length x

goal (1 subgoal):
 1. x ! p = enc_atom I p ((w @- sconst any) !! p) &&& x ! q = enc_atom I q ((w @- sconst any) !! q)
[PROOF STEP]
by (subst x_alt, simp)+
[PROOF STATE]
proof (state)
this:
x ! p = enc_atom I p ((w @- sconst any) !! p)
x ! q = enc_atom I q ((w @- sconst any) !! q)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
with *(1) pq_less(1)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
x ! q = enc_atom I q ((w @- sconst any) !! q)
[PROOF STEP]
have "x = take p x @ [enc_atom I p ?p] @ drop (p + 1) x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
x ! q = enc_atom I q ((w @- sconst any) !! q)

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[PROOF STEP]
using id_take_nth_drop[of p x]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
x ! q = enc_atom I q ((w @- sconst any) !! q)
p < length x \<Longrightarrow> x = take p x @ x ! p # drop (Suc p) x

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
have "drop (p + 1) x = take (q - p - 1) (drop (p + 1) x) @
        [enc_atom I q ?q] @ drop (q - p) (drop (p + 1) x)" (is "_ = ?LHS")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop (p + 1) x = take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[PROOF STEP]
using id_take_nth_drop[of "q - p - 1" "drop (p + 1) x"] pq pq_less(2) enc_atom(2)
[PROOF STATE]
proof (prove)
using this:
q - p - 1 < length (drop (p + 1) x) \<Longrightarrow> drop (p + 1) x = take (q - p - 1) (drop (p + 1) x) @ drop (p + 1) x ! (q - p - 1) # drop (Suc (q - p - 1)) (drop (p + 1) x)
I ! m = Inl p
I ! m' = Inl q
p < q
q < length x
x ! q = enc_atom I q ((w @- sconst any) !! q)

goal (1 subgoal):
 1. drop (p + 1) x = take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
drop (p + 1) x = take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[PROOF STEP]
have "x = take p x @ [enc_atom I p ?p] @ ?LHS"
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from *(2,3) FLess(1) pq(1)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
wf_formula n (FLess m m')
I ! m = Inl p
[PROOF STEP]
have "[enc_atom I p ?p] \<in> lang n (Atom (Arbitrary_Except m True))"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
wf_formula n (FLess m m')
I ! m = Inl p

goal (1 subgoal):
 1. [enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))
[PROOF STEP]
by (intro enc_atom_lang_Arbitrary_Except_True) (auto simp: shift_snth)
[PROOF STATE]
proof (state)
this:
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from *(2,3) FLess(1) pq(2)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
wf_formula n (FLess m m')
I ! m' = Inl q
[PROOF STEP]
have "[enc_atom I q ?q] \<in> lang n (Atom (Arbitrary_Except m' True))"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
wf_formula n (FLess m m')
I ! m' = Inl q

goal (1 subgoal):
 1. [enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))
[PROOF STEP]
by (intro enc_atom_lang_Arbitrary_Except_True) (auto simp: shift_snth)
[PROOF STATE]
proof (state)
this:
[enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
[PROOF STEP]
have "take p x \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n

goal (1 subgoal):
 1. take p x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_takeD)
[PROOF STATE]
proof (state)
this:
take p x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
take p x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
[PROOF STEP]
have "take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n

goal (1 subgoal):
 1. take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_dropD in_set_takeD)
[PROOF STATE]
proof (state)
this:
take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n
[PROOF STEP]
have "drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FLess m m')
length I = n

goal (1 subgoal):
 1. drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_dropD)
[PROOF STATE]
proof (state)
this:
drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')\<rbrakk> \<Longrightarrow> x \<in> lang n (rexp_of n (FLess m m'))
 2. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))
[enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))
take p x \<in> lang n (rexp.Not Zero)
take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
[PROOF STEP]
show "x \<in> ?L n (FLess m m')"
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))
[enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))
take p x \<in> lang n (rexp.Not Zero)
take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FLess m m'))
[PROOF STEP]
using *(1,2,3)
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))
[enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))
take p x \<in> lang n (rexp.Not Zero)
take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FLess m m'))
[PROOF STEP]
unfolding rexp_of.simps lang.simps(6,9) rexp_of_list.simps Int_Diff lang_ENC_formula[OF FLess] if_not_P[OF False]
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ take (q - p - 1) (drop (p + 1) x) @ [enc_atom I q ((w @- sconst any) !! q)] @ drop (q - p) (drop (p + 1) x)
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except m True))
[enc_atom I q ((w @- sconst any) !! q)] \<in> lang n (Atom (Arbitrary_Except m' True))
take p x \<in> lang n (rexp.Not Zero)
take (q - p - 1) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
drop (q - p) (drop (Suc p) x) \<in> lang n (rexp.Not Zero)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp.Not Zero) @@ lang n (Atom (Arbitrary_Except m True)) @@ lang n (rexp.Not Zero) @@ lang n (Atom (Arbitrary_Except m' True)) @@ lang n (rexp.Not Zero) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FLess m m')}
[PROOF STEP]
by (auto elim: ssubst simp del: o_apply append.simps lang.simps enc.simps)
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FLess m m'))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
let ?x = "x @- sconst (any, replicate n False)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
assume x: "x \<in> ?L n (FLess m m')"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FLess m m'))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
with FLess
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FLess m m')
x \<in> lang n (rexp_of n (FLess m m'))
[PROOF STEP]
obtain w I where
        I: "x \<in> enc (w, I)" "length I = n" "wf_interp_for_formula (w, I) (FLess m m')"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FLess m m')
x \<in> lang n (rexp_of n (FLess m m'))

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FLess m m')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding rexp_of.simps lang.simps lang_ENC_formula[OF FLess] if_not_P[OF False]
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FLess m m')
x \<in> lang n (TIMES [rexp.Not Zero, Atom (Arbitrary_Except m True), rexp.Not Zero, Atom (Arbitrary_Except m' True), rexp.Not Zero]) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FLess m m')}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FLess m m')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
hence stream_enc: "stream_enc (w, I) = x @- sconst (any, replicate n False)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. stream_enc (w, I) = x @- sconst (any, replicate n False)
[PROOF STEP]
using stream_enc_enc
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
\<lbrakk>\<forall>x\<in>set ?I. case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P; ?v \<in> enc (?w, ?I)\<rbrakk> \<Longrightarrow> stream_enc (?w, ?I) = ?v @- sconst (any, replicate (length ?I) False)

goal (1 subgoal):
 1. stream_enc (w, I) = x @- sconst (any, replicate n False)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
stream_enc (w, I) = x @- sconst (any, replicate n False)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from I FLess
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
wf_formula n (FLess m m')
[PROOF STEP]
obtain p p' where m: "I ! m = Inl p" "m < length I" "I ! m' = Inl p'" "m' < length I"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
wf_formula n (FLess m m')

goal (1 subgoal):
 1. (\<And>p p'. \<lbrakk>I ! m = Inl p; m < length I; I ! m' = Inl p'; m' < length I\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto split: sum.splits)
[PROOF STATE]
proof (state)
this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
with I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
[PROOF STEP]
have "wf_interp_for_formula (dec_word ?x, stream_dec n {m, m'} ?x) (FLess m m')"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
[PROOF STEP]
unfolding I(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
[PROOF STEP]
using enc_wf_interp[OF FLess(1)[folded I(2)]]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
\<lbrakk>wf_interp_for_formula (?w, I) (FLess m m'); ?x \<in> enc (?w, I)\<rbrakk> \<Longrightarrow> wf_interp_for_formula (dec_word (?x @- sconst (any, replicate (length I) False)), stream_dec (length I) (FOV (FLess m m')) (?x @- sconst (any, replicate (length I) False))) (FLess m m')

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FLess m m'))
[PROOF STEP]
obtain u1 u u2 u' u3 where "x = u1 @ u @ u2 @ u' @ u3"
        "u \<in> lang n (Atom (Arbitrary_Except m True))" "u' \<in> lang n (Atom (Arbitrary_Except m' True))"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FLess m m'))

goal (1 subgoal):
 1. (\<And>u1 u u2 u' u3. \<lbrakk>x = u1 @ u @ u2 @ u' @ u3; u \<in> lang n (Atom (Arbitrary_Except m True)); u' \<in> lang n (Atom (Arbitrary_Except m' True))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding rexp_of.simps lang.simps rexp_of_list.simps if_not_P[OF False]
[PROOF STATE]
proof (prove)
using this:
x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (Arbitrary_Except m True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (Arbitrary_Except m' True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) \<inter> lang n (ENC n (FOV (FLess m m')))

goal (1 subgoal):
 1. (\<And>u1 u u2 u' u3. \<lbrakk>x = u1 @ u @ u2 @ u' @ u3; u \<in> {[x] |x. lookup (Arbitrary_Except m True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}; u' \<in> {[x] |x. lookup (Arbitrary_Except m' True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using concE
[PROOF STATE]
proof (prove)
using this:
x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (Arbitrary_Except m True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (Arbitrary_Except m' True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) \<inter> lang n (ENC n (FOV (FLess m m')))
\<lbrakk>?w \<in> ?A @@ ?B; \<And>u v. \<lbrakk>u \<in> ?A; v \<in> ?B; ?w = u @ v\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>u1 u u2 u' u3. \<lbrakk>x = u1 @ u @ u2 @ u' @ u3; u \<in> {[x] |x. lookup (Arbitrary_Except m True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}; u' \<in> {[x] |x. lookup (Arbitrary_Except m' True) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x = u1 @ u @ u2 @ u' @ u3
u \<in> lang n (Atom (Arbitrary_Except m True))
u' \<in> lang n (Atom (Arbitrary_Except m' True))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
with FLess(1)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FLess m m')
x = u1 @ u @ u2 @ u' @ u3
u \<in> lang n (Atom (Arbitrary_Except m True))
u' \<in> lang n (Atom (Arbitrary_Except m' True))
[PROOF STEP]
obtain v v' where v: "x = u1 @ [v] @ u2 @ [v'] @ u3"
         "snd v ! m" "snd v' ! m'" "fst v \<in> set \<Sigma>" "fst v' \<in> set \<Sigma>"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FLess m m')
x = u1 @ u @ u2 @ u' @ u3
u \<in> lang n (Atom (Arbitrary_Except m True))
u' \<in> lang n (Atom (Arbitrary_Except m' True))

goal (1 subgoal):
 1. (\<And>v v'. \<lbrakk>x = u1 @ [v] @ u2 @ [v'] @ u3; snd v ! m; snd v' ! m'; fst v \<in> set \<Sigma>; fst v' \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Arbitrary_ExceptD[of u n m True] Arbitrary_ExceptD[of u' n m' True]
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FLess m m')
x = u1 @ u @ u2 @ u' @ u3
u \<in> lang n (Atom (Arbitrary_Except m True))
u' \<in> lang n (Atom (Arbitrary_Except m' True))
\<lbrakk>u \<in> lang n (Atom (Arbitrary_Except m True)); m < n\<rbrakk> \<Longrightarrow> \<exists>x. u = [x] \<and> snd x ! m = True
\<lbrakk>u' \<in> lang n (Atom (Arbitrary_Except m' True)); m' < n\<rbrakk> \<Longrightarrow> \<exists>x. u' = [x] \<and> snd x ! m' = True

goal (1 subgoal):
 1. (\<And>v v'. \<lbrakk>x = u1 @ [v] @ u2 @ [v'] @ u3; snd v ! m; snd v' ! m'; fst v \<in> set \<Sigma>; fst v' \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp (auto simp: \<sigma>_def)
[PROOF STATE]
proof (state)
this:
x = u1 @ [v] @ u2 @ [v'] @ u3
snd v ! m
snd v' ! m'
fst v \<in> set \<Sigma>
fst v' \<in> set \<Sigma>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
hence u: "length u1 < length x" and u': "Suc (length u1 + length u2) < length x" (is "?u' < _")
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2 @ [v'] @ u3
snd v ! m
snd v' ! m'
fst v \<in> set \<Sigma>
fst v' \<in> set \<Sigma>

goal (1 subgoal):
 1. length u1 < length x &&& Suc (length u1 + length u2) < length x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length u1 < length x
Suc (length u1 + length u2) < length x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
length u1 < length x
Suc (length u1 + length u2) < length x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2 @ [v'] @ u3
snd v ! m
snd v' ! m'
fst v \<in> set \<Sigma>
fst v' \<in> set \<Sigma>
[PROOF STEP]
have "snd (x ! length u1) ! m"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2 @ [v'] @ u3
snd v ! m
snd v' ! m'
fst v \<in> set \<Sigma>
fst v' \<in> set \<Sigma>

goal (1 subgoal):
 1. snd (x ! length u1) ! m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd (x ! length u1) ! m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
snd (x ! length u1) ! m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
[PROOF STEP]
have "p < length x" "snd (x ! p) ! m"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. p < length x &&& snd (x ! p) ! m
[PROOF STEP]
by (auto dest: enc_Inl simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
p < length x
snd (x ! p) ! m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p < length x
snd (x ! p) ! m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
[PROOF STEP]
have ex1: "\<exists>!p. snd (stream_enc (w, I) !! p) ! m"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. \<exists>!p. snd (stream_enc (w, I) !! p) ! m
[PROOF STEP]
by (intro stream_enc_unique) auto
[PROOF STATE]
proof (state)
this:
\<exists>!p. snd (stream_enc (w, I) !! p) ! m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd (stream_enc (w, I) !! p) ! m
[PROOF STEP]
have "p = length u1"
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd (stream_enc (w, I) !! p) ! m

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
unfolding stream_enc
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
using u I(3)
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m
length u1 < length x
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2 @ [v'] @ u3
snd v ! m
snd v' ! m'
fst v \<in> set \<Sigma>
fst v' \<in> set \<Sigma>
[PROOF STEP]
have "snd (x ! ?u') ! m'"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2 @ [v'] @ u3
snd v ! m
snd v' ! m'
fst v \<in> set \<Sigma>
fst v' \<in> set \<Sigma>

goal (1 subgoal):
 1. snd (x ! Suc (length u1 + length u2)) ! m'
[PROOF STEP]
by (auto simp: nth_append)
[PROOF STATE]
proof (state)
this:
snd (x ! Suc (length u1 + length u2)) ! m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
snd (x ! Suc (length u1 + length u2)) ! m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
[PROOF STEP]
have "p' < length x" "snd (x ! p') ! m'"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. p' < length x &&& snd (x ! p') ! m'
[PROOF STEP]
by (auto dest: enc_Inl simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
p' < length x
snd (x ! p') ! m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p' < length x
snd (x ! p') ! m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
[PROOF STEP]
have ex1: "\<exists>!p. snd (stream_enc (w, I) !! p) ! m'"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. \<exists>!p. snd (stream_enc (w, I) !! p) ! m'
[PROOF STEP]
unfolding I(1)
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. \<exists>!p. snd (stream_enc (w, I) !! p) ! m'
[PROOF STEP]
by (intro stream_enc_unique) auto
[PROOF STATE]
proof (state)
this:
\<exists>!p. snd (stream_enc (w, I) !! p) ! m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
snd (x ! Suc (length u1 + length u2)) ! m'
p' < length x
snd (x ! p') ! m'
\<exists>!p. snd (stream_enc (w, I) !! p) ! m'
[PROOF STEP]
have "p' = ?u'"
[PROOF STATE]
proof (prove)
using this:
snd (x ! Suc (length u1 + length u2)) ! m'
p' < length x
snd (x ! p') ! m'
\<exists>!p. snd (stream_enc (w, I) !! p) ! m'

goal (1 subgoal):
 1. p' = Suc (length u1 + length u2)
[PROOF STEP]
unfolding stream_enc
[PROOF STATE]
proof (prove)
using this:
snd (x ! Suc (length u1 + length u2)) ! m'
p' < length x
snd (x ! p') ! m'
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m'

goal (1 subgoal):
 1. p' = Suc (length u1 + length u2)
[PROOF STEP]
using u' I(3)
[PROOF STATE]
proof (prove)
using this:
snd (x ! Suc (length u1 + length u2)) ! m'
p' < length x
snd (x ! p') ! m'
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m'
Suc (length u1 + length u2) < length x
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. p' = Suc (length u1 + length u2)
[PROOF STEP]
by auto (metis shift_snth_less)
[PROOF STATE]
proof (state)
this:
p' = Suc (length u1 + length u2)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p' = Suc (length u1 + length u2)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
note * = this \<open>p = length u1\<close>
[PROOF STATE]
proof (state)
this:
p' = Suc (length u1 + length u2)
p = length u1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
with m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
p' = Suc (length u1 + length u2)
p = length u1
[PROOF STEP]
have "(dec_word ?x, stream_dec n {m, m'} ?x) \<Turnstile> FLess m m'"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
p' = Suc (length u1 + length u2)
p = length u1

goal (1 subgoal):
 1. (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'
[PROOF STEP]
using stream_enc_enc[OF _ I(1), symmetric]
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
p' = Suc (length u1 + length u2)
p = length u1
\<forall>x\<in>set I. case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> x @- sconst (any, replicate (length I) False) = stream_enc (w, I)

goal (1 subgoal):
 1. (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'
[PROOF STEP]
by (auto dest: stream_dec_not_Inr stream_dec_enc_Inl split: sum.splits simp del: stream_enc.simps)
[PROOF STATE]
proof (state)
this:
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from m I(2)
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
length I = n
[PROOF STEP]
have stream_enc_dec: "stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
length I = n

goal (1 subgoal):
 1. stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)
[PROOF STEP]
by (intro stream_enc_dec)
          (auto simp: smap2_alt sdrop_snth shift_snth intro: stream_enc_unique,
           auto simp: smap2_szip stream.set_map)
[PROOF STATE]
proof (state)
this:
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
from I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')
[PROOF STEP]
have "wf_word n x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. wf_word n x
[PROOF STEP]
unfolding wf_word
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. x \<in> lists ((set \<circ> \<sigma> \<Sigma>) n)
[PROOF STEP]
by (auto elim: enc_set_\<sigma> simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
wf_word n x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>m \<noteq> m'; x \<in> lang n (rexp_of n (FLess m m'))\<rbrakk> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x
[PROOF STEP]
show "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FLess m m') \<and> (w, I) \<Turnstile> FLess m m'}
[PROOF STEP]
using m I(1,3)
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) (FLess m m')
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m, m'} (x @- sconst (any, replicate n False))) \<Turnstile> FLess m m'
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m, m'} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x
I ! m = Inl p
m < length I
I ! m' = Inl p'
m' < length I
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FLess m m')

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FLess m m') \<and> (w, I) \<Turnstile> FLess m m'}
[PROOF STEP]
by (auto simp del: enc.simps stream_enc.simps intro!: exI[of _ "enc (dec_word ?x, stream_dec n {m, m'} ?x)"],
          fastforce simp del: enc.simps stream_enc.simps,
          auto simp del: stream_enc.simps simp: stream_enc[symmetric] I(2))
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))

goal (1 subgoal):
 1. m = m' \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))
[PROOF STEP]
qed (simp add: lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def del: o_apply)
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FLess m m') = lang n (rexp_of n (FLess m m'))

goal (6 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 4. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 6. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 4. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 6. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FIn m M)
[PROOF STATE]
proof (state)
this:
wf_formula n (FIn m M)

goal (6 subgoals):
 1. \<And>x1 x2 n. wf_formula n (FIn x1 x2) \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn x1 x2) = lang n (rexp_of n (FIn x1 x2))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 4. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 6. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) = lang n (rexp_of n (FIn m M))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
obtain w I where
      *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FIn m M)" "length I = n" "(w, I) \<Turnstile> FIn m M"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FIn m M); length I = n; (w, I) \<Turnstile> FIn m M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FIn m M) \<and> (w, I) \<Turnstile> FIn m M}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FIn m M); length I = n; (w, I) \<Turnstile> FIn m M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
length I = n
(w, I) \<Turnstile> FIn m M

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
hence x_alt: "x = map (case_prod (enc_atom I)) (zip [0 ..< length x] (stake (length x) (w @- sconst any)))"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
length I = n
(w, I) \<Turnstile> FIn m M

goal (1 subgoal):
 1. x = map2 (enc_atom I) [0..<length x] (stake (length x) (w @- sconst any))
[PROOF STEP]
by (intro encD) auto
[PROOF STATE]
proof (state)
this:
x = map2 (enc_atom I) [0..<length x] (stake (length x) (w @- sconst any))

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from FIn(1) *(2,4)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FIn m M)
wf_interp_for_formula (w, I) (FIn m M)
(w, I) \<Turnstile> FIn m M
[PROOF STEP]
obtain p P where p: "I ! m = Inl p" "I ! M = Inr P" "p \<in> P"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FIn m M)
wf_interp_for_formula (w, I) (FIn m M)
(w, I) \<Turnstile> FIn m M

goal (1 subgoal):
 1. (\<And>p P. \<lbrakk>I ! m = Inl p; I ! M = Inr P; p \<in> P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: all_set_conv_all_nth split: sum.splits)
[PROOF STATE]
proof (state)
this:
I ! m = Inl p
I ! M = Inr P
p \<in> P

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with FIn(1) *(1,2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FIn m M)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
length I = n
I ! m = Inl p
I ! M = Inr P
p \<in> P
[PROOF STEP]
have p_less: "p < length x" "\<forall>p \<in> P. p < length x"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FIn m M)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
length I = n
I ! m = Inl p
I ! M = Inr P
p \<in> P

goal (1 subgoal):
 1. p < length x &&& \<forall>p\<in>P. p < length x
[PROOF STEP]
by (auto simp del: stream_enc.simps intro: trans_less_add1[OF less_length_cut_same_Inl]
        trans_less_add1[OF bspec[OF less_length_cut_same_Inr]])
[PROOF STATE]
proof (state)
this:
p < length x
\<forall>p\<in>P. p < length x

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
hence enc_atom: "x ! p = enc_atom I p ((w @- sconst any) !! p)" (is "_ = enc_atom _ _ ?p")
            "\<forall>p \<in> P. x ! p = enc_atom I p ((w @- sconst any) !! p)" (is "Ball _ (\<lambda>p. _ = enc_atom _ _ (?P p))")
[PROOF STATE]
proof (prove)
using this:
p < length x
\<forall>p\<in>P. p < length x

goal (1 subgoal):
 1. x ! p = enc_atom I p ((w @- sconst any) !! p) &&& \<forall>p\<in>P. x ! p = enc_atom I p ((w @- sconst any) !! p)
[PROOF STEP]
by (subst x_alt, simp)+
[PROOF STATE]
proof (state)
this:
x ! p = enc_atom I p ((w @- sconst any) !! p)
\<forall>p\<in>P. x ! p = enc_atom I p ((w @- sconst any) !! p)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with *(1) p_less(1)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
\<forall>p\<in>P. x ! p = enc_atom I p ((w @- sconst any) !! p)
[PROOF STEP]
have "x = take p x @ [enc_atom I p ?p] @ drop (p + 1) x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
\<forall>p\<in>P. x ! p = enc_atom I p ((w @- sconst any) !! p)

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[PROOF STEP]
using id_take_nth_drop[of p x]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
p < length x
x ! p = enc_atom I p ((w @- sconst any) !! p)
\<forall>p\<in>P. x ! p = enc_atom I p ((w @- sconst any) !! p)
p < length x \<Longrightarrow> x = take p x @ x ! p # drop (Suc p) x

goal (1 subgoal):
 1. x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from *(2,3) FIn(1) p
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FIn m M)
length I = n
wf_formula n (FIn m M)
I ! m = Inl p
I ! M = Inr P
p \<in> P
[PROOF STEP]
have "[enc_atom I p ?p] \<in> lang n (Atom (Arbitrary_Except2 m M))"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FIn m M)
length I = n
wf_formula n (FIn m M)
I ! m = Inl p
I ! M = Inr P
p \<in> P

goal (1 subgoal):
 1. [enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))
[PROOF STEP]
by (intro enc_atom_lang_Arbitrary_Except2) (auto simp: shift_snth)
[PROOF STATE]
proof (state)
this:
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FIn m M)
length I = n
[PROOF STEP]
have "take p x \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FIn m M)
length I = n

goal (1 subgoal):
 1. take p x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_takeD)
[PROOF STATE]
proof (state)
this:
take p x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
take p x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from *(2,3)
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (w, I) (FIn m M)
length I = n
[PROOF STEP]
have "drop (Suc p) x \<in> lang n (rexp.Not Zero)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (w, I) (FIn m M)
length I = n

goal (1 subgoal):
 1. drop (Suc p) x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
by (subst x_alt) (auto simp: in_set_zip shift_snth intro!: enc_atom_\<sigma> dest!: in_set_dropD)
[PROOF STATE]
proof (state)
this:
drop (Suc p) x \<in> lang n (rexp.Not Zero)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) \<Longrightarrow> x \<in> lang n (rexp_of n (FIn m M))
 2. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)
[PROOF STEP]
show "x \<in> ?L n (FIn m M)"
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FIn m M))
[PROOF STEP]
using *(1,2,3)
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FIn m M))
[PROOF STEP]
unfolding rexp_of.simps lang.simps(6,9) rexp_of_list.simps Int_Diff lang_ENC_formula[OF FIn]
[PROOF STATE]
proof (prove)
using this:
x = take p x @ [enc_atom I p ((w @- sconst any) !! p)] @ drop (p + 1) x
[enc_atom I p ((w @- sconst any) !! p)] \<in> lang n (Atom (Arbitrary_Except2 m M))
take p x \<in> lang n (rexp.Not Zero)
drop (Suc p) x \<in> lang n (rexp.Not Zero)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp.Not Zero) @@ lang n (Atom (Arbitrary_Except2 m M)) @@ lang n (rexp.Not Zero) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FIn m M)}
[PROOF STEP]
by (auto elim: ssubst simp del: o_apply append.simps lang.simps enc.simps)
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FIn m M))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
let ?x = "x @- sconst (any, replicate n False)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
assume x: "x \<in> ?L n (FIn m M)"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FIn m M))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with FIn
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FIn m M)
x \<in> lang n (rexp_of n (FIn m M))
[PROOF STEP]
obtain w I where
      I: "x \<in> enc (w, I)" "length I = n" "wf_interp_for_formula (w, I) (FIn m M)"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FIn m M)
x \<in> lang n (rexp_of n (FIn m M))

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FIn m M)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding rexp_of.simps lang.simps lang_ENC_formula[OF FIn]
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FIn m M)
x \<in> lang n (TIMES [rexp.Not Zero, Atom (Arbitrary_Except2 m M), rexp.Not Zero]) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FIn m M)}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FIn m M)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
hence stream_enc: "stream_enc (w, I) = ?x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. stream_enc (w, I) = x @- sconst (any, replicate n False)
[PROOF STEP]
using stream_enc_enc
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
\<lbrakk>\<forall>x\<in>set ?I. case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P; ?v \<in> enc (?w, ?I)\<rbrakk> \<Longrightarrow> stream_enc (?w, ?I) = ?v @- sconst (any, replicate (length ?I) False)

goal (1 subgoal):
 1. stream_enc (w, I) = x @- sconst (any, replicate n False)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
stream_enc (w, I) = x @- sconst (any, replicate n False)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from I FIn
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
wf_formula n (FIn m M)
[PROOF STEP]
obtain p P where m: "I ! m = Inl p" "m < length I" "I ! M = Inr P" "M < length I"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
wf_formula n (FIn m M)

goal (1 subgoal):
 1. (\<And>p P. \<lbrakk>I ! m = Inl p; m < length I; I ! M = Inr P; M < length I\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto split: sum.splits)
[PROOF STATE]
proof (state)
this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
[PROOF STEP]
have "wf_interp_for_formula (dec_word ?x, stream_dec n {m} ?x) (FIn m M)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
[PROOF STEP]
unfolding I(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
[PROOF STEP]
using enc_wf_interp[OF FIn(1)[folded I(2)]]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
\<lbrakk>wf_interp_for_formula (?w, I) (FIn m M); ?x \<in> enc (?w, I)\<rbrakk> \<Longrightarrow> wf_interp_for_formula (dec_word (?x @- sconst (any, replicate (length I) False)), stream_dec (length I) (FOV (FIn m M)) (?x @- sconst (any, replicate (length I) False))) (FIn m M)

goal (1 subgoal):
 1. wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FIn m M))
[PROOF STEP]
obtain u1 u u2 where "x = u1 @ u @ u2"
      "u \<in> lang n (Atom (Arbitrary_Except2 m M))"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FIn m M))

goal (1 subgoal):
 1. (\<And>u1 u u2. \<lbrakk>x = u1 @ u @ u2; u \<in> lang n (Atom (Arbitrary_Except2 m M))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding rexp_of.simps lang.simps rexp_of_list.simps
[PROOF STATE]
proof (prove)
using this:
x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (Arbitrary_Except2 m M) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) \<inter> lang n (ENC n (FOV (FIn m M)))

goal (1 subgoal):
 1. (\<And>u1 u u2. \<lbrakk>x = u1 @ u @ u2; u \<in> {[x] |x. lookup (Arbitrary_Except2 m M) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using concE
[PROOF STATE]
proof (prove)
using this:
x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) @@ {[x] |x. lookup (Arbitrary_Except2 m M) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n} @@ (lists ((set \<circ> \<sigma> \<Sigma>) n) - {}) \<inter> lang n (ENC n (FOV (FIn m M)))
\<lbrakk>?w \<in> ?A @@ ?B; \<And>u v. \<lbrakk>u \<in> ?A; v \<in> ?B; ?w = u @ v\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>u1 u u2. \<lbrakk>x = u1 @ u @ u2; u \<in> {[x] |x. lookup (Arbitrary_Except2 m M) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x = u1 @ u @ u2
u \<in> lang n (Atom (Arbitrary_Except2 m M))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with FIn(1)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FIn m M)
x = u1 @ u @ u2
u \<in> lang n (Atom (Arbitrary_Except2 m M))
[PROOF STEP]
obtain v where v: "x = u1 @ [v] @ u2" "snd v ! m" "snd v ! M" and "fst v \<in> set \<Sigma>"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FIn m M)
x = u1 @ u @ u2
u \<in> lang n (Atom (Arbitrary_Except2 m M))

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>x = u1 @ [v] @ u2; snd v ! m; snd v ! M; fst v \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Arbitrary_Except2D[of u n m M]
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FIn m M)
x = u1 @ u @ u2
u \<in> lang n (Atom (Arbitrary_Except2 m M))
\<lbrakk>u \<in> lang n (Atom (Arbitrary_Except2 m M)); m < n; M < n\<rbrakk> \<Longrightarrow> \<exists>x. u = [x] \<and> snd x ! m \<and> snd x ! M

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>x = u1 @ [v] @ u2; snd v ! m; snd v ! M; fst v \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp (auto simp: \<sigma>_def)
[PROOF STATE]
proof (state)
this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M
fst v \<in> set \<Sigma>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M
[PROOF STEP]
have u: "length u1 < length x"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M

goal (1 subgoal):
 1. length u1 < length x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length u1 < length x

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
length u1 < length x

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M
[PROOF STEP]
have "snd (x ! length u1) ! m"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M

goal (1 subgoal):
 1. snd (x ! length u1) ! m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd (x ! length u1) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
snd (x ! length u1) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
[PROOF STEP]
have "p < length x" "snd (x ! p) ! m"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. p < length x &&& snd (x ! p) ! m
[PROOF STEP]
by (auto dest: enc_Inl simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
p < length x
snd (x ! p) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p < length x
snd (x ! p) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from m I
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
[PROOF STEP]
have ex1: "\<exists>!p. snd (stream_enc (w, I) !! p) ! m"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. \<exists>!p. snd (stream_enc (w, I) !! p) ! m
[PROOF STEP]
by (intro stream_enc_unique) auto
[PROOF STATE]
proof (state)
this:
\<exists>!p. snd (stream_enc (w, I) !! p) ! m

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd (stream_enc (w, I) !! p) ! m
[PROOF STEP]
have "p = length u1"
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd (stream_enc (w, I) !! p) ! m

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
unfolding stream_enc
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
using u I(3)
[PROOF STATE]
proof (prove)
using this:
snd (x ! length u1) ! m
p < length x
snd (x ! p) ! m
\<exists>!p. snd ((x @- sconst (any, replicate n False)) !! p) ! m
length u1 < length x
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. p = length u1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
p = length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M
[PROOF STEP]
have "v = x ! length u1"
[PROOF STATE]
proof (prove)
using this:
x = u1 @ [v] @ u2
snd v ! m
snd v ! M

goal (1 subgoal):
 1. v = x ! length u1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v = x ! length u1

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with v(3) m(3,4) u I(1,3)
[PROOF STATE]
proof (chain)
picking this:
snd v ! M
I ! M = Inr P
M < length I
length u1 < length x
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
v = x ! length u1
[PROOF STEP]
have "length u1 \<in> P"
[PROOF STATE]
proof (prove)
using this:
snd v ! M
I ! M = Inr P
M < length I
length u1 < length x
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)
v = x ! length u1

goal (1 subgoal):
 1. length u1 \<in> P
[PROOF STEP]
by (auto dest!: enc_Inr simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
length u1 \<in> P

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
with * m I
[PROOF STATE]
proof (chain)
picking this:
p = length u1
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
length u1 \<in> P
[PROOF STEP]
have "(dec_word ?x, stream_dec n {m} ?x) \<Turnstile> FIn m M"
[PROOF STATE]
proof (prove)
using this:
p = length u1
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
length u1 \<in> P

goal (1 subgoal):
 1. (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M
[PROOF STEP]
using stream_enc_enc[OF _ I(1), symmetric]
[PROOF STATE]
proof (prove)
using this:
p = length u1
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
length u1 \<in> P
\<forall>x\<in>set I. case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> x @- sconst (any, replicate (length I) False) = stream_enc (w, I)

goal (1 subgoal):
 1. (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M
[PROOF STEP]
by (auto simp del: stream_enc.simps dest: stream_dec_not_Inr stream_dec_not_Inl
        stream_dec_enc_Inl stream_dec_enc_Inr split: sum.splits)
[PROOF STATE]
proof (state)
this:
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from m I(2)
[PROOF STATE]
proof (chain)
picking this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
length I = n
[PROOF STEP]
have stream_enc_dec: "stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)"
[PROOF STATE]
proof (prove)
using this:
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
length I = n

goal (1 subgoal):
 1. stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
[PROOF STEP]
by (intro stream_enc_dec)
          (auto simp: smap2_alt sdrop_snth shift_snth intro: stream_enc_unique,
           auto simp: smap2_szip stream.set_map)
[PROOF STATE]
proof (state)
this:
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
from I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)
[PROOF STEP]
have "wf_word n x"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. wf_word n x
[PROOF STEP]
unfolding wf_word
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. x \<in> lists ((set \<circ> \<sigma> \<Sigma>) n)
[PROOF STEP]
by (auto elim: enc_set_\<sigma> simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
wf_word n x

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FIn m M)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x
[PROOF STEP]
show "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)"
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FIn m M) \<and> (w, I) \<Turnstile> FIn m M}
[PROOF STEP]
using m I(1,3)
[PROOF STATE]
proof (prove)
using this:
wf_interp_for_formula (dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) (FIn m M)
(dec_word (x @- sconst (any, replicate n False)), stream_dec n {m} (x @- sconst (any, replicate n False))) \<Turnstile> FIn m M
stream_enc (dec_word (stream_enc (w, I)), stream_dec n {m} (stream_enc (w, I))) = stream_enc (w, I)
wf_word n x
I ! m = Inl p
m < length I
I ! M = Inr P
M < length I
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FIn m M)

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FIn m M) \<and> (w, I) \<Turnstile> FIn m M}
[PROOF STEP]
by (auto simp del: enc.simps stream_enc.simps intro!: exI[of _ "enc (dec_word ?x, stream_dec n {m} ?x)"],
          fastforce simp del: enc.simps stream_enc.simps,
          auto simp del: stream_enc.simps simp: stream_enc[symmetric] I(2))
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FIn m M) = lang n (rexp_of n (FIn m M))

goal (5 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STATE]
proof (state)
this:
wf_formula ?n2 \<phi>\<^sub>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi>\<^sub>1 = lang ?n2 (rexp_of ?n2 \<phi>\<^sub>1)
wf_formula ?n2 \<phi>\<^sub>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi>\<^sub>2 = lang ?n2 (rexp_of ?n2 \<phi>\<^sub>2)
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (5 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
from FOr(3)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
have IH1: "lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 = lang n (rexp_of n \<phi>\<^sub>1)"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 = lang n (rexp_of n \<phi>\<^sub>1)
[PROOF STEP]
by (intro FOr(1)) auto
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 = lang n (rexp_of n \<phi>\<^sub>1)

goal (5 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
from FOr(3)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
have IH2: "lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 = lang n (rexp_of n \<phi>\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 = lang n (rexp_of n \<phi>\<^sub>2)
[PROOF STEP]
by (intro FOr(2)) auto
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 = lang n (rexp_of n \<phi>\<^sub>2)

goal (5 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FOr \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>1 \<phi>2) = lang n (rexp_of n (FOr \<phi>1 \<phi>2))
 3. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 5. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) = lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) \<Longrightarrow> x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
 2. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) \<Longrightarrow> x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
 2. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) \<Longrightarrow> x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
 2. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
thus "x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
using lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_FOr[OF FOr(3)]
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) \<subseteq> (lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<union> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)}

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
unfolding lang_ENC_formula[OF FOr(3)] rexp_of.simps lang.simps IH1 IH2
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) \<subseteq> (lang n (rexp_of n \<phi>\<^sub>1) \<union> lang n (rexp_of n \<phi>\<^sub>2)) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)}

goal (1 subgoal):
 1. x \<in> (lang n (rexp_of n \<phi>\<^sub>1) \<union> lang n (rexp_of n \<phi>\<^sub>2)) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
assume "x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
obtain w I where or: "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<or> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2" and I: "x \<in> enc (w, I)" "length I = n"
      "wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<or> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2; x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang_ENC_formula[OF FOr(3)] rexp_of.simps lang.simps IH1 IH2 Int_Diff
[PROOF STATE]
proof (prove)
using this:
x \<in> (lang n (rexp_of n \<phi>\<^sub>1) \<union> lang n (rexp_of n \<phi>\<^sub>2)) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> lang n (rexp_of n \<phi>\<^sub>1) \<or> x \<in> lang n (rexp_of n \<phi>\<^sub>2); x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<or> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
have "(w, I) \<Turnstile> \<phi>\<^sub>1 \<or> (w, I) \<Turnstile> \<phi>\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>1 \<or> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
proof (intro mp[OF disj_mono[OF impI impI] or])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>1
 2. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1

goal (2 subgoals):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>1
 2. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
with I FOr(3)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1
[PROOF STEP]
show "(w, I) \<Turnstile> \<phi>\<^sub>1"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>1
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def I(1) wf_interp_for_formula_FOr
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) \<phi>\<^sub>1 \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>2
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>1}

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>1
[PROOF STEP]
by (auto dest!: enc_welldef[of x w I _ _ \<phi>\<^sub>1] simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>\<^sub>1

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
with I FOr(3)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2
[PROOF STEP]
show "(w, I) \<Turnstile> \<phi>\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def I(1) wf_interp_for_formula_FOr
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) \<phi>\<^sub>1 \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>2
wf_formula n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>2 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2}

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
by (auto dest!: enc_welldef[of x w I _ _ \<phi>\<^sub>2] simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>\<^sub>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>\<^sub>1 \<or> (w, I) \<Turnstile> \<phi>\<^sub>2

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
with I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
(w, I) \<Turnstile> \<phi>\<^sub>1 \<or> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
show "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
(w, I) \<Turnstile> \<phi>\<^sub>1 \<or> (w, I) \<Turnstile> \<phi>\<^sub>2

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)
(w, I) \<Turnstile> \<phi>\<^sub>1 \<or> (w, I) \<Turnstile> \<phi>\<^sub>2

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) \<and> (w, I) \<Turnstile> FOr \<phi>\<^sub>1 \<phi>\<^sub>2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2) = lang n (rexp_of n (FOr \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (4 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STATE]
proof (state)
this:
wf_formula ?n2 \<phi>\<^sub>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi>\<^sub>1 = lang ?n2 (rexp_of ?n2 \<phi>\<^sub>1)
wf_formula ?n2 \<phi>\<^sub>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi>\<^sub>2 = lang ?n2 (rexp_of ?n2 \<phi>\<^sub>2)
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (4 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
from FAnd(3)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
have IH1: "lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 = lang n (rexp_of n \<phi>\<^sub>1)"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 = lang n (rexp_of n \<phi>\<^sub>1)
[PROOF STEP]
by (intro FAnd(1)) auto
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 = lang n (rexp_of n \<phi>\<^sub>1)

goal (4 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
from FAnd(3)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
have IH2: "lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 = lang n (rexp_of n \<phi>\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 = lang n (rexp_of n \<phi>\<^sub>2)
[PROOF STEP]
by (intro FAnd(2)) auto
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 = lang n (rexp_of n \<phi>\<^sub>2)

goal (4 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi>1 \<phi>2 n. \<lbrakk>\<And>n. wf_formula n \<phi>1 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>1 = lang n (rexp_of n \<phi>1); \<And>n. wf_formula n \<phi>2 \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>2 = lang n (rexp_of n \<phi>2); wf_formula n (FAnd \<phi>1 \<phi>2)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>1 \<phi>2) = lang n (rexp_of n (FAnd \<phi>1 \<phi>2))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 4. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) = lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) \<Longrightarrow> x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
 2. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) \<Longrightarrow> x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
 2. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) \<Longrightarrow> x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
 2. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
thus "x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
using lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_FAnd[OF FAnd(3)]
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) \<subseteq> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<inter> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)}

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
unfolding lang_ENC_formula[OF FAnd(3)] rexp_of.simps rexp_of_list.simps lang.simps IH1 IH2 Int_assoc
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) \<subseteq> lang n (rexp_of n \<phi>\<^sub>1) \<inter> (lang n (rexp_of n \<phi>\<^sub>2) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)})

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n \<phi>\<^sub>1) \<inter> (lang n (rexp_of n \<phi>\<^sub>2) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
assume "x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))
[PROOF STEP]
obtain w I where "and": "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<and> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2" and I: "x \<in> enc (w, I)" "length I = n"
      "wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<and> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2; x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang_ENC_formula[OF FAnd(3)] rexp_of.simps rexp_of_list.simps lang.simps IH1 IH2 Int_Diff
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n \<phi>\<^sub>1) \<inter> (lang n (rexp_of n \<phi>\<^sub>2) \<inter> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)})

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> lang n (rexp_of n \<phi>\<^sub>1) \<and> x \<in> lang n (rexp_of n \<phi>\<^sub>2); x \<in> enc (w, I); length I = n; wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<and> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
have "(w, I) \<Turnstile> \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
proof (intro mp[OF conj_mono[OF impI impI] "and"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>1
 2. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1

goal (2 subgoals):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>1
 2. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
with I FAnd(3)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1
[PROOF STEP]
show "(w, I) \<Turnstile> \<phi>\<^sub>1"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>1

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>1
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def I(1) wf_interp_for_formula_FAnd
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) \<phi>\<^sub>1 \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>2
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>1}

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>1
[PROOF STEP]
by (auto dest!: enc_welldef[of x w I _ _ \<phi>\<^sub>1] simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>\<^sub>1

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2 \<Longrightarrow> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
with I FAnd(3)
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2
[PROOF STEP]
show "(w, I) \<Turnstile> \<phi>\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>\<^sub>2

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def I(1) wf_interp_for_formula_FAnd
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) \<phi>\<^sub>1 \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>2
wf_formula n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi>\<^sub>2 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2}

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
by (auto dest!: enc_welldef[of x w I _ _ \<phi>\<^sub>2] simp del: enc.simps)
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>\<^sub>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
with I
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
(w, I) \<Turnstile> \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2
[PROOF STEP]
show "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
(w, I) \<Turnstile> \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
length I = n
wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)
(w, I) \<Turnstile> \<phi>\<^sub>1 \<and> (w, I) \<Turnstile> \<phi>\<^sub>2

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) \<and> (w, I) \<Turnstile> FAnd \<phi>\<^sub>1 \<phi>\<^sub>2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2) = lang n (rexp_of n (FAnd \<phi>\<^sub>1 \<phi>\<^sub>2))

goal (3 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FNot \<phi>)
[PROOF STATE]
proof (state)
this:
wf_formula ?n2 \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi> = lang ?n2 (rexp_of ?n2 \<phi>)
wf_formula n (FNot \<phi>)

goal (3 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
hence IH: "?L n \<phi> =  lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>"
[PROOF STATE]
proof (prove)
using this:
wf_formula ?n2 \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi> = lang ?n2 (rexp_of ?n2 \<phi>)
wf_formula n (FNot \<phi>)

goal (1 subgoal):
 1. lang n (rexp_of n \<phi>) = lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lang n (rexp_of n \<phi>) = lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (3 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FNot \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 3. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
obtain w I where
      *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) \<phi>" "length I = n" and unsat: "\<not> (w, I) \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) \<phi>; length I = n; \<not> (w, I) \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FNot \<phi>) \<and> (w, I) \<Turnstile> FNot \<phi>}

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) \<phi>; length I = n; \<not> (w, I) \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) \<phi>
length I = n
\<not> (w, I) \<Turnstile> \<phi>

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) \<phi>
length I = n
\<not> (w, I) \<Turnstile> \<phi>

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
assume "x \<in> ?L n \<phi>"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
hence "(w, I) \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n \<phi>)

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>
[PROOF STEP]
using enc_welldef[of x w I _ _ \<phi>, OF *(1) _ _ _ *(2)] FNot(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n \<phi>)
\<lbrakk>x \<in> enc (?w', ?I'); length I = length ?I'; wf_formula (length I) \<phi>; wf_interp_for_formula (?w', ?I') \<phi>\<rbrakk> \<Longrightarrow> ((w, I) \<Turnstile> \<phi>) = ((?w', ?I') \<Turnstile> \<phi>)
wf_formula n (FNot \<phi>)

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>
[PROOF STEP]
unfolding *(3) lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def IH
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi> \<and> (w, I) \<Turnstile> \<phi>}
\<lbrakk>x \<in> enc (?w', ?I'); n = length ?I'; wf_formula n \<phi>; wf_interp_for_formula (?w', ?I') \<phi>\<rbrakk> \<Longrightarrow> ((w, I) \<Turnstile> \<phi>) = ((?w', ?I') \<Turnstile> \<phi>)
wf_formula n (FNot \<phi>)

goal (1 subgoal):
 1. (w, I) \<Turnstile> \<phi>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(w, I) \<Turnstile> \<phi>

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n \<phi>) \<Longrightarrow> (w, I) \<Turnstile> \<phi>

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
with unsat
[PROOF STATE]
proof (chain)
picking this:
\<not> (w, I) \<Turnstile> \<phi>
x \<in> lang n (rexp_of n \<phi>) \<Longrightarrow> (w, I) \<Turnstile> \<phi>
[PROOF STEP]
have "x \<notin> ?L n \<phi>"
[PROOF STATE]
proof (prove)
using this:
\<not> (w, I) \<Turnstile> \<phi>
x \<in> lang n (rexp_of n \<phi>) \<Longrightarrow> (w, I) \<Turnstile> \<phi>

goal (1 subgoal):
 1. x \<notin> lang n (rexp_of n \<phi>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<notin> lang n (rexp_of n \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FNot \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) \<phi>
length I = n
x \<notin> lang n (rexp_of n \<phi>)
[PROOF STEP]
show "x \<in> ?L n (FNot \<phi>)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) \<phi>
length I = n
x \<notin> lang n (rexp_of n \<phi>)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FNot \<phi>))
[PROOF STEP]
unfolding rexp_of.simps lang.simps
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) \<phi>
length I = n
x \<notin> lang n (rexp_of n \<phi>)

goal (1 subgoal):
 1. x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - lang n (rexp_of n \<phi>)) \<inter> lang n (ENC n (FOV (FNot \<phi>)))
[PROOF STEP]
using lang_ENC_formula[OF FNot(2)]
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) \<phi>
length I = n
x \<notin> lang n (rexp_of n \<phi>)
lang n (ENC n (FOV (FNot \<phi>))) = \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FNot \<phi>)}

goal (1 subgoal):
 1. x \<in> (lists ((set \<circ> \<sigma> \<Sigma>) n) - lang n (rexp_of n \<phi>)) \<inter> lang n (ENC n (FOV (FNot \<phi>)))
[PROOF STEP]
by (auto simp del: enc.simps simp: comp_def intro: enc_set_\<sigma>)
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FNot \<phi>))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
assume "x \<in> ?L n (FNot \<phi>)"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FNot \<phi>))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
with IH
[PROOF STATE]
proof (chain)
picking this:
lang n (rexp_of n \<phi>) = lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
x \<in> lang n (rexp_of n (FNot \<phi>))
[PROOF STEP]
have "x \<in> lang n (ENC n (FOV (FNot \<phi>)))" and x: "x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>"
[PROOF STATE]
proof (prove)
using this:
lang n (rexp_of n \<phi>) = lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
x \<in> lang n (rexp_of n (FNot \<phi>))

goal (1 subgoal):
 1. x \<in> lang n (ENC n (FOV (FNot \<phi>))) &&& x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
[PROOF STEP]
by (auto simp del: o_apply)
[PROOF STATE]
proof (state)
this:
x \<in> lang n (ENC n (FOV (FNot \<phi>)))
x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (ENC n (FOV (FNot \<phi>)))
x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
[PROOF STEP]
obtain w I where *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FNot \<phi>)" "length I = n"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (ENC n (FOV (FNot \<phi>)))
x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FNot \<phi>); length I = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang_ENC_formula[OF FNot(2)]
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FNot \<phi>)}
x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (1 subgoal):
 1. (\<And>w I. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FNot \<phi>); length I = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
assume "\<not> (w, I) \<Turnstile> FNot \<phi>"
[PROOF STATE]
proof (state)
this:
\<not> (w, I) \<Turnstile> FNot \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n
\<not> (w, I) \<Turnstile> FNot \<phi>
[PROOF STEP]
have "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n
\<not> (w, I) \<Turnstile> FNot \<phi>

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n
\<not> (w, I) \<Turnstile> FNot \<phi>

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi> \<and> (w, I) \<Turnstile> \<phi>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> (w, I) \<Turnstile> FNot \<phi> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FNot \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
with x *
[PROOF STATE]
proof (chain)
picking this:
x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n
\<not> (w, I) \<Turnstile> FNot \<phi> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
[PROOF STEP]
show "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)"
[PROOF STATE]
proof (prove)
using this:
x \<notin> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n
\<not> (w, I) \<Turnstile> FNot \<phi> \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi>

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<notin> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi> \<and> (w, I) \<Turnstile> \<phi>}
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FNot \<phi>)
length I = n
\<not> (w, I) \<Turnstile> FNot \<phi> \<Longrightarrow> x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) \<phi> \<and> (w, I) \<Turnstile> \<phi>}

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FNot \<phi>) \<and> (w, I) \<Turnstile> FNot \<phi>}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FNot \<phi>) = lang n (rexp_of n (FNot \<phi>))

goal (2 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FExists \<phi>)
[PROOF STATE]
proof (state)
this:
wf_formula ?n2 \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi> = lang ?n2 (rexp_of ?n2 \<phi>)
wf_formula n (FExists \<phi>)

goal (2 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
have \<sigma>: "(any, replicate n False) \<in> (set o \<sigma> \<Sigma>) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (any, replicate n False) \<in> (set \<circ> \<sigma> \<Sigma>) n
[PROOF STEP]
by (auto simp: \<sigma>_def set_n_lists image_iff)
[PROOF STATE]
proof (state)
this:
(any, replicate n False) \<in> (set \<circ> \<sigma> \<Sigma>) n

goal (2 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
from FExists(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FExists \<phi>)
[PROOF STEP]
have wf: "wf n (Pr (rexp_of (Suc n) \<phi>))"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FExists \<phi>)

goal (1 subgoal):
 1. local.wf n (Pr (rexp_of (Suc n) \<phi>))
[PROOF STEP]
by (fastforce intro: wf_rexp_of)
[PROOF STATE]
proof (state)
this:
local.wf n (Pr (rexp_of (Suc n) \<phi>))

goal (2 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
note lang_quot = lang_samequot_exec[OF wf \<sigma>]
[PROOF STATE]
proof (state)
this:
lang n (samequot_exec (any, replicate n False) (Pr (rexp_of (Suc n) \<phi>))) = SAMEQUOT (any, replicate n False) (lang n (Pr (rexp_of (Suc n) \<phi>)))

goal (2 subgoals):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FExists \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
 2. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FExists \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FExists \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FExists \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
obtain w I p where
      *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FExists \<phi>)" "length I = n" "(w, Inl p # I) \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)

goal (1 subgoal):
 1. (\<And>w I p. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FExists \<phi>); length I = n; (w, Inl p # I) \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FExists \<phi>) \<and> (w, I) \<Turnstile> FExists \<phi>}

goal (1 subgoal):
 1. (\<And>w I p. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FExists \<phi>); length I = n; (w, Inl p # I) \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n
(w, Inl p # I) \<Turnstile> \<phi>

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FExists \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
with FExists(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FExists \<phi>)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n
(w, Inl p # I) \<Turnstile> \<phi>
[PROOF STEP]
have "enc (w, Inl p # I) \<subseteq> ?L (Suc n) \<phi>"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FExists \<phi>)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n
(w, Inl p # I) \<Turnstile> \<phi>

goal (1 subgoal):
 1. enc (w, Inl p # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)
[PROOF STEP]
by (subst FExists(1)[of "Suc n", symmetric])
        (fastforce simp del: enc.simps simp: lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def nth_Cons' intro!: exI[of _ "enc (w, Inl p # I)"])+
[PROOF STATE]
proof (state)
this:
enc (w, Inl p # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FExists \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
thus "x \<in> ?L n (FExists \<phi>)"
[PROOF STATE]
proof (prove)
using this:
enc (w, Inl p # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FExists \<phi>))
[PROOF STEP]
using *(1,2,3)
[PROOF STATE]
proof (prove)
using this:
enc (w, Inl p # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FExists \<phi>))
[PROOF STEP]
by (auto simp: lang_quot simp del: o_apply enc.simps elim: subsetD[OF SAMEQUOT_mono[OF image_mono]])
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FExists \<phi>))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
assume "x \<in> ?L n (FExists \<phi>)"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FExists \<phi>))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FExists \<phi>))
[PROOF STEP]
obtain x' m where "x' \<in> ?L (Suc n) \<phi>" and
      x: "x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FExists \<phi>))

goal (1 subgoal):
 1. (\<And>x' m. \<lbrakk>x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>); x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: lang_quot SAMEQUOT_def simp del: o_apply enc.simps)
[PROOF STATE]
proof (state)
this:
x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>)
x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
with FExists(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FExists \<phi>)
x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>)
x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)
[PROOF STEP]
have "x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FExists \<phi>)
x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>)
x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)

goal (1 subgoal):
 1. x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>
[PROOF STEP]
by (intro subsetD[OF equalityD2[OF FExists(1)], of "Suc n" x'])
        (auto split: if_split_asm sum.splits)
[PROOF STATE]
proof (state)
this:
x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>
[PROOF STEP]
obtain w I' where
      *: "x' \<in> enc (w, I')" "wf_interp_for_formula (w, I') \<phi>" "length I' = Suc n" "(w, I') \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
using this:
x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>

goal (1 subgoal):
 1. (\<And>w I'. \<lbrakk>x' \<in> enc (w, I'); wf_interp_for_formula (w, I') \<phi>; length I' = Suc n; (w, I') \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x' \<in> \<Union> {enc (w, I) |w I. length I = Suc n \<and> wf_interp_for_formula (w, I) \<phi> \<and> (w, I) \<Turnstile> \<phi>}

goal (1 subgoal):
 1. (\<And>w I'. \<lbrakk>x' \<in> enc (w, I'); wf_interp_for_formula (w, I') \<phi>; length I' = Suc n; (w, I') \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
[PROOF STEP]
obtain I\<^sub>0 I where "I' = I\<^sub>0 # I"
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>

goal (1 subgoal):
 1. (\<And>I\<^sub>0 I. I' = I\<^sub>0 # I \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases I') auto
[PROOF STATE]
proof (state)
this:
I' = I\<^sub>0 # I

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
I' = I\<^sub>0 # I

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
with FExists(2) *(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FExists \<phi>)
wf_interp_for_formula (w, I') \<phi>
I' = I\<^sub>0 # I
[PROOF STEP]
obtain p where "I\<^sub>0 = Inl p"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FExists \<phi>)
wf_interp_for_formula (w, I') \<phi>
I' = I\<^sub>0 # I

goal (1 subgoal):
 1. (\<And>p. I\<^sub>0 = Inl p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: nth_Cons' split: sum.splits if_split_asm)
[PROOF STATE]
proof (state)
this:
I\<^sub>0 = Inl p

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inl p
[PROOF STEP]
have "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FExists \<phi>)" "length I = n"
      "(w, I) \<Turnstile> FExists \<phi>"
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inl p

goal (1 subgoal):
 1. (x \<in> enc (w, I) &&& wf_interp_for_formula (w, I) (FExists \<phi>)) &&& length I = n &&& (w, I) \<Turnstile> FExists \<phi>
[PROOF STEP]
using FExists(2) fin_cut_same_tl[OF ex_Loop_stream_enc, of "Inl p # I" w]
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inl p
wf_formula n (FExists \<phi>)
\<forall>x\<in>set (Inl p # I). case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> fin_cut_same (\<pi> (any, replicate (length (Inl p # I)) False)) (map \<pi> (cut_same (any, replicate (length (Inl p # I)) False) (stream_enc (w, Inl p # I)))) = cut_same (\<pi> (any, replicate (length (Inl p # I)) False)) (smap \<pi> (stream_enc (w, Inl p # I)))

goal (1 subgoal):
 1. (x \<in> enc (w, I) &&& wf_interp_for_formula (w, I) (FExists \<phi>)) &&& length I = n &&& (w, I) \<Turnstile> FExists \<phi>
[PROOF STEP]
unfolding x
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inl p
wf_formula n (FExists \<phi>)
\<forall>x\<in>set (Inl p # I). case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> fin_cut_same (\<pi> (any, replicate (length (Inl p # I)) False)) (map \<pi> (cut_same (any, replicate (length (Inl p # I)) False) (stream_enc (w, Inl p # I)))) = cut_same (\<pi> (any, replicate (length (Inl p # I)) False)) (smap \<pi> (stream_enc (w, Inl p # I)))

goal (1 subgoal):
 1. (fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False) \<in> enc (w, I) &&& wf_interp_for_formula (w, I) (FExists \<phi>)) &&& length I = n &&& (w, I) \<Turnstile> FExists \<phi>
[PROOF STEP]
by (auto simp add: \<pi>_def nth_Cons' split: if_split_asm)
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n
(w, I) \<Turnstile> FExists \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FExists \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
thus "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n
(w, I) \<Turnstile> FExists \<phi>

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FExists \<phi>)
length I = n
(w, I) \<Turnstile> FExists \<phi>

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FExists \<phi>) \<and> (w, I) \<Turnstile> FExists \<phi>}
[PROOF STEP]
by (auto intro!: exI[of _ I])
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FExists \<phi>) = lang n (rexp_of n (FExists \<phi>))

goal (1 subgoal):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
case (FEXISTS \<phi>)
[PROOF STATE]
proof (state)
this:
wf_formula ?n2 \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S ?n2 \<phi> = lang ?n2 (rexp_of ?n2 \<phi>)
wf_formula n (FEXISTS \<phi>)

goal (1 subgoal):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
have \<sigma>: "(any, replicate n False) \<in> (set o \<sigma> \<Sigma>) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (any, replicate n False) \<in> (set \<circ> \<sigma> \<Sigma>) n
[PROOF STEP]
by (auto simp: \<sigma>_def set_n_lists image_iff)
[PROOF STATE]
proof (state)
this:
(any, replicate n False) \<in> (set \<circ> \<sigma> \<Sigma>) n

goal (1 subgoal):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
from FEXISTS(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FEXISTS \<phi>)
[PROOF STEP]
have wf: "wf n (Pr (rexp_of (Suc n) \<phi>))"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FEXISTS \<phi>)

goal (1 subgoal):
 1. local.wf n (Pr (rexp_of (Suc n) \<phi>))
[PROOF STEP]
by (fastforce intro: wf_rexp_of)
[PROOF STATE]
proof (state)
this:
local.wf n (Pr (rexp_of (Suc n) \<phi>))

goal (1 subgoal):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
note lang_quot = lang_samequot_exec[OF wf \<sigma>]
[PROOF STATE]
proof (state)
this:
lang n (samequot_exec (any, replicate n False) (Pr (rexp_of (Suc n) \<phi>))) = SAMEQUOT (any, replicate n False) (lang n (Pr (rexp_of (Suc n) \<phi>)))

goal (1 subgoal):
 1. \<And>\<phi> n. \<lbrakk>\<And>n. wf_formula n \<phi> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n \<phi> = lang n (rexp_of n \<phi>); wf_formula n (FEXISTS \<phi>)\<rbrakk> \<Longrightarrow> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FEXISTS \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FEXISTS \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
assume "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)"
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FEXISTS \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
obtain w I P where
      *: "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FEXISTS \<phi>)" "length I = n" "finite P" "(w, Inr P # I) \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)

goal (1 subgoal):
 1. (\<And>w I P. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FEXISTS \<phi>); length I = n; finite P; (w, Inr P # I) \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FEXISTS \<phi>) \<and> (w, I) \<Turnstile> FEXISTS \<phi>}

goal (1 subgoal):
 1. (\<And>w I P. \<lbrakk>x \<in> enc (w, I); wf_interp_for_formula (w, I) (FEXISTS \<phi>); length I = n; finite P; (w, Inr P # I) \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
finite P
(w, Inr P # I) \<Turnstile> \<phi>

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FEXISTS \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
with FEXISTS(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FEXISTS \<phi>)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
finite P
(w, Inr P # I) \<Turnstile> \<phi>
[PROOF STEP]
have "enc (w, Inr P # I) \<subseteq> ?L (Suc n) \<phi>"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FEXISTS \<phi>)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
finite P
(w, Inr P # I) \<Turnstile> \<phi>

goal (1 subgoal):
 1. enc (w, Inr P # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)
[PROOF STEP]
by (subst FEXISTS(1)[of "Suc n", symmetric])
        (fastforce simp del: enc.simps simp: lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def nth_Cons' intro!: exI[of _ "enc (w, Inr P # I)"])+
[PROOF STATE]
proof (state)
this:
enc (w, Inr P # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)

goal (2 subgoals):
 1. \<And>x. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) \<Longrightarrow> x \<in> lang n (rexp_of n (FEXISTS \<phi>))
 2. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
thus "x \<in> ?L n (FEXISTS \<phi>)"
[PROOF STATE]
proof (prove)
using this:
enc (w, Inr P # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
using *(1,2,3,4)
[PROOF STATE]
proof (prove)
using this:
enc (w, Inr P # I) \<subseteq> lang (Suc n) (rexp_of (Suc n) \<phi>)
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
finite P

goal (1 subgoal):
 1. x \<in> lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
by (auto simp: lang_quot simp del: o_apply enc.simps elim: subsetD[OF SAMEQUOT_mono[OF image_mono]])
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FEXISTS \<phi>))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
assume "x \<in> ?L n (FEXISTS \<phi>)"
[PROOF STATE]
proof (state)
this:
x \<in> lang n (rexp_of n (FEXISTS \<phi>))

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> lang n (rexp_of n (FEXISTS \<phi>))
[PROOF STEP]
obtain x' m where "x' \<in> ?L (Suc n) \<phi>" and
      x: "x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)"
[PROOF STATE]
proof (prove)
using this:
x \<in> lang n (rexp_of n (FEXISTS \<phi>))

goal (1 subgoal):
 1. (\<And>x' m. \<lbrakk>x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>); x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: lang_quot SAMEQUOT_def simp del: o_apply enc.simps)
[PROOF STATE]
proof (state)
this:
x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>)
x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
with FEXISTS(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FEXISTS \<phi>)
x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>)
x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)
[PROOF STEP]
have "x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FEXISTS \<phi>)
x' \<in> lang (Suc n) (rexp_of (Suc n) \<phi>)
x = fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False)

goal (1 subgoal):
 1. x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>
[PROOF STEP]
by (intro subsetD[OF equalityD2[OF FEXISTS(1)], of "Suc n" x'])
        (auto split: if_split_asm sum.splits)
[PROOF STATE]
proof (state)
this:
x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>
[PROOF STEP]
obtain w I' where
      *: "x' \<in> enc (w, I')" "wf_interp_for_formula (w, I') \<phi>" "length I' = Suc n" "(w, I') \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
using this:
x' \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S (Suc n) \<phi>

goal (1 subgoal):
 1. (\<And>w I'. \<lbrakk>x' \<in> enc (w, I'); wf_interp_for_formula (w, I') \<phi>; length I' = Suc n; (w, I') \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x' \<in> \<Union> {enc (w, I) |w I. length I = Suc n \<and> wf_interp_for_formula (w, I) \<phi> \<and> (w, I) \<Turnstile> \<phi>}

goal (1 subgoal):
 1. (\<And>w I'. \<lbrakk>x' \<in> enc (w, I'); wf_interp_for_formula (w, I') \<phi>; length I' = Suc n; (w, I') \<Turnstile> \<phi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
[PROOF STEP]
obtain I\<^sub>0 I where "I' = I\<^sub>0 # I"
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>

goal (1 subgoal):
 1. (\<And>I\<^sub>0 I. I' = I\<^sub>0 # I \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases I') auto
[PROOF STATE]
proof (state)
this:
I' = I\<^sub>0 # I

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
I' = I\<^sub>0 # I

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
with FEXISTS(2) *(2)
[PROOF STATE]
proof (chain)
picking this:
wf_formula n (FEXISTS \<phi>)
wf_interp_for_formula (w, I') \<phi>
I' = I\<^sub>0 # I
[PROOF STEP]
obtain P where "I\<^sub>0 = Inr P" "finite P"
[PROOF STATE]
proof (prove)
using this:
wf_formula n (FEXISTS \<phi>)
wf_interp_for_formula (w, I') \<phi>
I' = I\<^sub>0 # I

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>I\<^sub>0 = Inr P; finite P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: nth_Cons' split: sum.splits if_split_asm)
[PROOF STATE]
proof (state)
this:
I\<^sub>0 = Inr P
finite P

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inr P
finite P
[PROOF STEP]
have "x \<in> enc (w, I)" "wf_interp_for_formula (w, I) (FEXISTS \<phi>)" "length I = n"
      "(w, I) \<Turnstile> FEXISTS \<phi>"
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inr P
finite P

goal (1 subgoal):
 1. (x \<in> enc (w, I) &&& wf_interp_for_formula (w, I) (FEXISTS \<phi>)) &&& length I = n &&& (w, I) \<Turnstile> FEXISTS \<phi>
[PROOF STEP]
using FEXISTS(2) fin_cut_same_tl[OF ex_Loop_stream_enc, of "Inr P # I"]
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inr P
finite P
wf_formula n (FEXISTS \<phi>)
\<forall>x\<in>set (Inr P # I). case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> fin_cut_same (\<pi> (any, replicate (length (Inr P # I)) False)) (map \<pi> (cut_same (any, replicate (length (Inr P # I)) False) (stream_enc (?w2, Inr P # I)))) = cut_same (\<pi> (any, replicate (length (Inr P # I)) False)) (smap \<pi> (stream_enc (?w2, Inr P # I)))

goal (1 subgoal):
 1. (x \<in> enc (w, I) &&& wf_interp_for_formula (w, I) (FEXISTS \<phi>)) &&& length I = n &&& (w, I) \<Turnstile> FEXISTS \<phi>
[PROOF STEP]
unfolding x
[PROOF STATE]
proof (prove)
using this:
x' \<in> enc (w, I')
wf_interp_for_formula (w, I') \<phi>
length I' = Suc n
(w, I') \<Turnstile> \<phi>
I' = I\<^sub>0 # I
I\<^sub>0 = Inr P
finite P
wf_formula n (FEXISTS \<phi>)
\<forall>x\<in>set (Inr P # I). case x of Inl a \<Rightarrow> True | Inr P \<Rightarrow> finite P \<Longrightarrow> fin_cut_same (\<pi> (any, replicate (length (Inr P # I)) False)) (map \<pi> (cut_same (any, replicate (length (Inr P # I)) False) (stream_enc (?w2, Inr P # I)))) = cut_same (\<pi> (any, replicate (length (Inr P # I)) False)) (smap \<pi> (stream_enc (?w2, Inr P # I)))

goal (1 subgoal):
 1. (fin_cut_same (any, replicate n False) (map \<pi> x') @ replicate m (any, replicate n False) \<in> enc (w, I) &&& wf_interp_for_formula (w, I) (FEXISTS \<phi>)) &&& length I = n &&& (w, I) \<Turnstile> FEXISTS \<phi>
[PROOF STEP]
by (auto simp: nth_Cons' \<pi>_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
(w, I) \<Turnstile> FEXISTS \<phi>

goal (1 subgoal):
 1. \<And>x. x \<in> lang n (rexp_of n (FEXISTS \<phi>)) \<Longrightarrow> x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
thus "x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)"
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
(w, I) \<Turnstile> FEXISTS \<phi>

goal (1 subgoal):
 1. x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)
[PROOF STEP]
unfolding lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S_def
[PROOF STATE]
proof (prove)
using this:
x \<in> enc (w, I)
wf_interp_for_formula (w, I) (FEXISTS \<phi>)
length I = n
(w, I) \<Turnstile> FEXISTS \<phi>

goal (1 subgoal):
 1. x \<in> \<Union> {enc (w, I) |w I. length I = n \<and> wf_interp_for_formula (w, I) (FEXISTS \<phi>) \<and> (w, I) \<Turnstile> FEXISTS \<phi>}
[PROOF STEP]
by (auto intro!: exI[of _ I])
[PROOF STATE]
proof (state)
this:
x \<in> lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lang\<^sub>W\<^sub>S\<^sub>1\<^sub>S n (FEXISTS \<phi>) = lang n (rexp_of n (FEXISTS \<phi>))

goal:
No subgoals!
[PROOF STEP]
qed