[STATEMENT]
lemma wt_method_comp_aux:
  "\<lbrakk> bc' = bc @ [Return]; f' = (f \<box> nochangeST);
  bc_mt_corresp bc f sttp0 cG rT (1+length pTs+mxl) (length bc);
  start_sttp_resp_cons f';
  sttp0 = (start_ST, start_LT C pTs mxl);
  mxs = max_ssize (mt_of (f' sttp0));
  wf_mhead cG (mn, pTs) rT; is_class cG C;
  sttp_of (f sttp0) = (T # ST, LT);

  check_type cG mxs (1+length pTs+mxl) (OK (Some (T # ST, LT))) \<longrightarrow>
  wt_instr_altern Return cG rT (mt_of (f' sttp0)) mxs (1+length pTs+mxl)
         (Suc (length bc)) empty_et (length bc)
\<rbrakk>
\<Longrightarrow> wt_method_altern cG C pTs rT mxs mxl bc' empty_et (mt_of (f' sttp0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> wt_method_altern cG C pTs rT mxs mxl bc' [] (fst (f' sttp0))
[PROOF STEP]
apply (subgoal_tac "check_type cG (length start_ST) (Suc (length pTs + mxl))
                                    (OK (Some (start_ST, start_LT C pTs mxl)))")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> wt_method_altern cG C pTs rT mxs mxl bc' [] (fst (f' sttp0))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (subgoal_tac "check_type cG mxs (1+length pTs+mxl) (OK (Some (T # ST, LT)))")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_method_altern cG C pTs rT mxs mxl bc' [] (fst (f' sttp0))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: wt_method_altern_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> length (fst (f (start_ST, start_LT C pTs mxl))) = length bc \<and> check_bounded (bc @ [Return]) [] \<and> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> length (fst (f (start_ST, start_LT C pTs mxl))) = length bc
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> check_bounded (bc @ [Return]) [] \<and> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: bc_mt_corresp_def split_beta)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> check_bounded (bc @ [Return]) [] \<and> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> check_bounded (bc @ [Return]) []
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: bc_mt_corresp_def split_beta check_bounded_def)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc) \<and> check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length (fst (f (start_ST, start_LT C pTs mxl)))). \<forall>pc'\<in>set (succs ((bc @ [Return]) ! pc) pc). pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length (fst (f (start_ST, start_LT C pTs mxl)))). \<forall>pc'\<in>set (succs ((bc @ [Return]) ! pc) pc). pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (intro strip)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (subgoal_tac "pc < (length bc) \<or> pc = length bc")
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc < length bc \<or> pc = length bc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc < length bc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 3. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 6. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (subgoal_tac "(bc' ! pc) = (bc ! pc)")
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc < length bc; bc' ! pc = bc ! pc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc < length bc\<rbrakk> \<Longrightarrow> bc' ! pc = bc ! pc
 3. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 4. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 6. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 7. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: wt_instr_altern_def eff_def)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc < length bc\<rbrakk> \<Longrightarrow> bc' ! pc = bc ! pc
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 3. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 6. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (subgoal_tac "(bc' ! pc) = Return")
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc; bc' ! pc = Return\<rbrakk> \<Longrightarrow> pc' < Suc (length (fst (f (start_ST, start_LT C pTs mxl))))
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc\<rbrakk> \<Longrightarrow> bc' ! pc = Return
 3. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 6. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: wt_instr_altern_def)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc); pc = length bc\<rbrakk> \<Longrightarrow> bc' ! pc = Return
 2. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>pc pc'. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) ! length bc)); pc < Suc (length (fst (f (start_ST, start_LT C pTs mxl)))); pc' \<in> set (succs ((bc @ [Return]) ! pc) pc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) \<and> (\<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc)
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> wt_start cG C pTs mxl (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: wt_start_def start_sttp_resp_cons_def split_beta)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); \<forall>sttp. \<exists>mt'_rest. fst ((f \<box> nochangeST) sttp) = Some sttp # mt'_rest; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<exists>b. fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)) ! 0 = Some b \<and> cG \<turnstile> ([], OK (Class C) # map OK pTs @ replicate mxl Err) <=s b
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (drule_tac x=sttp0 in spec)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); \<exists>mt'_rest. fst ((f \<box> nochangeST) sttp0) = Some sttp0 # mt'_rest\<rbrakk> \<Longrightarrow> \<exists>b. fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)) ! 0 = Some b \<and> cG \<turnstile> ([], OK (Class C) # map OK pTs @ replicate mxl Err) <=s b
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (erule exE)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>mt'_rest. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); fst ((f \<box> nochangeST) sttp0) = Some sttp0 # mt'_rest\<rbrakk> \<Longrightarrow> \<exists>b. fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)) ! 0 = Some b \<and> cG \<turnstile> ([], OK (Class C) # map OK pTs @ replicate mxl Err) <=s b
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: mt_sttp_flatten_def start_ST_def start_LT_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> \<forall>pc<Suc (length bc). wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (intro strip)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (subgoal_tac "pc < (length bc) \<or> pc = length bc")
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc \<or> pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp (no_asm_use) add: bc_mt_corresp_def mt_sttp_flatten_def split_beta)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f (start_ST, start_LT C pTs mxl))) \<and> (check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc) \<and> check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) ! length bc))); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc; length bc = length (fst (f (start_ST, start_LT C pTs mxl))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc) \<and> check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) ! length bc))\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (drule mp, assumption)+
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc; length bc = length (fst (f (start_ST, start_LT C pTs mxl))); (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc) \<and> check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) ! length bc))\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc; length bc = length (fst (f (start_ST, start_LT C pTs mxl))); \<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc; check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) ! length bc))\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (drule spec, drule mp, assumption)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc < length bc; length bc = length (fst (f (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (OK ((fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) ! length bc)); wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (snd (f (start_ST, start_LT C pTs mxl)))])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < length (fst (f (start_ST, start_LT C pTs mxl))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc\<rbrakk> \<Longrightarrow> wt_instr_altern (bc ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 3. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 5. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp (no_asm_simp) add: comb_def split_beta nochangeST_def)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc); pc = length bc\<rbrakk> \<Longrightarrow> wt_instr_altern ((bc @ [Return]) ! pc) cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] pc
 2. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 4. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>pc. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f (start_ST, start_LT C pTs mxl) cG rT (Suc (length pTs + mxl)) (length bc); start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))); pc < Suc (length bc)\<rbrakk> \<Longrightarrow> pc < length bc \<or> pc = length bc
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT)))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp (no_asm_use) add: bc_mt_corresp_def split_beta)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f sttp0)) \<and> (check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (subgoal_tac "check_type cG (length (fst sttp0)) (Suc (length pTs + mxl))
                                     (OK (Some sttp0))")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f sttp0)) \<and> (check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0))\<rbrakk> \<Longrightarrow> check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f sttp0)) \<and> (check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply ((erule conjE)+, drule mp, assumption)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)); length bc = length (fst (f sttp0)); (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))\<rbrakk> \<Longrightarrow> check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f sttp0)) \<and> (check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp add: nth_append)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; start_sttp_resp_cons (f \<box> nochangeST); sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f (start_ST, start_LT C pTs mxl)) = (T # ST, LT); check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl))) (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] (length (fst (f (start_ST, start_LT C pTs mxl)))); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl))); length bc = length (fst (f (start_ST, start_LT C pTs mxl))); (\<forall>pc<length (fst (f (start_ST, start_LT C pTs mxl))). wt_instr_altern (bc ! pc) cG rT (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)]) (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (Suc (length (fst (f (start_ST, start_LT C pTs mxl))))) [] pc) \<and> check_type cG (max_ssize (fst (f (start_ST, start_LT C pTs mxl)) @ [Some (T # ST, LT)])) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))\<rbrakk> \<Longrightarrow> check_type cG (max_ssize (fst ((f \<box> nochangeST) (start_ST, start_LT C pTs mxl)))) (Suc (length pTs + mxl)) (OK (Some (T # ST, LT)))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f sttp0)) \<and> (check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0))
 3. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp (no_asm_simp) add: comb_def nochangeST_def split_beta)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; length bc = length (fst (f sttp0)) \<and> (check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0)) \<longrightarrow> (\<forall>pc<length bc. wt_instr_altern (bc ! pc) cG rT (fst (f sttp0) @ [Some (snd (f sttp0))]) (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (Suc (length (fst (f sttp0)))) [] pc) \<and> check_type cG (max_ssize (fst (f sttp0) @ [Some (snd (f sttp0))])) (Suc (length pTs + mxl)) (OK ((fst (f sttp0) @ [Some (snd (f sttp0))]) ! length bc))); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (Suc (length pTs + mxl)) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (Suc (length pTs + mxl)) (Suc (length bc)) [] (length bc); check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))\<rbrakk> \<Longrightarrow> check_type cG (length (fst sttp0)) (Suc (length pTs + mxl)) (OK (Some sttp0))
 2. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (simp (no_asm_simp))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bc' = bc @ [Return]; f' = f \<box> nochangeST; bc_mt_corresp bc f sttp0 cG rT (1 + length pTs + mxl) (length bc); start_sttp_resp_cons f'; sttp0 = (start_ST, start_LT C pTs mxl); mxs = max_ssize (fst (f' sttp0)); wf_mhead cG (mn, pTs) rT; is_class cG C; snd (f sttp0) = (T # ST, LT); check_type cG mxs (1 + length pTs + mxl) (OK (Some (T # ST, LT))) \<longrightarrow> wt_instr_altern Return cG rT (fst (f' sttp0)) mxs (1 + length pTs + mxl) (Suc (length bc)) [] (length bc)\<rbrakk> \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl)) (OK (Some (start_ST, start_LT C pTs mxl)))
[PROOF STEP]
apply (rule check_type_start, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done