section {*LR1\_Property\_Satisfaction\_\_Simple\_Case*}
theory
  LR1_Property_Satisfaction__Simple_Case

imports
  PRJ_12_04_06_06_01__ENTRY

begin

definition equal_front_state :: "
  ('state, 'stack) DT_l2_l3_nonterminals
  \<Rightarrow> ('state, 'stack) DT_l2_l3_nonterminals
  \<Rightarrow> bool"
  where
    "equal_front_state B1 B2 \<equiv>
  let
    cmp = \<lambda>A. case A of
        cons_l2 q A \<Rightarrow> q
        | cons_l3 q1 A q2 \<Rightarrow> q1
  in
    cmp B1 = cmp B2"

definition equal_front_states :: "
  ('state, 'stack) DT_l2_l3_nonterminals list
  \<Rightarrow> ('state, 'stack) DT_l2_l3_nonterminals list
  \<Rightarrow> bool"
  where
    "equal_front_states w1 w2 \<equiv>
  \<forall>i.
    i < length w1
    \<and> i < length w2
    \<longrightarrow> equal_front_state (w1 ! i) (w2 ! i)"

definition equal_stack :: "
  ('state, 'stack) DT_l2_l3_nonterminals
  \<Rightarrow> ('state, 'stack) DT_l2_l3_nonterminals
  \<Rightarrow> bool"
  where
    "equal_stack B1 B2 \<equiv>
  let
    cmp = \<lambda>A. case A of
        cons_l2 q A \<Rightarrow> A
        | cons_l3 q1 A q2 \<Rightarrow> A
  in
    cmp B1 = cmp B2"

definition equal_stacks :: "
  ('state, 'stack) DT_l2_l3_nonterminals list
  \<Rightarrow> ('state, 'stack) DT_l2_l3_nonterminals list
  \<Rightarrow> bool"
  where
    "equal_stacks w1 w2 \<equiv>
  \<forall>i.
    i < length w1
    \<and> i < length w2
    \<longrightarrow> equal_stack (w1 ! i) (w2 ! i)"

lemma F_SDPDA_TO_CFG_STD__edges_l3_read_single_source: "
  valid_simple_dpda G
  \<Longrightarrow> x \<in> epda_delta G
  \<Longrightarrow> p \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G)
  \<Longrightarrow> edge_event x = Some a
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G p = {x}"
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule order_antisym)
   apply(clarsimp)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_read xa (epda_states G) \<and> (\<exists>y. edge_event xa = Some y)"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
    apply(clarsimp)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event xa = Some y) \<and> edge_push xa = [s1a]"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop xa \<and> edge_push xa = []"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="edge_event xa = None \<and> (\<exists>s2. edge_push xa = [s2, s1a])"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a s2)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
    apply(clarsimp)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(clarsimp)
  done

lemma F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_back_hlp: "
  valid_simple_dpda G1
  \<Longrightarrow> G2 = F_SDPDA_TO_CFG_STD G1
  \<Longrightarrow> cfgLM.derivation_initial G2 dR
  \<Longrightarrow> dR n = Some (pair eR cR)
  \<Longrightarrow> \<exists>dL nL eL cL. epdaH.derivation_initial G1 dL \<and> dL nL = Some (pair eL cL) \<and> (case eR of Some eR' \<Rightarrow> eR' \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G1) (epda_gamma G1) \<longrightarrow> (case eL of Some eL' \<Rightarrow> eL' \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G1 eR' | _ \<Rightarrow> False) | _ \<Rightarrow> True) \<and> (setA (cfg_conf cR) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma G1 \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL cR w))"
  apply(induct n arbitrary: eR cR)
   apply(rename_tac eR cR)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      x="der1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR [])"
      in exI)
   apply(rule conjI)
    apply(rename_tac eR cR)(*strict*)
    apply(rule epdaH.derivation_initialI)
     apply(rename_tac eR cR)(*strict*)
     apply(rule epdaH.der1_is_derivation)
    apply(rename_tac eR cR)(*strict*)
    apply(simp add: get_configuration_def der1_def)
    apply(simp add: cfgLM.derivation_initial_def)
    apply(rule F_SDPDA_TO_CFG_STD__preserve_initial_configuration)
     apply(rename_tac eR cR)(*strict*)
     apply(force)
    apply(rename_tac eR cR)(*strict*)
    apply(force)
   apply(rename_tac eR cR)(*strict*)
   apply(rule_tac
      x="0"
      in exI)
   apply(simp add: der1_def)
   apply(rule conjI)
    apply(rename_tac eR cR)(*strict*)
    apply(case_tac eR)
     apply(rename_tac eR cR)(*strict*)
     apply(force)
    apply(rename_tac eR cR a)(*strict*)
    apply(clarsimp)
    apply(rename_tac cR a)(*strict*)
    apply (metis cfgLM.derivation_initial_is_derivation cfgLM.initialNotEdgeSome_prime)
   apply(rename_tac eR cR)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      x="[]"
      in exI)
   apply(force)
  apply(rename_tac n eR cR)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. dR n = Some (pair e1 c1) \<and> dR (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation (F_SDPDA_TO_CFG_STD G1) c1 e2 c2")
   apply(rename_tac n eR cR)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n eR cR)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n eR cR)(*strict*)
    apply(force)
   apply(rename_tac n eR cR)(*strict*)
   apply(force)
  apply(rename_tac n eR cR)(*strict*)
  apply(clarsimp)
  apply(rename_tac n cR e1 e2 c1)(*strict*)
  apply(erule_tac
      x="e1"
      in meta_allE)
  apply(erule_tac
      x="c1"
      in meta_allE)
  apply(clarsimp)
  apply(rename_tac n cR e1 e2 c1 dL nL eL cL)(*strict*)
  apply(thin_tac "case e1 of None \<Rightarrow> True | Some eR' \<Rightarrow> eR' \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G1) (epda_gamma G1) \<longrightarrow> (case eL of None \<Rightarrow> False | Some eL' \<Rightarrow> eL' \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G1 eR')")
  apply(rename_tac n cR e1 e2 c1 dL nL eL cL)(*strict*)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL w)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL w)(*strict*)
  apply(erule impE)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL w)(*strict*)
   apply(simp add: cfgLM_step_relation_def)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL w l r)(*strict*)
   apply (metis all_not_in_conv elemInsetA)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL w)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(subgoal_tac "(eR2 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G1 \<or> eR2 \<in> F_SDPDA_TO_CFG_STD__edges_l2 G1)")
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
   prefer 2
   apply(simp add: cfgLM_step_relation_def F_SDPDA_TO_CFG_STD_def)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(erule disjE)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
   apply(erule disjE)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt)(*strict*)
    apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt)(*strict*)
     prefer 2
     apply(rule_tac
      G="G1"
      in valid_pda_edge_pop_single)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt)(*strict*)
      apply(simp add: valid_simple_dpda_def valid_dpda_def)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt y)(*strict*)
    apply(case_tac x)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qt y edge_srca edge_eventa edge_popa edge_push edge_trga)(*strict*)
    apply(rename_tac qs re po pu qt)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qta y qs re po pu qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt)(*strict*)
    apply(simp add: cfgLM_step_relation_def)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(rule_tac
      t="edge_src \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
      and s="qs"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(rule_tac
      t="edge_pop \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
      and s="[y]"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(rule_tac
      t="edge_trg \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
      and s="qt"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(rule_tac
      t="[y] ! 0"
      and s="y"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(subgoal_tac "epdaH_step_relation G1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     prefer 2
     apply(simp add: epdaH_step_relation_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
     apply(rule_tac
      t="THE v. \<exists>w. l @ teA (cons_l3   qs y qta) # r = liftB w @ liftA v"
      and s="(cons_l3 qs y qta) # (filterA r)"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(rule THE_split3)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        prefer 2
        apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        apply(simp add: get_configuration_def)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
       apply(subgoal_tac "l=liftB w")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        prefer 2
        apply(rule split_decide1)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt r w v)(*strict*)
       apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qta)]"
      in liftA_append_setB)
       apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(rule_tac
      t="l @ teB a # teA (cons_l3   qt y qta) # r"
      and s="(l @ [teB a]) @ teA (cons_l3   qt y qta) # r"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(rule_tac
      t="THE v. \<exists>w. (l @ [teB a]) @ teA (cons_l3   qt y qta) # r = liftB w @ liftA v"
      and s="(cons_l3 qt y qta) # (filterA r)"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(rule THE_split3)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        prefer 2
        apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        apply(simp add: get_configuration_def)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
       apply(subgoal_tac "l=liftB w")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        prefer 2
        apply(rule split_decide1)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt r w v)(*strict*)
       apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qta)]"
      in liftA_append_setB)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply (metis setA_liftB liftBDeConv2 liftB_commute_one_elem_app)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(rule_tac
      t="THE w. \<exists>v. (l @ [teB a]) @ teA (cons_l3   qt y qta) # r = liftB w @ liftA v"
      and s="filterB l@[a]"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(rule THE_split4)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
         prefer 2
         apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
           apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
           apply(force)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
         apply(simp add: get_configuration_def)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        apply(subgoal_tac "l=liftB w")
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
         prefer 2
         apply(rule split_decide1)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt r w v)(*strict*)
        apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qta)]"
      in liftA_append_setB)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply (metis setA_liftB liftBDeConv2 liftB_commute_one_elem_app)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply (metis liftBDeConv1 liftBDeConv2 liftB_commute_one_elem_app)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(rule_tac
      t="THE w. \<exists>v. l @ teA (cons_l3   qs y qta) # r = liftB w @ liftA v"
      and s="filterB l"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(rule THE_split4)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
         prefer 2
         apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
           apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
           apply(force)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
         apply(simp add: get_configuration_def)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
        apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        apply(subgoal_tac "l=liftB w")
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
         prefer 2
         apply(rule split_decide1)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r w v)(*strict*)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt r w v)(*strict*)
        apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qta)]"
      in liftA_append_setB)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply (metis )
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply (metis liftBDeConv1 liftBDeConv2 liftB_commute_one_elem_app)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(clarsimp)
     apply(simp add: option_to_list_def)
     apply(simp add: valid_simple_dpda_def)
     apply(clarsimp)
     apply(erule_tac
      x="\<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
      in ballE)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      prefer 2
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(rule_tac
      x="derivation_append dL (der2 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)) nL"
      in exI)
    apply(rule conjI)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(rule epdaH.derivation_append_preserves_derivation_initial)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(rule epdaH.derivation_append_preserves_derivation)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
       apply(simp add: epdaH.derivation_initial_def)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
      apply(rule epdaH.der2_is_derivation)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(clarsimp)
     apply(simp add: der2_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(rule_tac
      x="Suc nL"
      in exI)
    apply(simp add: derivation_append_def der2_def)
    apply(rule conjI)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
     apply(clarsimp)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rule disjI1)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qta y qs pu qt l r)(*strict*)
    apply(clarsimp)
    apply(rule_tac
      x="wa"
      in exI)
    apply(force)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
   apply(erule disjE)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
     prefer 2
     apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x)(*strict*)
    apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x)(*strict*)
     prefer 2
     apply(rule_tac
      G="G1"
      in valid_pda_edge_pop_single)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x)(*strict*)
      apply(simp add: valid_simple_dpda_def valid_dpda_def)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x y)(*strict*)
    apply(case_tac x)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x y edge_srca edge_event edge_popa edge_pusha edge_trga)(*strict*)
    apply(rename_tac qs re po pu qt)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x y qs re po pu qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
    apply(rule_tac
      t="edge_src \<lparr>edge_src = qs, edge_event = re, edge_pop = [y], edge_push = [], edge_trg = qt\<rparr>"
      and s="qs"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
    apply(rule_tac
      t="edge_pop \<lparr>edge_src = qs, edge_event = re, edge_pop = [y], edge_push = [], edge_trg = qt\<rparr>!0"
      and s="y"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
    apply(rule_tac
      t="edge_trg \<lparr>edge_src = qs, edge_event = re, edge_pop = [y], edge_push = [], edge_trg = qt\<rparr>"
      and s="qt"
      in ssubst)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
    apply(subgoal_tac "re=None")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
     prefer 2
     apply(simp add: valid_simple_dpda_def)
     apply(clarsimp)
     apply(erule_tac
      x="\<lparr>edge_src = qs, edge_event = re, edge_pop = [y], edge_push = [], edge_trg = qt\<rparr>"
      in ballE)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
      apply(case_tac re)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
       apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt a)(*strict*)
      apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs re qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
    apply(subgoal_tac "epdaH_step_relation G1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
     prefer 2
     apply(simp add: epdaH_step_relation_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def cfgLM_step_relation_def)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(rule_tac
      t="THE v. \<exists>w. l @ teA (cons_l3   qs y qt) # r = liftB w @ liftA v"
      and s="(cons_l3 qs y qt) # (filterA r)"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(rule THE_split3)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
        prefer 2
        apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
        apply(simp add: get_configuration_def)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
       apply(subgoal_tac "l=liftB w")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
        prefer 2
        apply(rule split_decide1)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt r w v)(*strict*)
       apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qt)]"
      in liftA_append_setB)
       apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(subgoal_tac "setB r={} \<and> r\<noteq>[]")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      prefer 2
      apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       prefer 2
       apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(simp add: get_configuration_def)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
      apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
      apply(subgoal_tac "l=liftB w")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
       prefer 2
       apply(rule split_decide1)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
      apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt r w v)(*strict*)
      apply(rule context_conjI)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt r w v)(*strict*)
       apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qt)]"
      in liftA_append_setB)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt r w v)(*strict*)
      apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v)(*strict*)
      apply(case_tac v)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v a list)(*strict*)
      apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w list)(*strict*)
      apply(case_tac list)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w list)(*strict*)
       prefer 2
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w list a lista)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w list)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(clarsimp)
     apply(rule_tac
      t="THE v. \<exists>w. l @ r = liftB w @ liftA v"
      and s="filterA r"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(rule THE_split5)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(rule_tac
      t="THE w. \<exists>v. l @ r = liftB w @ liftA v"
      and s="filterB l"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(rule THE_split6)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(rule_tac
      t="THE w. \<exists>v. l @ teA (cons_l3   qs y qt) # r = liftB w @ liftA v"
      and s="filterB l"
      in ssubst)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(rule THE_split6)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(clarsimp)
     apply(simp add: option_to_list_def)
     apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      prefer 2
      apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
      apply(simp add: get_configuration_def)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r)(*strict*)
     apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
     apply(case_tac r)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l r w v a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v a list)(*strict*)
     apply(case_tac a)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v a list aa)(*strict*)
      apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list aa)(*strict*)
      apply(case_tac aa)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list aa q b)(*strict*)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply(subgoal_tac "\<forall>w t. v = w @ [t] \<longrightarrow> Ball (set w) (case_DT_l2_l3_nonterminals (\<lambda>q y. False) (\<lambda>q1 b q2. True)) \<and> (case t of cons_l2 q y \<Rightarrow> True | cons_l3 q1 b q2 \<Rightarrow> False) \<and> (\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
        prefer 2
        apply(case_tac v)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista)(*strict*)
        apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply(thin_tac "case v of [] \<Rightarrow> True | a # y \<Rightarrow> \<forall>w t. v = w @ [t] \<longrightarrow> Ball (set w) (case_DT_l2_l3_nonterminals (\<lambda>q y. False) (\<lambda>q1 b q2. True)) \<and> (case t of cons_l2 q y \<Rightarrow> True | cons_l3 q1 b q2 \<Rightarrow> False) \<and> (\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply(subgoal_tac "(\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
        prefer 2
        apply(case_tac v)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista)(*strict*)
        apply(erule_tac
      x="butlast v"
      in allE)
        apply(erule_tac
      x="last v"
      in allE)
        apply(erule impE)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista)(*strict*)
         apply (metis append_butlast_last_id list.simps(2))
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply(thin_tac "\<forall>w t. v = w @ [t] \<longrightarrow> Ball (set w) (case_DT_l2_l3_nonterminals (\<lambda>q y. False) (\<lambda>q1 b q2. True)) \<and> (case t of cons_l2 q y \<Rightarrow> True | cons_l3 q1 b q2 \<Rightarrow> False) \<and> (\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply(erule_tac
      x="0"
      in allE)
       apply(erule impE)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
        apply(case_tac v)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
         apply(clarsimp)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q b)(*strict*)
         apply (metis setA_liftB elemInsetA empty_iff)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista)(*strict*)
        apply(case_tac lista)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista)(*strict*)
         apply(clarsimp)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q b a)(*strict*)
         apply(case_tac list)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q b a)(*strict*)
          apply(clarsimp)
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w q b)(*strict*)
          apply (metis setA_liftB elemInsetA empty_iff)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q b a aa lista)(*strict*)
         apply(subgoal_tac "\<exists>w' x'. list=w'@[x']")
          apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q b a aa lista)(*strict*)
          prefer 2
          apply(rule_tac
      n="length lista"
      in NonEmptyListHasTailElem)
          apply(force)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q b a aa lista)(*strict*)
         apply(thin_tac "list=aa # lista")
         apply(clarsimp)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w q b a w')(*strict*)
         apply (metis setA_liftB elemInsetA empty_iff)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b a lista aa listb)(*strict*)
        apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply(subgoal_tac "l=liftB w")
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v list q b)(*strict*)
        apply(case_tac v)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v list q b)(*strict*)
         apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v list q b a lista)(*strict*)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs w list q b lista)(*strict*)
        apply(case_tac lista)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs w list q b lista)(*strict*)
         apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs w list q b lista a listb)(*strict*)
        apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q b)(*strict*)
       apply (metis split_decide1)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list aa q1 b q2)(*strict*)
      apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply(subgoal_tac "\<forall>w t. v = w @ [t] \<longrightarrow> Ball (set w) (case_DT_l2_l3_nonterminals (\<lambda>q y. False) (\<lambda>q1 b q2. True)) \<and> (case t of cons_l2 q y \<Rightarrow> True | cons_l3 q1 b q2 \<Rightarrow> False) \<and> (\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
       prefer 2
       apply(case_tac v)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista)(*strict*)
       apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply(thin_tac "case v of [] \<Rightarrow> True | a # y \<Rightarrow> \<forall>w t. v = w @ [t] \<longrightarrow> Ball (set w) (case_DT_l2_l3_nonterminals (\<lambda>q y. False) (\<lambda>q1 b q2. True)) \<and> (case t of cons_l2 q y \<Rightarrow> True | cons_l3 q1 b q2 \<Rightarrow> False) \<and> (\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply(subgoal_tac "(\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
       prefer 2
       apply(case_tac v)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista)(*strict*)
       apply(erule_tac
      x="butlast v"
      in allE)
       apply(erule_tac
      x="last v"
      in allE)
       apply(erule impE)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista)(*strict*)
        apply (metis append_butlast_last_id list.simps(2))
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply(thin_tac "\<forall>w t. v = w @ [t] \<longrightarrow> Ball (set w) (case_DT_l2_l3_nonterminals (\<lambda>q y. False) (\<lambda>q1 b q2. True)) \<and> (case t of cons_l2 q y \<Rightarrow> True | cons_l3 q1 b q2 \<Rightarrow> False) \<and> (\<forall>i. Suc i < length v \<longrightarrow> (case v ! i of cons_l3 q1 A q2 \<Rightarrow> q2) = (case v ! Suc i of cons_l2 q1 A \<Rightarrow> q1 | cons_l3 q1 A q2 \<Rightarrow> q1))")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply(erule_tac
      x="0"
      in allE)
      apply(erule impE)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
       apply(case_tac v)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q1 b q2)(*strict*)
        apply (metis setA_liftB elemInsetA empty_iff)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista)(*strict*)
       apply(case_tac lista)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista)(*strict*)
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q1 b q2 a)(*strict*)
        apply(case_tac list)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q1 b q2 a)(*strict*)
         apply(clarsimp)
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w q1 b q2)(*strict*)
         apply (metis setA_liftB elemInsetA empty_iff)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q1 b q2 a aa lista)(*strict*)
        apply(subgoal_tac "\<exists>w' x'. list=w'@[x']")
         apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q1 b q2 a aa lista)(*strict*)
         prefer 2
         apply(rule_tac
      n="length lista"
      in NonEmptyListHasTailElem)
         apply(force)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w list q1 b q2 a aa lista)(*strict*)
        apply(thin_tac "list=aa # lista")
        apply(clarsimp)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w q1 b q2 a w')(*strict*)
        apply (metis setA_liftB elemInsetA empty_iff)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2 a lista aa listb)(*strict*)
       apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply(subgoal_tac "l=liftB w")
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v list q1 b q2)(*strict*)
       apply(case_tac v)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v list q1 b q2)(*strict*)
        apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt w v list q1 b q2 a lista)(*strict*)
       apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs w list q1 b q2 lista)(*strict*)
       apply(case_tac lista)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs w list q1 b q2 lista)(*strict*)
        apply(clarsimp)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs w list q1 b q2 lista a listb)(*strict*)
       apply(clarsimp)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v list q1 b q2)(*strict*)
      apply (metis split_decide1)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt l w v a list b)(*strict*)
     apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
    apply(rule_tac
      x="derivation_append dL (der2 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)) nL"
      in exI)
    apply(rule conjI)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
     apply(rule epdaH.derivation_append_preserves_derivation_initial)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
     apply(rule epdaH.derivation_append_preserves_derivation)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
       apply(simp add: epdaH.derivation_initial_def)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
      apply(rule epdaH.der2_is_derivation)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
     apply(clarsimp)
     apply(simp add: der2_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
    apply(rule_tac
      x="Suc nL"
      in exI)
    apply(simp add: derivation_append_def der2_def)
    apply(rule conjI)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa y qs qt)(*strict*)
    apply(clarsimp)
    apply(rule_tac
      x="wa"
      in exI)
    apply(force)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
    apply(clarsimp)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event x")
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
    prefer 2
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "case edge_event x of None \<Rightarrow> edge_push x = [] \<or> (\<exists>y. edge_push x = y # edge_pop x) | Some a \<Rightarrow> edge_pop x = edge_push x")
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
    prefer 2
    apply(simp add: valid_simple_dpda_def)
    apply(clarsimp)
    apply(erule_tac
      x="x"
      in ballE)
     apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt)(*strict*)
   apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt)(*strict*)
    prefer 2
    apply(rule_tac
      G="G1"
      in valid_pda_edge_pop_single)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt)(*strict*)
     apply(simp add: valid_simple_dpda_def valid_dpda_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt y)(*strict*)
   apply(case_tac x)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs qt y edge_srca edge_eventa edge_popa edge_pusha edge_trga)(*strict*)
   apply(rename_tac qs re po pu qt)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qsa qta y qs re po pu qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt)(*strict*)
   apply(simp add: cfgLM_step_relation_def)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
   apply(rule_tac
      t="edge_src \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>"
      and s="qs"
      in ssubst)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
   apply(rule_tac
      t="edge_pop \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>!0"
      and s="y"
      in ssubst)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
   apply(rule_tac
      t="edge_trg \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>"
      and s="qt"
      in ssubst)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
   apply(subgoal_tac "epdaH_step_relation G1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a,y], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)")
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    prefer 2
    apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
     prefer 2
     apply(rule_tac
      n="nR"
      in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
     apply(simp add: get_configuration_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(thin_tac "cfgLM.derivation_initial (F_SDPDA_TO_CFG_STD G1) dR")
    apply(thin_tac "dR (Suc nR) = Some (pair (Some \<lparr>prod_lhs = cons_l3 qs y qta, prod_rhs = [teA (cons_l3   qt a qsa), teA (cons_l3   qsa y qta)]\<rparr>) cR2)")
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(thin_tac "dR nR = Some (pair eR1 cR1)")
    apply(thin_tac "epdaH.derivation_initial G1 dL")
    apply(thin_tac "dL nL = Some (pair eL (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa))")
    apply(simp add: epdaH_step_relation_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
    apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
    apply(subgoal_tac "setB r={} \<and> r\<noteq>[]")
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
     prefer 2
     apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
     apply(clarsimp)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r w v)(*strict*)
     apply(subgoal_tac "l=liftB w")
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r w v)(*strict*)
      prefer 2
      apply(rule split_decide1)
       apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r w v)(*strict*)
       apply(force)
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r w v)(*strict*)
      apply(force)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r w v)(*strict*)
     apply(clarsimp)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt r w v)(*strict*)
     apply(rule context_conjI)
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt r w v)(*strict*)
      apply(rule_tac
      v="v"
      and y="[]"
      and w="[teA (cons_l3   qs y qta)]"
      in liftA_append_setB)
      apply(force)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt r w v)(*strict*)
     apply(clarsimp)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w v)(*strict*)
     apply(case_tac v)
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w v)(*strict*)
      apply(force)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w v aa list)(*strict*)
     apply(clarsimp)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w list)(*strict*)
     apply(case_tac list)
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w list)(*strict*)
      prefer 2
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w list aa lista)(*strict*)
      apply(force)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt w list)(*strict*)
     apply(force)
    apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
    apply(clarsimp)
    apply(rule_tac
      t="THE v. \<exists>w. l @ teA (cons_l3   qs y qta) # r = liftB w @ liftA v"
      and s="(cons_l3 qs y qta) # (filterA r)"
      in ssubst)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
     apply(rule THE_split3)
      apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
      apply(force)
     apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
     apply(force)
  apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
  apply(rule_tac
    t="THE v. \<exists>w. l @ teA (cons_l3   qt a qsa) # teA (cons_l3   qsa y qta) # r = liftB w @ liftA v"
    and s="(cons_l3 qt a qsa) # (cons_l3 qsa y qta) # (filterA r)"
    in ssubst)
   apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
   apply(rule THE_split3_prime)
    apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
   apply(force)
  apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: option_to_list_def)
  apply(rule_tac
    t="THE w. \<exists>v. l @ teA (cons_l3   qt a qsa) # teA (cons_l3   qsa y qta) # r = liftB w @ liftA v"
    and s="filterB l"
    in ssubst)
   apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
   apply(rule THE_split6)
    apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
   apply(force)
  apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
  apply(rule_tac
    t="THE w. \<exists>v. l @ teA (cons_l3   qs y qta) # r = liftB w @ liftA v"
    and s="filterB l"
    in ssubst)
   apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
   apply(rule THE_split6)
    apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
   apply(force)
  apply(rename_tac cR2 cR1 wa a qsa qta y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(rule_tac
    x="derivation_append dL (der2 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a,y], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)) nL"
    in exI)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation_initial)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
    apply(simp add: epdaH.derivation_initial_def)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
   apply(rule epdaH.der2_is_derivation)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: der2_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(rule_tac
    x="Suc nL"
    in exI)
  apply(simp add: derivation_append_def der2_def)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule disjI1)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa qta y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    x="wa"
    in exI)
  apply(force)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
  apply(erule disjE)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
  apply(case_tac "edge_event x")
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a)(*strict*)
  apply(clarsimp)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  prefer 2
  apply(rule_tac
    G="G1"
    in valid_pda_edge_pop_single)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
   apply(simp add: valid_simple_dpda_def valid_dpda_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a y)(*strict*)
  apply(case_tac x)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a y edge_srca edge_eventa edge_popa edge_push edge_trga)(*strict*)
  apply(rename_tac qs re po pu qt)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a y qs re po pu qt)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="edge_src \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
    and s="qs"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="edge_pop \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
    and s="[y]"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="edge_trg \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
    and s="qt"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="[y] ! 0"
    and s="y"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(subgoal_tac "epdaH_step_relation G1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  prefer 2
  apply(simp add: epdaH_step_relation_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
  apply(rule_tac
    t="THE v. \<exists>w. l @ teA (cons_l2   qs y) # r = liftB w @ liftA v"
    and s="(cons_l2 qs y) # (filterA r)"
    in ssubst)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(rule THE_split3)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     prefer 2
     apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     apply(simp add: get_configuration_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
    apply(subgoal_tac "l=liftB w")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     prefer 2
     apply(rule split_decide1)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt r w v)(*strict*)
    apply(rule_tac
    v="v"
    and y="[]"
    and w="[teA (cons_l2   qs y)]"
    in liftA_append_setB)
    apply(clarsimp)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="l @ teB a # teA (cons_l2   qt y) # r"
    and s="(l @ [teB a]) @ teA (cons_l2   qt y) # r"
    in ssubst)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="THE v. \<exists>w. (l @ [teB a]) @ teA (cons_l2   qt y) # r = liftB w @ liftA v"
    and s="(cons_l2 qt y) # (filterA r)"
    in ssubst)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(rule THE_split3)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     prefer 2
     apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     apply(simp add: get_configuration_def)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
    apply(subgoal_tac "l=liftB w")
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     prefer 2
     apply(rule split_decide1)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
    apply(clarsimp)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt r w v)(*strict*)
    apply(rule_tac
    v="v"
    and y="[]"
    and w="[teA (cons_l2   qs y)]"
    in liftA_append_setB)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply (metis setA_liftB liftBDeConv2 liftB_commute_one_elem_app)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="THE w. \<exists>v. (l @ [teB a]) @ teA (cons_l2   qt y) # r = liftB w @ liftA v"
    and s="filterB l@[a]"
    in ssubst)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(rule THE_split4)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
      prefer 2
      apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
      apply(simp add: get_configuration_def)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     apply(subgoal_tac "l=liftB w")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
      prefer 2
      apply(rule split_decide1)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt r w v)(*strict*)
     apply(rule_tac
    v="v"
    and y="[]"
    and w="[teA (cons_l2   qs y)]"
    in liftA_append_setB)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply (metis setA_liftB liftBDeConv2 liftB_commute_one_elem_app)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply (metis liftBDeConv1 liftBDeConv2 liftB_commute_one_elem_app)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    t="THE w. \<exists>v. l @ teA (cons_l2   qs y) # r = liftB w @ liftA v"
    and s="filterB l"
    in ssubst)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(rule THE_split4)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
      prefer 2
      apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
        apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
        apply(force)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
      apply(simp add: get_configuration_def)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
     apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     apply(subgoal_tac "l=liftB w")
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
      prefer 2
      apply(rule split_decide1)
       apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
       apply(force)
      apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
      apply(force)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r w v)(*strict*)
     apply(clarsimp)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt r w v)(*strict*)
     apply(rule_tac
    v="v"
    and y="[]"
    and w="[teA (cons_l2   qs y)]"
    in liftA_append_setB)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply (metis)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply (metis liftBDeConv1 liftBDeConv2 liftB_commute_one_elem_app)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: option_to_list_def)
  apply(simp add: valid_simple_dpda_def)
  apply(clarsimp)
  apply(erule_tac
    x="\<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr>"
    in ballE)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    x="derivation_append dL (der2 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = Some a, edge_pop = [y], edge_push = pu, edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)) nL"
    in exI)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation_initial)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
    apply(simp add: epdaH.derivation_initial_def)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
   apply(rule epdaH.der2_is_derivation)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: der2_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(rule_tac
    x="Suc nL"
    in exI)
  apply(simp add: derivation_append_def der2_def)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule disjI2)
  apply(rule disjI2)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs pu qt l r)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    x="wa"
    in exI)
  apply(force)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(erule disjE)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
  apply(subgoal_tac "setA (cfg_conf cR2) = {}")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    x="dL"
    in exI)
  apply(clarsimp)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
  apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
  prefer 2
  apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
  apply(simp add: get_configuration_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A)(*strict*)
  apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v l r)(*strict*)
  apply(subgoal_tac "liftB w=l")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v r)(*strict*)
  apply(case_tac v)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v r)(*strict*)
   apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v r a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w list)(*strict*)
  apply(case_tac cR1)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w list cfg_confa)(*strict*)
  apply(case_tac cR2)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w list cfg_confa cfg_confaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR eR1 dL nL eL wa i A w list)(*strict*)
  apply(erule_tac
    x="butlast (cons_l2 i A # list)"
    in allE)
  apply(erule_tac
    x="last (cons_l2 i A # list)"
    in allE)
  apply(erule impE)
   apply(rename_tac nR eR1 dL nL eL wa i A w list)(*strict*)
   apply (metis append_butlast_last_id list.simps(2))
  apply(rename_tac nR eR1 dL nL eL wa i A w list)(*strict*)
  apply(clarsimp)
  apply(case_tac list)
   apply(rename_tac nR eR1 dL nL eL wa i A w list)(*strict*)
   apply(clarsimp)
  apply(rename_tac nR eR1 dL nL eL wa i A w list a lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v l r)(*strict*)
  apply (rule sym)
  apply(rule_tac
    v="v"
    in split_decide1)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa i A w v l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
  apply(case_tac "edge_push x")
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event x")
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  prefer 2
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  apply(subgoal_tac "case edge_event x of None \<Rightarrow> edge_push x = [] \<or> (\<exists>y. edge_push x = y # edge_pop x) | Some a \<Rightarrow> edge_pop x = edge_push x")
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  prefer 2
  apply(simp add: valid_simple_dpda_def)
  apply(clarsimp)
  apply(erule_tac
    x="x"
    in ballE)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  prefer 2
  apply(force)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(erule disjE)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  prefer 2
  apply(rule_tac
    G="G1"
    in valid_pda_edge_pop_single)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
   apply(simp add: valid_simple_dpda_def valid_dpda_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a y)(*strict*)
  apply(case_tac x)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a y edge_srca edge_eventa edge_popa edge_pusha edge_trga)(*strict*)
  apply(rename_tac qs re po pu qt)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a y qs re po pu qt)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule_tac
    t="edge_src \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>"
    and s="qs"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule_tac
    t="edge_pop \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>!0"
    and s="y"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule_tac
    t="edge_trg \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>"
    and s="qt"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(subgoal_tac "epdaH_step_relation G1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a,y], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 (y # wa))")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  prefer 2
  apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
   prefer 2
   apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
     apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
     apply(force)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
   apply(simp add: get_configuration_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(thin_tac "cfgLM.derivation_initial (F_SDPDA_TO_CFG_STD G1) dR")
  apply(thin_tac "dR (Suc nR) = Some (pair (Some \<lparr>prod_lhs = cons_l2 qs y, prod_rhs = [teA (cons_l2   qt a)]\<rparr>) cR2)")
  apply(thin_tac "dR nR = Some (pair eR1 cR1)")
  apply(thin_tac "epdaH.derivation_initial G1 dL")
  apply(thin_tac "dL nL = Some (pair eL (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa))")
  apply(simp add: epdaH_step_relation_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
  apply(rename_tac cR2 cR1 wa a y qs qt l r)(*strict*)
  apply(subgoal_tac "r=[]")
   apply(rename_tac cR2 cR1 wa a y qs qt l r)(*strict*)
   prefer 2
   apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
   apply(clarsimp)
   apply(rename_tac cR2 cR1 wa a y qs qt l r w v)(*strict*)
   apply(subgoal_tac "l=liftB w")
    apply(rename_tac cR2 cR1 wa a y qs qt l r w v)(*strict*)
    prefer 2
    apply(rule split_decide1)
     apply(rename_tac cR2 cR1 wa a y qs qt l r w v)(*strict*)
     apply(force)
    apply(rename_tac cR2 cR1 wa a y qs qt l r w v)(*strict*)
    apply(force)
   apply(rename_tac cR2 cR1 wa a y qs qt l r w v)(*strict*)
   apply(clarsimp)
   apply(rename_tac cR2 cR1 wa a y qs qt r w v)(*strict*)
   apply(case_tac v)
    apply(rename_tac cR2 cR1 wa a y qs qt r w v)(*strict*)
    apply(clarsimp)
   apply(rename_tac cR2 cR1 wa a y qs qt r w v aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac cR2 cR1 wa a y qs qt w list)(*strict*)
   apply(case_tac list)
    apply(rename_tac cR2 cR1 wa a y qs qt w list)(*strict*)
    apply(clarsimp)
   apply(rename_tac cR2 cR1 wa a y qs qt w list aa lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac cR2 cR1 wa a y qs qt w aa lista)(*strict*)
   apply(erule_tac
    x="butlast(cons_l2 qs y # aa # lista)"
    in allE)
   apply(erule_tac
    x="last(cons_l2 qs y # aa # lista)"
    in allE)
   apply(erule impE)
    apply(rename_tac cR2 cR1 wa a y qs qt w aa lista)(*strict*)
    apply (metis append_butlast_last_id list.simps(2))
   apply(rename_tac cR2 cR1 wa a y qs qt w aa lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a y qs qt l)(*strict*)
  apply(case_tac cR1)
  apply(rename_tac cR2 cR1 wa a y qs qt l cfg_confa)(*strict*)
  apply(case_tac cR2)
  apply(rename_tac cR2 cR1 wa a y qs qt l cfg_confa cfg_confaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac wa a y qs qt l)(*strict*)
  apply(rule_tac
    t="THE v. \<exists>w. l @ [teA (cons_l2   qs y)] = liftB w @ liftA v"
    and s="[cons_l2 qs y]"
    in ssubst)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply(rule_tac
    t="(THE v. \<exists>w. l @ [teA (cons_l2   qs y)] = liftB w @ liftA v)"
    in ssubst)
    apply(rename_tac wa a y qs qt l)(*strict*)
    apply(rule THE_split3)
     apply(rename_tac wa a y qs qt l)(*strict*)
     apply(force)
    apply(rename_tac wa a y qs qt l)(*strict*)
    apply(force)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply(force)
  apply(rename_tac wa a y qs qt l)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    t="(THE v. \<exists>w. l @ [teA (cons_l2   qt a)] = liftB w @ liftA v)"
    in ssubst)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply(rule THE_split3)
    apply(rename_tac wa a y qs qt l)(*strict*)
    apply(force)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply(force)
  apply(rename_tac wa a y qs qt l)(*strict*)
  apply(clarsimp)
  apply(simp add: option_to_list_def)
  apply(rule_tac
    t="THE w. \<exists>v. l @ [teA (cons_l2   qt a)] = liftB w @ liftA v"
    in ssubst)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply(rule THE_split4)
     apply(rename_tac wa a y qs qt l)(*strict*)
     apply(force)
    apply(rename_tac wa a y qs qt l)(*strict*)
    apply (force)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply (force)
  apply(rename_tac wa a y qs qt l)(*strict*)
  apply(rule_tac
    t="THE w. \<exists>v. l @ [teA (cons_l2   qs y)] = liftB w @ liftA v"
    in ssubst)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply(rule THE_split4)
     apply(rename_tac wa a y qs qt l)(*strict*)
     apply(force)
    apply(rename_tac wa a y qs qt l)(*strict*)
    apply (force)
   apply(rename_tac wa a y qs qt l)(*strict*)
   apply (force)
  apply(rename_tac wa a y qs qt l)(*strict*)
  apply (force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule_tac
    x="derivation_append dL (der2 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a,y], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 (y # wa))) nL"
    in exI)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation_initial)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
    apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
    apply(simp add: epdaH.derivation_initial_def)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
   apply(rule epdaH.der2_is_derivation)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: der2_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(rule_tac
    x="Suc nL"
    in exI)
  apply(simp add: derivation_append_def der2_def)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule disjI2)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    x="y # wa"
    in exI)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  prefer 2
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "valid_epda_step_label G1 \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(simp add: valid_epda_step_label_def)
  apply(clarsimp)
  apply(simp add: may_terminated_by_def append_language_def kleene_star_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r aa ab)(*strict*)
  apply(erule_tac
    P="[] = aa \<and> y = epda_box G1"
    in disjE)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r aa ab)(*strict*)
   apply(clarsimp)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qs qt l r ab)(*strict*)
   apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r aa ab)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a y qs qt l r)(*strict*)
  apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
  apply(rename_tac nR cR2 eR1 eR2 cR1 dL nL eL wa x a)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs)(*strict*)
  apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs)(*strict*)
  prefer 2
  apply(rule_tac
    G="G1"
    in valid_pda_edge_pop_single)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs)(*strict*)
  apply(simp add: valid_simple_dpda_def valid_dpda_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs y)(*strict*)
  apply(case_tac x)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qs y edge_srca edge_eventa edge_popa edge_pusha edge_trga)(*strict*)
  apply(rename_tac qs re po pu qt)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa x a qsa y qs re po pu qt)(*strict*)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule_tac
    t="edge_src \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>"
    and s="qs"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule_tac
    t="edge_pop \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>!0"
    and s="y"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule_tac
    t="edge_trg \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a, y], edge_trg = qt\<rparr>"
    and s="qt"
    in ssubst)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(subgoal_tac "epdaH_step_relation G1 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a,y], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  prefer 2
  apply(subgoal_tac "event_stack_separation_and_proper_l3_l2_seq_ALT cR1")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  prefer 2
  apply(rule_tac
    n="nR"
    in F_SDPDA_TO_CFG_STD__reachable_conf_of_certain_form)
    apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
    apply(force)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
   apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(simp add: get_configuration_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(thin_tac "cfgLM.derivation_initial (F_SDPDA_TO_CFG_STD G1) dR")
  apply(thin_tac "dR (Suc nR) = Some (pair (Some \<lparr>prod_lhs = cons_l2 qs y, prod_rhs = [teA (cons_l3   qt a qsa), teA (cons_l2   qsa y)]\<rparr>) cR2)")
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(thin_tac "dR nR = Some (pair eR1 cR1)")
  apply(thin_tac "epdaH.derivation_initial G1 dL")
  apply(thin_tac "dL nL = Some (pair eL (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa))")
  apply(simp add: epdaH_step_relation_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l r)(*strict*)
  apply(subgoal_tac "r=[]")
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l r)(*strict*)
  prefer 2
  apply(simp add: event_stack_separation_and_proper_l3_l2_seq_ALT_def)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l r w v)(*strict*)
  apply(subgoal_tac "l=liftB w")
   apply(rename_tac cR2 cR1 wa a qsa y qs qt l r w v)(*strict*)
   prefer 2
   apply(rule split_decide1)
    apply(rename_tac cR2 cR1 wa a qsa y qs qt l r w v)(*strict*)
    apply(force)
   apply(rename_tac cR2 cR1 wa a qsa y qs qt l r w v)(*strict*)
   apply(force)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l r w v)(*strict*)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt r w v)(*strict*)
  apply(case_tac v)
   apply(rename_tac cR2 cR1 wa a qsa y qs qt r w v)(*strict*)
   apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt r w v aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt w list)(*strict*)
  apply(case_tac list)
   apply(rename_tac cR2 cR1 wa a qsa y qs qt w list)(*strict*)
   apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt w list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt w aa lista)(*strict*)
  apply(erule_tac
    x="butlast(cons_l2 qs y # aa # lista)"
    in allE)
  apply(erule_tac
    x="last(cons_l2 qs y # aa # lista)"
    in allE)
  apply(erule impE)
   apply(rename_tac cR2 cR1 wa a qsa y qs qt w aa lista)(*strict*)
   apply (metis append_butlast_last_id list.simps(2))
  apply(rename_tac cR2 cR1 wa a qsa y qs qt w aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l)(*strict*)
  apply(case_tac cR1)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l cfg_confa)(*strict*)
  apply(case_tac cR2)
  apply(rename_tac cR2 cR1 wa a qsa y qs qt l cfg_confa cfg_confaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(rule_tac
    t="THE v. \<exists>w. l @ [teA (cons_l2   qs y)] = liftB w @ liftA v"
    and s="[cons_l2 qs y]"
    in ssubst)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply (rule THE_split3_X)
  apply(force)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    t="THE v. \<exists>w. l @ [teA (cons_l3   qt a qsa), teA (cons_l2   qsa y)] = liftB w @ liftA v"
    and s="[cons_l3 qt a qsa,cons_l2 qsa y]"
    in ssubst)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply (rule THE_split3_XX)
  apply(force)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    t="THE w. \<exists>v. l @ [teA (cons_l3   qt a qsa), teA (cons_l2   qsa y)] = liftB w @ liftA v"
    in ssubst)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(rule THE_split4)
    apply(rename_tac wa a qsa y qs qt l)(*strict*)
    apply(force)
   apply(rename_tac wa a qsa y qs qt l)(*strict*)
   apply(force)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(force)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(rule sym)
  apply(simp add: option_to_list_def)
  apply(rule_tac
    t="(THE w. \<exists>v. l @ [teA (cons_l2   qs y)] = liftB w @ liftA v)"
    in ssubst)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(rule THE_split4)
    apply(rename_tac wa a qsa y qs qt l)(*strict*)
    apply(force)
   apply(rename_tac wa a qsa y qs qt l)(*strict*)
   apply(force)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(force)
  apply(rename_tac wa a qsa y qs qt l)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule_tac
    x="derivation_append dL (der2 (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR1 wa) \<lparr>edge_src = qs, edge_event = None, edge_pop = [y], edge_push = [a,y], edge_trg = qt\<rparr> (F_SDPDA_TO_CFG_STD__configuration_basic_RL cR2 wa)) nL"
    in exI)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation_initial)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
   apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule epdaH.derivation_append_preserves_derivation)
   apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
   apply(simp add: epdaH.derivation_initial_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule epdaH.der2_is_derivation)
  apply(force)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(simp add: der2_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(rule_tac
    x="Suc nL"
    in exI)
  apply(simp add: derivation_append_def der2_def)
  apply(rule conjI)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule disjI2)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(rename_tac nR cR2 eR1 cR1 dL nL eL wa a qsa y qs qt l r)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    x="wa"
    in exI)
  apply(force)
  done

lemma F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1: "
  F_SDPDA_TO_CFG_STD__SpecInput G
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)) \<subseteq> epdaH_accessible_edges G"
  apply(unfold F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def F_SDPDA_TO_CFG_STD__SpecInput_def)
  apply(clarsimp)
  apply(rename_tac x xa)(*strict*)
  apply(simp add: cfgLM_accessible_productions_def)
  apply(clarsimp)
  apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
  apply(clarsimp)
  apply(rename_tac x xa d i e c)(*strict*)
  apply(erule disjE)
   apply(rename_tac x xa d i e c)(*strict*)
   apply(clarsimp)
  apply(rename_tac x xa d i e c)(*strict*)
  apply(case_tac e)
   apply(rename_tac x xa d i e c)(*strict*)
   apply(clarsimp)
  apply(rename_tac x xa d i e c a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x d i c a)(*strict*)
  apply(subgoal_tac "\<exists>dL nL eL cL. epdaH.derivation_initial G dL \<and> dL nL = Some (pair eL cL) \<and> (case Some a of Some eR' \<Rightarrow> eR' \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G) \<longrightarrow> (case eL of Some eL' \<Rightarrow> eL' \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G eR' | _ \<Rightarrow> False) | _ \<Rightarrow> True) \<and> (setA (cfg_conf c) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma G \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL c w))")
   apply(rename_tac x d i c a)(*strict*)
   prefer 2
   apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_back_hlp)
      apply(rename_tac x d i c a)(*strict*)
      apply(force)
     apply(rename_tac x d i c a)(*strict*)
     apply(force)
    apply(rename_tac x d i c a)(*strict*)
    apply(force)
   apply(rename_tac x d i c a)(*strict*)
   apply(force)
  apply(rename_tac x d i c a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x d i c a dL nL eL cL)(*strict*)
  apply(simp add: epdaH_accessible_edges_def)
  apply(rule conjI)
   apply(rename_tac x d i c a dL nL eL cL)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rename_tac x d i c a dL nL eL cL)(*strict*)
  apply(rule_tac
      x="dL"
      in exI)
  apply(clarsimp)
  apply(rule_tac
      x="nL"
      in exI)
  apply(clarsimp)
  apply(erule_tac
      P="a \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)"
      in impE)
   apply(rename_tac x d i c a dL nL eL cL)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
   apply(erule disjE)
    apply(rename_tac x d i c a dL nL eL cL)(*strict*)
    apply(clarsimp)
    apply(rename_tac x d i c dL nL eL cL ia A y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
   apply(rename_tac x d i c a dL nL eL cL)(*strict*)
   apply(clarsimp)
   apply(rename_tac x d i c dL nL eL cL ia A)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(rename_tac x d i c a dL nL eL cL)(*strict*)
  apply(case_tac eL)
   apply(rename_tac x d i c a dL nL eL cL)(*strict*)
   apply(clarsimp)
  apply(rename_tac x d i c a dL nL eL cL aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x d i c a dL nL cL aa)(*strict*)
  apply(subgoal_tac "\<exists>x. edge_pop aa=[x]")
   apply(rename_tac x d i c a dL nL cL aa)(*strict*)
   prefer 2
   apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
   apply(clarsimp)
   apply(erule_tac
      x="aa"
      and P="\<lambda>aa. length (edge_pop aa) = Suc 0"
      in ballE)
    apply(rename_tac x d i c a dL nL cL aa)(*strict*)
    prefer 2
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(rename_tac x d i c a dL nL cL aa)(*strict*)
   apply(case_tac aa)
   apply(rename_tac x d i c a dL nL cL aa edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
   apply(clarsimp)
   apply(rename_tac x d i c a dL nL cL edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
   apply(case_tac edge_popa)
    apply(rename_tac x d i c a dL nL cL edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
    apply(clarsimp)
   apply(rename_tac x d i c a dL nL cL edge_src edge_eventa edge_popa edge_pusha edge_trg aa list)(*strict*)
   apply(clarsimp)
  apply(rename_tac x d i c a dL nL cL aa)(*strict*)
  apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
   apply(rename_tac x d i c a dL nL cL aa)(*strict*)
   prefer 2
   apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
   apply(clarsimp)
   apply(rename_tac x d i c a dL nL cL aa xa)(*strict*)
   apply(erule_tac
      x="x"
      and P="\<lambda>x. length (edge_pop x) = Suc 0"
      in ballE)
    apply(rename_tac x d i c a dL nL cL aa xa)(*strict*)
    prefer 2
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(rename_tac x d i c a dL nL cL aa xa)(*strict*)
   apply(case_tac x)
   apply(rename_tac x d i c a dL nL cL aa xa edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
   apply(clarsimp)
   apply(rename_tac d i c a dL nL cL aa xa edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
   apply(case_tac edge_popa)
    apply(rename_tac d i c a dL nL cL aa xa edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
    apply(clarsimp)
   apply(rename_tac d i c a dL nL cL aa xa edge_src edge_eventa edge_popa edge_pusha edge_trg ab list)(*strict*)
   apply(clarsimp)
  apply(rename_tac x d i c a dL nL cL aa)(*strict*)
  apply(case_tac aa)
  apply(rename_tac x d i c a dL nL cL aa edge_src edge_event edge_popa edge_push edge_trg)(*strict*)
  apply(rename_tac qs1 re1 po1 pu1 qt1)
  apply(rename_tac x d i c a dL nL cL aa qs1 re1 po1 pu1 qt1)(*strict*)
  apply(case_tac x)
  apply(rename_tac x d i c a dL nL cL aa qs1 re1 po1 pu1 qt1 edge_src edge_event edge_popa edge_push edge_trg)(*strict*)
  apply(rename_tac qs2 re2 po2 pu2 qt2)
  apply(rename_tac x d i c a dL nL cL aa qs1 re1 po1 pu1 qt1 qs2 re2 po2 pu2 qt2)(*strict*)
  apply(clarsimp)
  apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 xa y)(*strict*)
  apply(rename_tac po1 po2)
  apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
  apply(subgoal_tac "epdaH.is_forward_edge_deterministicHist_DB_long G")
   apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
   prefer 2
   apply(rule epdaHS2HF_FEdetermHist)
    apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
    apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
   apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
   apply(subgoal_tac "epdaHS.is_forward_edge_deterministic_accessible G")
    apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
    prefer 2
    apply(subgoal_tac "epdaS.is_forward_edge_deterministic_accessible G")
     apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
     prefer 2
     apply(simp add: valid_simple_dpda_def valid_dpda_def)
    apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
    apply(rule_tac
      ?G1.0="G"
      in epdaS_vs_epdaHS.preserve_FEdetermR1)
     apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
     apply(simp add: epdaS_vs_epdaHS_TSstructure_rel_def valid_dpda_to_valid_pda valid_pda_to_valid_epda valid_simple_dpda_to_valid_dpda)
    apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
    apply(force)
   apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
   apply(subgoal_tac "epdaHS.is_forward_edge_deterministicHist_DB_long G")
    apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
    prefer 2
    apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
    apply(clarsimp)
    apply (metis epdaHS.is_forward_edge_deterministic_accessible_implies_is_forward_edge_deterministicHist_DB_long)
   apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
   apply(force)
  apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
  apply(case_tac nL)
   apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2)(*strict*)
   apply (metis epdaH.derivation_initial_is_derivation epdaH.initialNotEdgeSome_prime)
  apply(rename_tac d i c a dL nL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 nat)(*strict*)
  apply(clarsimp)
  apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 nat)(*strict*)
  apply(rename_tac n)
  apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n)(*strict*)
  apply(subgoal_tac "\<exists>e c. dL n = Some (pair e c)")
   apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n)(*strict*)
   prefer 2
   apply(rule epdaH.pre_some_position_is_some_position)
     apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n)(*strict*)
     apply (rule epdaH.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n)(*strict*)
    apply(force)
   apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n)(*strict*)
   apply(force)
  apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n)(*strict*)
  apply(clarsimp)
  apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
  apply(subgoal_tac "qs1 = qs2 \<and> re1=re2 \<and> po1 = po2")
   apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
   prefer 2
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(clarsimp)
   apply(erule_tac
      P="(\<exists>qt. a = \<lparr>prod_lhs = cons_l3 qs2 po2 qt, prod_rhs = [teB (the re2), teA (cons_l3   qt2 po2 qt)]\<rparr> \<and> qt \<in> epda_states G) \<and> (\<exists>y. re2 = Some y)"
      in disjE)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(clarsimp)
   apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
   apply(erule_tac
      P="(\<exists>qt. a = \<lparr>prod_lhs = cons_l3 qs1 po1 qt, prod_rhs = [teB (the re1), teA (cons_l3   qt1 po1 qt)]\<rparr> \<and> qt \<in> epda_states G) \<and> (\<exists>y. re1 = Some y)"
      in disjE)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(clarsimp)
   apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
   apply(erule_tac
      P="a = \<lparr>prod_lhs = cons_l3 qs2 po2 qt2, prod_rhs = []\<rparr> \<and> pu2 = []"
      in disjE)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    prefer 2
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule_tac
      P="a = \<lparr>prod_lhs = cons_l3 qs1 po1 qt1, prod_rhs = []\<rparr> \<and> pu1 = []"
      in disjE)
     apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule_tac
      P="(\<exists>qs qt. a = \<lparr>prod_lhs = cons_l3 qs2 po2 qt, prod_rhs = [teA (cons_l3   qt2 (pu2 ! 0) qs), teA (cons_l3   qs po2 qt)]\<rparr> \<and> qs \<in> epda_states G \<and> qt \<in> epda_states G) \<and> pu2 \<noteq> [] \<and> re2 = None"
      in disjE)
     apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule_tac
      P="(\<exists>qs qt. a = \<lparr>prod_lhs = cons_l3 qs1 po1 qt, prod_rhs = [teA (cons_l3   qt1 (pu1 ! 0) qs), teA (cons_l3   qs po1 qt)]\<rparr> \<and> qs \<in> epda_states G \<and> qt \<in> epda_states G) \<and> pu1 \<noteq> [] \<and> re1 = None"
      in disjE)
     apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule_tac
      P="a = \<lparr>prod_lhs = cons_l2 qs2 po2, prod_rhs = [teB (the re2), teA (cons_l2   qt2 po2)]\<rparr> \<and> (\<exists>y. re2 = Some y)"
      in disjE)
     apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule disjE)
     apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 pu1 qt1 qs2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule_tac
      P="a = \<lparr>prod_lhs = cons_l2 qs2 po2, prod_rhs = [teA (cons_l2   qt2 (pu2 ! 0))]\<rparr>"
      in disjE)
     apply(rename_tac d i c a dL cL qs1 pu1 qt1 qs2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 pu1 qt1 qs2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(erule disjE)
     apply(rename_tac d i c a dL cL qs1 pu1 qt1 qs2 pu2 qt2 po1 po2 n e ca)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c a dL cL qs1 pu1 qt1 qs2 pu2 qt2 po1 po2 n e ca)(*strict*)
    apply(clarsimp)
   apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
   apply(subgoal_tac "\<lparr>edge_src = qs1, edge_event = None, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr> \<in> epda_delta G")
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    prefer 2
    apply(subgoal_tac "\<lparr>prod_lhs = cons_l3 qs1 po1 qt1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<or> \<lparr>prod_lhs = cons_l3 qs1 po1 qt1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l2 G")
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     prefer 2
     apply(simp add: F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(erule disjE)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
     apply(erule disjE)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
      apply(clarsimp)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
      apply(case_tac "edge_event x")
       apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
       apply(clarsimp)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a)(*strict*)
      apply(clarsimp)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(erule disjE)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
      apply(clarsimp)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
      apply(case_tac "edge_push x")
       apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
       apply(clarsimp)
       apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
       apply(clarsimp)
       apply(rename_tac d i c dL cL re1 re2 n e ca x)(*strict*)
       apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
        apply(rename_tac d i c dL cL re1 re2 n e ca x)(*strict*)
        prefer 2
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(clarsimp)
        apply(erule_tac
      x="x"
      and P="\<lambda>x. length (edge_pop x) = Suc 0"
      in ballE)
         apply(rename_tac d i c dL cL re1 re2 n e ca x)(*strict*)
         prefer 2
         apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
        apply(rename_tac d i c dL cL re1 re2 n e ca x)(*strict*)
        apply(case_tac x)
        apply(rename_tac d i c dL cL re1 re2 n e ca x edge_srca edge_eventa edge_popa edge_pusha edge_trga)(*strict*)
        apply(clarsimp)
        apply(rename_tac d i c dL cL re1 re2 n e ca edge_src edge_eventa edge_popa edge_trg)(*strict*)
        apply(case_tac edge_popa)
         apply(rename_tac d i c dL cL re1 re2 n e ca edge_src edge_eventa edge_popa edge_trg)(*strict*)
         apply(clarsimp)
        apply(rename_tac d i c dL cL re1 re2 n e ca edge_src edge_eventa edge_popa edge_trg a list)(*strict*)
        apply(clarsimp)
       apply(rename_tac d i c dL cL re1 re2 n e ca x)(*strict*)
       apply(clarsimp)
       apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
       apply(subgoal_tac "(\<forall>e \<in> epda_delta G. case edge_event e of None \<Rightarrow> edge_push e = [] \<or> (\<exists>x. edge_push e = x # edge_pop e) | Some a \<Rightarrow> edge_pop e = edge_push e)")
        apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
        prefer 2
        apply(simp add: valid_simple_dpda_def)
       apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
       apply(erule_tac
      x="x"
      in ballE)
        apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
        prefer 2
        apply(force)
       apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
       apply(case_tac "edge_event x")
        apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
        prefer 2
        apply(rename_tac d i c dL cL re1 re2 n e ca x y a)(*strict*)
        apply(force)
       apply(rename_tac d i c dL cL re1 re2 n e ca x y)(*strict*)
       apply(clarsimp)
       apply(case_tac x)
       apply(rename_tac d i c dL cL re1 re2 n e ca x y edge_srca edge_eventa edge_popa edge_pusha edge_trga)(*strict*)
       apply(clarsimp)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
     apply(case_tac "edge_push x")
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
      apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
     apply(clarsimp)
     apply(case_tac "edge_event x")
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
      prefer 2
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list aa)(*strict*)
      apply(force)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
     apply(clarsimp)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
    apply(erule disjE)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
     apply(case_tac "edge_event x")
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
      apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a)(*strict*)
     apply(clarsimp)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(erule disjE)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "\<exists>y. edge_pop x=[y]")
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
     prefer 2
     apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
     apply(clarsimp)
     apply(erule_tac
      x="x"
      and P="\<lambda>x. length (edge_pop x) = Suc 0"
      in ballE)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
      prefer 2
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
     apply(case_tac x)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
     apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca a list edge_src edge_eventa edge_popa edge_trg)(*strict*)
     apply(case_tac edge_popa)
      apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca a list edge_src edge_eventa edge_popa edge_trg)(*strict*)
      apply(clarsimp)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca a list edge_src edge_eventa edge_popa edge_trg aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
    apply(subgoal_tac "(\<forall>e \<in> epda_delta G. case edge_event e of None \<Rightarrow> edge_push e = [] \<or> (\<exists>x. edge_push e = x # edge_pop e) | Some a \<Rightarrow> edge_pop e = edge_push e)")
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
     prefer 2
     apply(simp add: valid_simple_dpda_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
    apply(erule_tac
      x="x"
      in ballE)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
     prefer 2
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y aa)(*strict*)
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a list y)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a y)(*strict*)
    apply(case_tac x)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca x a y edge_src edge_eventa edge_popa edge_pusha edge_trg)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca a y edge_src edge_trg)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
   apply(subgoal_tac "re1=None")
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(subgoal_tac "re2=None")
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(thin_tac "re1=None")
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(case_tac re2)
     apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca a)(*strict*)
    apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(thin_tac "\<lparr>edge_src = qs1, edge_event = re1, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr> \<in> epda_delta G")
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(thin_tac "cfgLM.derivation_initial (F_SDPDA_TO_CFG_STD G) d")
    apply(thin_tac "setA (cfg_conf c) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma G \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL c w)")
    apply(simp add: epdaH.is_forward_edge_deterministicHist_DB_long_def)
    apply(erule_tac
      x="ca"
      in allE)
    apply(erule impE)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(rule_tac
      x="dL"
      in exI)
     apply(clarsimp)
     apply(simp add: get_configuration_def)
     apply(rule_tac
      x="n"
      in exI)
     apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(subgoal_tac "epdaH_step_relation G ca \<lparr>edge_src = qs1, edge_event = re1, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr> cL")
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     prefer 2
     apply(simp add: epdaH.derivation_initial_def epdaH.derivation_def)
     apply(clarsimp)
     apply(erule_tac
      x="Suc n"
      in allE)
     apply(clarsimp)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(erule_tac
      x="\<lparr>epdaH_conf_state=qt1,epdaH_conf_history=the(right_quotient_word(epdaH_conf_history cL)(option_to_list re1))@(option_to_list (Some a)),epdaH_conf_stack=epdaH_conf_stack cL\<rparr>"
      in allE)
    apply(erule_tac
      x="\<lparr>epdaH_conf_state=qt1,epdaH_conf_history=the(right_quotient_word(epdaH_conf_history cL)(option_to_list re1)),epdaH_conf_stack=epdaH_conf_stack cL\<rparr>"
      in allE)
    apply(erule_tac
      x="\<lparr>edge_src = qs1, edge_event = (Some a), edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr>"
      in allE)
    apply(erule_tac
      x="\<lparr>edge_src = qs1, edge_event = None, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr>"
      in allE)
    apply(erule impE)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(rule_tac
      x="[a]"
      in exI)
    apply(rule conjI)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(simp add: epda_effects_def valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
     apply(clarsimp)
     apply(erule_tac
      x="\<lparr>edge_src = qs1, edge_event = Some a, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr>"
      in ballE)
      apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
      prefer 2
      apply(force)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(simp add: valid_epda_step_label_def)
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(rule_tac
      x="[]"
      in exI)
    apply(rule conjI)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(simp add: epda_effects_def valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(rule conjI)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(simp add: epdaH_step_relation_def)
     apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list re1) (option_to_list re1)"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
      apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
      apply (metis right_quotient_word_removes_right_addition)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(force)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(rule conjI)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(simp add: epdaH_step_relation_def)
     apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list re1) (option_to_list re1)"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
      apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
      apply (metis right_quotient_word_removes_right_addition)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(simp add: option_to_list_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(rule conjI)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(clarsimp)
     apply(simp add: epdaH_step_relation_def)
     apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list re1) (option_to_list re1)"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
      apply(rename_tac d i c dL cL re1 po1 n e ca a)(*strict*)
      apply (metis right_quotient_word_removes_right_addition)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(clarsimp)
     apply(rename_tac d i c dL cL re1 po1 n e ca a)(*strict*)
     apply(simp add: option_to_list_def)
    apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
    apply(rule conjI)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(clarsimp)
     apply(simp add: epdaH_step_relation_def)
     apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list re1) (option_to_list re1)"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
      apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
      apply (metis right_quotient_word_removes_right_addition)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list re1) (option_to_list re1)"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
      apply(rename_tac d i c dL cL re1 po1 n e ca a)(*strict*)
      apply (metis right_quotient_word_removes_right_addition)
     apply(rename_tac d i c dL cL qs1 re1 qt1 po1 n e ca a)(*strict*)
     apply(clarsimp)
    apply(rename_tac d i c dL cL re1 po1 n e ca a x xa)(*strict*)
    apply(simp add: epdaH.history_fragment_prefixes_def)
    apply(simp add: epda_effects_def)
    apply(clarsimp)
    apply(rename_tac d i c dL cL re1 po1 n e ca a x hf'')(*strict*)
    apply(case_tac x)
     apply(rename_tac d i c dL cL re1 po1 n e ca a x hf'')(*strict*)
     apply(force)
    apply(rename_tac d i c dL cL re1 po1 n e ca a x hf'' aa list)(*strict*)
    apply(force)
   apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
   apply(case_tac re1)
    apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca)(*strict*)
    apply(force)
   apply(rename_tac d i c dL cL qs1 re1 qt1 re2 po1 n e ca a)(*strict*)
   apply(clarsimp)
   apply(rename_tac d i c dL cL qs1 qt1 re2 po1 n e ca a)(*strict*)
   apply(thin_tac "\<lparr>edge_src = qs1, edge_event = re2, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr> \<in> epda_delta G")
   apply(rename_tac d i c dL cL qs1 qt1 re2 po1 n e ca a)(*strict*)
   apply(thin_tac "cfgLM.derivation_initial (F_SDPDA_TO_CFG_STD G) d")
   apply(thin_tac "setA (cfg_conf c) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma G \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL c w)")
   apply(simp add: epdaH.is_forward_edge_deterministicHist_DB_long_def)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(erule_tac
      x="ca"
      in allE)
   apply(erule impE)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(rule_tac
      x="dL"
      in exI)
    apply(clarsimp)
    apply(simp add: get_configuration_def)
    apply(rule_tac
      x="n"
      in exI)
    apply(clarsimp)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(subgoal_tac "epdaH_step_relation G ca \<lparr>edge_src = qs1, edge_event = Some a, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr> cL")
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    prefer 2
    apply(simp add: epdaH.derivation_initial_def epdaH.derivation_def)
    apply(clarsimp)
    apply(erule_tac
      x="Suc n"
      in allE)
    apply(clarsimp)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(erule_tac
      x="cL"
      in allE)
   apply(erule_tac
      x="\<lparr>epdaH_conf_state=qt1,epdaH_conf_history=the(right_quotient_word(epdaH_conf_history cL)(option_to_list (Some a))),epdaH_conf_stack=epdaH_conf_stack cL\<rparr>"
      in allE)
   apply(erule_tac
      x="\<lparr>edge_src = qs1, edge_event = (Some a), edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr>"
      in allE)
   apply(erule_tac
      x="\<lparr>edge_src = qs1, edge_event = None, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr>"
      in allE)
   apply(erule impE)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(rule_tac
      x="[a]"
      in exI)
   apply(rule conjI)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: epda_effects_def valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
    apply(clarsimp)
    apply(erule_tac
      x="\<lparr>edge_src = qs1, edge_event = Some a, edge_pop = [po1], edge_push = [], edge_trg = qt1\<rparr>"
      in ballE)
     apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: valid_epda_step_label_def)
    apply(force)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(rule_tac
      x="[]"
      in exI)
   apply(rule conjI)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: epda_effects_def valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(rule conjI)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: epdaH_step_relation_def)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(rule conjI)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: epdaH_step_relation_def)
    apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list (Some a)) (option_to_list (Some a))"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
     apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
     apply (metis right_quotient_word_removes_right_addition)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: option_to_list_def)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(rule conjI)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: epdaH_step_relation_def)
    apply(simp add: option_to_list_def)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(rule conjI)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(simp add: epdaH_step_relation_def)
    apply(simp add: option_to_list_def)
    apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ [a]) [a]"
      and s="Some (epdaH_conf_history ca)"
      in ssubst)
     apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
     apply (metis right_quotient_word_removes_right_addition)
    apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
    apply(force)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a)(*strict*)
   apply(clarsimp)
   apply(rename_tac d i c dL cL qs1 qt1 po1 n e ca a x xa)(*strict*)
   apply(simp add: epdaH_step_relation_def)
   apply(clarsimp)
   apply(rename_tac d i c dL cL po1 n e ca a x xa)(*strict*)
   apply(simp add: option_to_list_def)
   apply(simp add: epdaH.history_fragment_prefixes_def)
   apply(simp add: epda_effects_def)
   apply(clarsimp)
   apply(rename_tac d i c dL cL po1 n e ca a x hf'')(*strict*)
   apply(case_tac x)
    apply(rename_tac d i c dL cL po1 n e ca a x hf'')(*strict*)
    apply(force)
   apply(rename_tac d i c dL cL po1 n e ca a x hf'' aa list)(*strict*)
   apply(force)
  apply(rename_tac d i c a dL cL qs1 re1 pu1 qt1 qs2 re2 pu2 qt2 po1 po2 n e ca)(*strict*)
  apply(clarsimp)
  apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(subgoal_tac "\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu2, edge_trg = qt2\<rparr> \<in> epda_delta G")
   apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   prefer 2
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(subgoal_tac "\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu1, edge_trg = qt1\<rparr> \<in> epda_delta G")
   apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   prefer 2
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(thin_tac "\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu2, edge_trg = qt2\<rparr> \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G a")
  apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(thin_tac "cfgLM.derivation_initial (F_SDPDA_TO_CFG_STD G) d")
  apply(thin_tac "d i = Some (pair (Some a) c)")
  apply(thin_tac "a \<in> cfg_productions (F_SDPDA_TO_CFG_STD G)")
  apply(thin_tac "\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu1, edge_trg = qt1\<rparr> \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G a")
  apply(rename_tac d i c a dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(thin_tac "setA (cfg_conf c) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma G \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL c w)")
  apply(simp add: epdaH.is_forward_edge_deterministicHist_DB_long_def)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(erule_tac
      x="ca"
      in allE)
  apply(erule impE)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   apply(rule_tac
      x="dL"
      in exI)
   apply(clarsimp)
   apply(simp add: get_configuration_def)
   apply(rule_tac
      x="n"
      in exI)
   apply(clarsimp)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(erule_tac
      x="cL"
      in allE)
  apply(erule_tac
      x="\<lparr>epdaH_conf_state=qt2,epdaH_conf_history=the(right_quotient_word(epdaH_conf_history cL)(option_to_list re2))@(option_to_list re2),epdaH_conf_stack=pu2@drop(length pu1)(epdaH_conf_stack cL)\<rparr>"
      in allE)
  apply(erule_tac
      x="\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu1, edge_trg = qt1\<rparr>"
      in allE)
  apply(erule_tac
      x="\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu2, edge_trg = qt2\<rparr>"
      in allE)
  apply(erule impE)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(rule_tac
      x="option_to_list re2"
      in exI)
  apply(rule conjI)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   apply(simp add: epda_effects_def valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(clarsimp)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca x)(*strict*)
   apply(erule_tac
      x="\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu2, edge_trg = qt2\<rparr>"
      in ballE)
    apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca x)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca x)(*strict*)
   apply(simp add: valid_epda_step_label_def option_to_set_def option_to_list_def)
   apply(force)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(rule_tac
      x="option_to_list re2"
      in exI)
  apply(rule conjI)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   apply(simp add: epda_effects_def valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(clarsimp)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca x)(*strict*)
   apply(erule_tac
      x="\<lparr>edge_src = qs2, edge_event = re2, edge_pop = [po2], edge_push = pu2, edge_trg = qt2\<rparr>"
      in ballE)
    apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca x)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca x)(*strict*)
   apply(simp add: valid_epda_step_label_def option_to_set_def option_to_list_def)
   apply(force)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(rule context_conjI)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   apply(simp add: epdaH.derivation_initial_def epdaH.derivation_def)
   apply(clarsimp)
   apply(erule_tac
      x="Suc n"
      in allE)
   apply(clarsimp)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(rule context_conjI)
   apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
   apply(simp add: epdaH_step_relation_def)
   apply(clarsimp)
   apply(rename_tac dL cL pu1 re2 pu2 qt2 po2 n e ca w)(*strict*)
   apply(rule_tac
      t="right_quotient_word (epdaH_conf_history ca @ option_to_list re2) (option_to_list re2)"
      and s="Some(epdaH_conf_history ca)"
      in ssubst)
    apply(rename_tac dL cL pu1 re2 pu2 qt2 po2 n e ca w)(*strict*)
    apply (metis right_quotient_word_removes_right_addition)
   apply(rename_tac dL cL pu1 re2 pu2 qt2 po2 n e ca w)(*strict*)
   apply(force)
  apply(rename_tac dL cL pu1 qt1 qs2 re2 pu2 qt2 po2 n e ca)(*strict*)
  apply(simp add: epdaH_step_relation_def)
  done

lemma F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source: "
  valid_simple_dpda G
  \<Longrightarrow> x \<in> epda_delta G
  \<Longrightarrow> p \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x
  \<Longrightarrow> edge_push x = []
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G p = {x}"
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule order_antisym)
   apply(clarsimp)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac xa s1)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa s1)(*strict*)
     apply(force)
    apply(rename_tac xa s1)(*strict*)
    apply(force)
   apply(rename_tac xa s1)(*strict*)
   apply(clarsimp)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_read xa (epda_states G) \<and> (\<exists>y. edge_event xa = Some y)"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop xa \<and> edge_push xa = []"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event xa = Some y) \<and> edge_push xa = [s1a]"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  done

lemma F_SDPDA_TO_CFG_STD__edges_l3_push_single_source: "
  valid_simple_dpda G
  \<Longrightarrow> x \<in> epda_delta G
  \<Longrightarrow> p \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G)
  \<Longrightarrow> edge_push x = [a, b]
  \<Longrightarrow> edge_event x = None
  \<Longrightarrow> edge_pop x = [b]
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G p = {x}"
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule order_antisym)
   apply(clarsimp)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_read xa (epda_states G) \<and> (\<exists>y. edge_event xa = Some y)"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
    apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop xa \<and> edge_push xa = []"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event xa = Some y) \<and> edge_push xa = [s1]"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(clarsimp)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  done

lemma F_SDPDA_TO_CFG_STD__edges_l2_read_single_source: "
  valid_simple_dpda G
  \<Longrightarrow> x \<in> epda_delta G
  \<Longrightarrow> p \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x
  \<Longrightarrow> edge_event x = Some a
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G p = {x}"
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule order_antisym)
   apply(clarsimp)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_read xa (epda_states G) \<and> (\<exists>y. edge_event xa = Some y)"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event xa = Some y) \<and> edge_push xa = [s1a]"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop xa \<and> edge_push xa = []"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(erule_tac
      P="edge_event xa = None \<and> (\<exists>s2. edge_push xa = [s2, s1a])"
      in disjE)
    apply(rename_tac xa s1 s1a)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s1a s2)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1 s1a)(*strict*)
   apply(clarsimp)
  apply(clarsimp)
  done

lemma F_SDPDA_TO_CFG_STD__edges_l2_final_single_source: "
  valid_simple_dpda G
  \<Longrightarrow> p \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G p = {}"
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(rule conjI)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_final_def)
   apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(rule conjI)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(rename_tac x)(*strict*)
  apply(rule conjI)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_final_def)
   apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(rule conjI)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(rename_tac x)(*strict*)
  apply(clarsimp)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(clarsimp)
  done

lemma F_SDPDA_TO_CFG_STD__edges_l2_push_single_source: "
  valid_simple_dpda G
  \<Longrightarrow> x \<in> epda_delta G
  \<Longrightarrow> p \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states G)
  \<Longrightarrow> edge_push x = [a, b]
  \<Longrightarrow> edge_event x = None
  \<Longrightarrow> edge_pop x = [b]
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G p = {x}"
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rule order_antisym)
   apply(clarsimp)
   apply(rename_tac xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac xa)(*strict*)
     apply(force)
    apply(rename_tac xa)(*strict*)
    apply(force)
   apply(rename_tac xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_read xa (epda_states G) \<and> (\<exists>y. edge_event xa = Some y)"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
    apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop xa \<and> edge_push xa = []"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event xa = Some y) \<and> edge_push xa = [s1]"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="p \<in> F_SDPDA_TO_CFG_STD__edges_l3_push xa (epda_states G) \<and> edge_push xa \<noteq> [] \<and> edge_event xa = None"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s2)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
    apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(erule_tac
      P="edge_event xa = None \<and> (\<exists>s2. edge_push xa = [s2, s1])"
      in disjE)
    apply(rename_tac xa s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac xa s1 s2)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
    apply(erule_tac
      P="p = \<lparr>prod_lhs = cons_l2 (edge_src x) b, prod_rhs = [teA (cons_l2   (edge_trg x) a)]\<rparr>"
      in disjE)
     apply(rename_tac xa s1 s2)(*strict*)
     apply(clarsimp)
    apply(rename_tac xa s1 s2)(*strict*)
    apply(clarsimp)
   apply(rename_tac xa s1)(*strict*)
   apply(clarsimp)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  done

lemma F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_equal_then_from_special_sets: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2
  \<Longrightarrow> e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G
  \<Longrightarrow> e2 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G
  \<Longrightarrow> (\<exists>x\<in> epda_delta G.
  (edge_event x \<noteq> None \<and> ((e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G)
  \<or> e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x)
  \<and> (e2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G)
  \<or> e2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x)))
  \<or>
  (edge_event x=None \<and> edge_push x=[] \<and> (e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x
  \<and> (e2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x)))
  \<or>
  (edge_event x=None \<and> edge_push x\<noteq>[] \<and> (e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G)
  \<or> e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states G))
  \<and> (e2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G)
  \<or> e2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states G))))
  \<or>
  ((e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)
  \<and> (e2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G))))"
  apply(clarsimp)
  apply(erule_tac
      P="e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G"
      in disjE)
   apply(subgoal_tac "(\<exists>x\<in> epda_delta G. e1 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G))) \<or> (\<exists>x\<in> epda_delta G. e1 \<in> (case edge_push x of [] \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_pop x | a # y \<Rightarrow> {})) \<or> (\<exists>x\<in> epda_delta G. e1 \<in> (case edge_push x of [] \<Rightarrow> {} | a # y \<Rightarrow> (case edge_event x of None \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G) | Some A \<Rightarrow> {})))")
    prefer 2
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
   apply(erule_tac
      P="\<exists>x\<in> epda_delta G. e1 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G))"
      in disjE)
    apply(clarsimp)
    apply(rename_tac x)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac x)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac x)(*strict*)
      apply(force)
     apply(rename_tac x)(*strict*)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1)(*strict*)
    apply(erule_tac
      P="(\<exists>y. edge_event x = Some y) \<and> edge_push x = [s1]"
      in disjE)
     apply(rename_tac x s1)(*strict*)
     prefer 2
     apply(erule_tac
      P="edge_event x = None \<and> (\<exists>s2. edge_push x = [s2, s1])"
      in disjE)
      apply(rename_tac x s1)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 y)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = {x}")
     apply(rename_tac x s1 y)(*strict*)
     prefer 2
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
        apply(rename_tac x s1 y)(*strict*)
        apply(force)
       apply(rename_tac x s1 y)(*strict*)
       apply(force)
      apply(rename_tac x s1 y)(*strict*)
      apply(force)
     apply(rename_tac x s1 y)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(clarsimp)
    apply(rule_tac
      x="x"
      in bexI)
     apply(rename_tac x s1 y)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(rule disjI1)
    apply(rule conjI)
     apply(rename_tac x s1 y)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(rule conjI)
     apply(rename_tac x s1 y)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(erule disjE)
     apply(rename_tac x s1 y)(*strict*)
     apply(rule disjI1)
     apply(thin_tac "e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G")
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
     apply(erule disjE)
      apply(rename_tac x s1 y)(*strict*)
      apply(clarsimp)
      apply(rename_tac x s1 y xa)(*strict*)
      apply(case_tac "edge_event xa")
       apply(rename_tac x s1 y xa)(*strict*)
       apply(clarsimp)
      apply(rename_tac x s1 y xa a)(*strict*)
      apply(clarsimp)
      apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
       apply(rename_tac x s1 y xa a)(*strict*)
       prefer 2
       apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
          apply(rename_tac x s1 y xa a)(*strict*)
          apply(force)
         apply(rename_tac x s1 y xa a)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y)(*strict*)
     apply(erule disjE)
      apply(rename_tac x s1 y)(*strict*)
      apply(clarsimp)
      apply(rename_tac x s1 y xa)(*strict*)
      apply(case_tac "edge_push xa")
       apply(rename_tac x s1 y xa)(*strict*)
       apply(clarsimp)
       apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
        apply(rename_tac x s1 y xa)(*strict*)
        apply(clarsimp)
       apply(rename_tac x s1 y xa)(*strict*)
       apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
          apply(rename_tac x s1 y xa)(*strict*)
          apply(force)
         apply(rename_tac x s1 y xa)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 y)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 y xa)(*strict*)
     apply(case_tac "edge_push xa")
      apply(rename_tac x s1 y xa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(clarsimp)
     apply(case_tac "edge_event xa")
      apply(rename_tac x s1 y xa a list)(*strict*)
      prefer 2
      apply(rename_tac x s1 y xa a list aa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
      apply(rename_tac x s1 y xa a list)(*strict*)
      prefer 2
      apply(rule valid_simple_dpda_edge_alt)
       apply(rename_tac x s1 y xa a list)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
      apply(rename_tac x s1 y xa a s1a)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
          apply(rename_tac x s1 y xa a s1a)(*strict*)
          apply(force)
         apply(rename_tac x s1 y xa a s1a)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(rule disjI2)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
    apply(erule disjE)
     apply(rename_tac x s1 y)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 y xa)(*strict*)
     apply(case_tac "edge_event xa")
      apply(rename_tac x s1 y xa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 y xa a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
      apply(rename_tac x s1 y xa a)(*strict*)
      prefer 2
      apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
         apply(rename_tac x s1 y xa a)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(erule disjE)
     apply(rename_tac x s1 y)(*strict*)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {}")
      apply(rename_tac x s1 y)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 y)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
      apply(rename_tac x s1 y)(*strict*)
      apply(force)
     apply(rename_tac x s1 y)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 y xa)(*strict*)
    apply(case_tac "edge_push xa")
     apply(rename_tac x s1 y xa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac x s1 y xa a list)(*strict*)
     prefer 2
     apply(rename_tac x s1 y xa a list aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac x s1 y xa a list)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac x s1 y xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
         apply(rename_tac x s1 y xa a s1a)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(force)
   apply(erule_tac
      P="\<exists>x\<in> epda_delta G. e1 \<in> (case edge_push x of [] \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_pop x | a # y \<Rightarrow> {})"
      in disjE)
    apply(clarsimp)
    apply(rename_tac x)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac x)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac x)(*strict*)
      apply(force)
     apply(rename_tac x)(*strict*)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1)(*strict*)
    apply(erule_tac
      P="(\<exists>y. edge_event x = Some y) \<and> edge_push x = [s1]"
      in disjE)
     apply(rename_tac x s1)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1)(*strict*)
    apply(erule_tac
      P="edge_event x = None \<and> (\<exists>s2. edge_push x = [s2, s1])"
      in disjE)
     apply(rename_tac x s1)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = {x}")
     apply(rename_tac x s1)(*strict*)
     prefer 2
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
        apply(rename_tac x s1)(*strict*)
        apply(force)
       apply(rename_tac x s1)(*strict*)
       apply(force)
      apply(rename_tac x s1)(*strict*)
      apply(force)
     apply(rename_tac x s1)(*strict*)
     apply(force)
    apply(rename_tac x s1)(*strict*)
    apply(clarsimp)
    apply(rule_tac
      x="x"
      in bexI)
     apply(rename_tac x s1)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac x s1)(*strict*)
    apply(rule disjI2)
    apply(rule disjI1)
    apply(rule conjI)
     apply(rename_tac x s1)(*strict*)
     apply(force)
    apply(rename_tac x s1)(*strict*)
    apply(erule disjE)
     apply(rename_tac x s1)(*strict*)
     apply(thin_tac "e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G")
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
     apply(erule disjE)
      apply(rename_tac x s1)(*strict*)
      apply(clarsimp)
      apply(rename_tac x s1 xa)(*strict*)
      apply(case_tac "edge_event xa")
       apply(rename_tac x s1 xa)(*strict*)
       apply(clarsimp)
      apply(rename_tac x s1 xa a)(*strict*)
      apply(clarsimp)
      apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
       apply(rename_tac x s1 xa a)(*strict*)
       prefer 2
       apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
          apply(rename_tac x s1 xa a)(*strict*)
          apply(force)
         apply(rename_tac x s1 xa a)(*strict*)
         apply(force)
        apply(rename_tac x s1 xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1)(*strict*)
     apply(erule disjE)
      apply(rename_tac x s1)(*strict*)
      apply(clarsimp)
      apply(rename_tac x s1 xa)(*strict*)
      apply(case_tac "edge_push xa")
       apply(rename_tac x s1 xa)(*strict*)
       apply(clarsimp)
       apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
        apply(rename_tac x s1 xa)(*strict*)
        apply(clarsimp)
       apply(rename_tac x s1 xa)(*strict*)
       apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
          apply(rename_tac x s1 xa)(*strict*)
          apply(force)
         apply(rename_tac x s1 xa)(*strict*)
         apply(force)
        apply(rename_tac x s1 xa)(*strict*)
        apply(force)
       apply(rename_tac x s1 xa)(*strict*)
       apply(force)
      apply(rename_tac x s1 xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 xa)(*strict*)
     apply(case_tac "edge_push xa")
      apply(rename_tac x s1 xa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 xa a list)(*strict*)
     apply(clarsimp)
     apply(case_tac "edge_event xa")
      apply(rename_tac x s1 xa a list)(*strict*)
      prefer 2
      apply(rename_tac x s1 xa a list aa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 xa a list)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
      apply(rename_tac x s1 xa a list)(*strict*)
      prefer 2
      apply(rule valid_simple_dpda_edge_alt)
       apply(rename_tac x s1 xa a list)(*strict*)
       apply(force)
      apply(rename_tac x s1 xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 xa a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 xa a s1a)(*strict*)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
      apply(rename_tac x s1 xa a s1a)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 xa a s1a)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
          apply(rename_tac x s1 xa a s1a)(*strict*)
          apply(force)
         apply(rename_tac x s1 xa a s1a)(*strict*)
         apply(force)
        apply(rename_tac x s1 xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
    apply(erule disjE)
     apply(rename_tac x s1)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 xa)(*strict*)
     apply(case_tac "edge_event xa")
      apply(rename_tac x s1 xa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 xa a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
      apply(rename_tac x s1 xa a)(*strict*)
      prefer 2
      apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
         apply(rename_tac x s1 xa a)(*strict*)
         apply(force)
        apply(rename_tac x s1 xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1)(*strict*)
    apply(erule disjE)
     apply(rename_tac x s1)(*strict*)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {}")
      apply(rename_tac x s1)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
      apply(rename_tac x s1)(*strict*)
      apply(force)
     apply(rename_tac x s1)(*strict*)
     apply(force)
    apply(rename_tac x s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 xa)(*strict*)
    apply(case_tac "edge_push xa")
     apply(rename_tac x s1 xa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 xa a list)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac x s1 xa a list)(*strict*)
     prefer 2
     apply(rename_tac x s1 xa a list aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 xa a list)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac x s1 xa a list)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac x s1 xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 xa a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 xa a s1a)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
     apply(rename_tac x s1 xa a s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 xa a s1a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
         apply(rename_tac x s1 xa a s1a)(*strict*)
         apply(force)
        apply(rename_tac x s1 xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 xa a s1a)(*strict*)
    apply(force)
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac x)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac x)(*strict*)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(force)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event x = Some y) \<and> edge_push x = [s1]"
      in disjE)
    apply(rename_tac x s1)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1)(*strict*)
   apply(erule_tac
      P="edge_event x = None \<and> (\<exists>s2. edge_push x = [s2, s1])"
      in disjE)
    apply(rename_tac x s1)(*strict*)
    prefer 2
    apply(clarsimp)
   apply(rename_tac x s1)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 s2)(*strict*)
   apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = {x}")
    apply(rename_tac x s1 s2)(*strict*)
    prefer 2
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
         apply(rename_tac x s1 s2)(*strict*)
         apply(force)
        apply(rename_tac x s1 s2)(*strict*)
        apply(force)
       apply(rename_tac x s1 s2)(*strict*)
       apply(force)
      apply(rename_tac x s1 s2)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      x="x"
      in bexI)
    apply(rename_tac x s1 s2)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(rule disjI2)
   apply(rule disjI2)
   apply(rule conjI)
    apply(rename_tac x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(rule conjI)
    apply(rename_tac x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(rule conjI)
    apply(rename_tac x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(erule disjE)
    apply(rename_tac x s1 s2)(*strict*)
    apply(rule disjI1)
    apply(thin_tac "e1 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G")
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
    apply(erule disjE)
     apply(rename_tac x s1 s2)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 s2 xa)(*strict*)
     apply(case_tac "edge_event xa")
      apply(rename_tac x s1 s2 xa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 s2 xa a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
      apply(rename_tac x s1 s2 xa a)(*strict*)
      prefer 2
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
         apply(rename_tac x s1 s2 xa a)(*strict*)
         apply(force)
        apply(rename_tac x s1 s2 xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 s2 xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 s2 xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2)(*strict*)
    apply(erule disjE)
     apply(rename_tac x s1 s2)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 s2 xa)(*strict*)
     apply(case_tac "edge_push xa")
      apply(rename_tac x s1 s2 xa)(*strict*)
      apply(clarsimp)
      apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
       apply(rename_tac x s1 s2 xa)(*strict*)
       apply(clarsimp)
      apply(rename_tac x s1 s2 xa)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
         apply(rename_tac x s1 s2 xa)(*strict*)
         apply(force)
        apply(rename_tac x s1 s2 xa)(*strict*)
        apply(force)
       apply(rename_tac x s1 s2 xa)(*strict*)
       apply(force)
      apply(rename_tac x s1 s2 xa)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 s2 xa)(*strict*)
    apply(case_tac "edge_push xa")
     apply(rename_tac x s1 s2 xa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 s2 xa a list)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac x s1 s2 xa a list)(*strict*)
     prefer 2
     apply(rename_tac x s1 s2 xa a list aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 s2 xa a list)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac x s1 s2 xa a list)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac x s1 s2 xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
     apply(rename_tac x s1 s2 xa a s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
         apply(rename_tac x s1 s2 xa a s1a)(*strict*)
         apply(force)
        apply(rename_tac x s1 s2 xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 s2 xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 s2 xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
   apply(erule disjE)
    apply(rename_tac x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 s2 xa)(*strict*)
    apply(case_tac "edge_event xa")
     apply(rename_tac x s1 s2 xa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 s2 xa a)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
     apply(rename_tac x s1 s2 xa a)(*strict*)
     prefer 2
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac x s1 s2 xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 s2 xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 s2 xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(erule disjE)
    apply(rename_tac x s1 s2)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {}")
     apply(rename_tac x s1 s2)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 s2)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
     apply(rename_tac x s1 s2)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 s2 xa)(*strict*)
   apply(case_tac "edge_push xa")
    apply(rename_tac x s1 s2 xa)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 s2 xa a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac x s1 s2 xa a list)(*strict*)
    prefer 2
    apply(rename_tac x s1 s2 xa a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 s2 xa a list)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac x s1 s2 xa a list)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac x s1 s2 xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a list)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 s2 xa a s1a)(*strict*)
   apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 s2 xa a s1a)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
        apply(rename_tac x s1 s2 xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 s2 xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 s2 xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa a s1a)(*strict*)
   apply(force)
  apply(subgoal_tac "(\<exists>x\<in> epda_delta G. e1 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_read x)) \<or> e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G) \<or> (\<exists>x\<in> epda_delta G. e1 \<in> (case edge_push x of [] \<Rightarrow> {} | a # y \<Rightarrow> (case edge_event x of None \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states G) | Some A \<Rightarrow> {})))")
   prefer 2
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
  apply(thin_tac "e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2 G")
  apply(erule_tac
      P="\<exists>x\<in> epda_delta G. e1 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_read x)"
      in disjE)
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac x)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac x)(*strict*)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(force)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1)(*strict*)
   apply(erule_tac
      P="(\<exists>y. edge_event x = Some y) \<and> edge_push x = [s1]"
      in disjE)
    apply(rename_tac x s1)(*strict*)
    prefer 2
    apply(erule_tac
      P="edge_event x = None \<and> (\<exists>s2. edge_push x = [s2, s1])"
      in disjE)
     apply(rename_tac x s1)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 y)(*strict*)
   apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = {x}")
    apply(rename_tac x s1 y)(*strict*)
    prefer 2
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
       apply(rename_tac x s1 y)(*strict*)
       apply(force)
      apply(rename_tac x s1 y)(*strict*)
      apply(force)
     apply(rename_tac x s1 y)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      x="x"
      in bexI)
    apply(rename_tac x s1 y)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(rule disjI1)
   apply(rule conjI)
    apply(rename_tac x s1 y)(*strict*)
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(rule conjI)
    apply(rename_tac x s1 y)(*strict*)
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(erule disjE)
    apply(rename_tac x s1 y)(*strict*)
    apply(rule disjI1)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
    apply(erule disjE)
     apply(rename_tac x s1 y)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 y xa)(*strict*)
     apply(case_tac "edge_event xa")
      apply(rename_tac x s1 y xa)(*strict*)
      apply(clarsimp)
     apply(rename_tac x s1 y xa a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
      apply(rename_tac x s1 y xa a)(*strict*)
      prefer 2
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
         apply(rename_tac x s1 y xa a)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(erule disjE)
     apply(rename_tac x s1 y)(*strict*)
     apply(clarsimp)
     apply(rename_tac x s1 y xa)(*strict*)
     apply(case_tac "edge_push xa")
      apply(rename_tac x s1 y xa)(*strict*)
      apply(clarsimp)
      apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
       apply(rename_tac x s1 y xa)(*strict*)
       apply(clarsimp)
      apply(rename_tac x s1 y xa)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
         apply(rename_tac x s1 y xa)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 y xa)(*strict*)
    apply(case_tac "edge_push xa")
     apply(rename_tac x s1 y xa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac x s1 y xa a list)(*strict*)
     prefer 2
     apply(rename_tac x s1 y xa a list aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac x s1 y xa a list)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac x s1 y xa a list)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
         apply(rename_tac x s1 y xa a s1a)(*strict*)
         apply(force)
        apply(rename_tac x s1 y xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(rule disjI2)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
   apply(erule disjE)
    apply(rename_tac x s1 y)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 y xa)(*strict*)
    apply(case_tac "edge_event xa")
     apply(rename_tac x s1 y xa)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y xa a)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
     apply(rename_tac x s1 y xa a)(*strict*)
     prefer 2
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac x s1 y xa a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a)(*strict*)
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(erule disjE)
    apply(rename_tac x s1 y)(*strict*)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {}")
     apply(rename_tac x s1 y)(*strict*)
     apply(clarsimp)
    apply(rename_tac x s1 y)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
     apply(rename_tac x s1 y)(*strict*)
     apply(force)
    apply(rename_tac x s1 y)(*strict*)
    apply(force)
   apply(rename_tac x s1 y)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 y xa)(*strict*)
   apply(case_tac "edge_push xa")
    apply(rename_tac x s1 y xa)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 y xa a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac x s1 y xa a list)(*strict*)
    prefer 2
    apply(rename_tac x s1 y xa a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 y xa a list)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac x s1 y xa a list)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac x s1 y xa a list)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a list)(*strict*)
    apply(force)
   apply(rename_tac x s1 y xa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 y xa a s1a)(*strict*)
   apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 y xa a s1a)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
        apply(rename_tac x s1 y xa a s1a)(*strict*)
        apply(force)
       apply(rename_tac x s1 y xa a s1a)(*strict*)
       apply(force)
      apply(rename_tac x s1 y xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 y xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 y xa a s1a)(*strict*)
    apply(force)
   apply(rename_tac x s1 y xa a s1a)(*strict*)
   apply(force)
  apply(erule_tac
      P="e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)"
      in disjE)
   apply(subgoal_tac "False")
    apply(force)
   apply(erule impE)
    apply(force)
   apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = {}")
    prefer 2
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
     apply(force)
    apply(force)
   apply(erule disjE)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
    apply(erule disjE)
     apply(clarsimp)
     apply(rename_tac x)(*strict*)
     apply(case_tac "edge_event x")
      apply(rename_tac x)(*strict*)
      apply(clarsimp)
     apply(rename_tac x a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {x}")
      apply(rename_tac x a)(*strict*)
      prefer 2
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
       apply(rename_tac x a)(*strict*)
       apply(force)
      apply(rename_tac x a)(*strict*)
      apply(force)
     apply(rename_tac x a)(*strict*)
     apply(force)
    apply(rename_tac x a)(*strict*)
    apply(force)
   apply(rename_tac x a)(*strict*)
   apply(force)
  apply(erule disjE)
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {x}")
     apply(rename_tac x)(*strict*)
     apply(clarsimp)
    apply(rename_tac x)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
       apply(rename_tac x)(*strict*)
       apply(force)
      apply(rename_tac x)(*strict*)
      apply(force)
     apply(rename_tac x)(*strict*)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(force)
   apply(rename_tac x a list)(*strict*)
   apply(force)
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(case_tac "edge_push x")
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
  apply(rename_tac x a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event x")
   apply(rename_tac x a list)(*strict*)
   prefer 2
   apply(rename_tac x a list aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac x a list)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac x a list)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac x a list)(*strict*)
    apply(force)
   apply(rename_tac x a list)(*strict*)
   apply(force)
  apply(rename_tac x a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac x a s1)(*strict*)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {x}")
   apply(rename_tac x a s1)(*strict*)
   apply(clarsimp)
  apply(rename_tac x a s1)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
       apply(rename_tac x a s1)(*strict*)
       apply(force)
      apply(rename_tac x a s1)(*strict*)
      apply(force)
     apply(rename_tac x a s1)(*strict*)
     apply(force)
    apply(rename_tac x a s1)(*strict*)
    apply(force)
   apply(rename_tac x a s1)(*strict*)
   apply(force)
  apply(rename_tac x a s1)(*strict*)
  apply(force)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
  apply(erule disjE)
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(case_tac "edge_event x")
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
  apply(rename_tac x a)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {x}")
   apply(rename_tac x a)(*strict*)
   prefer 2
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
      apply(rename_tac x a)(*strict*)
      apply(force)
     apply(rename_tac x a)(*strict*)
     apply(force)
    apply(rename_tac x a)(*strict*)
    apply(force)
   apply(rename_tac x a)(*strict*)
   apply(force)
  apply(rename_tac x a)(*strict*)
  apply(force)
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(case_tac "edge_push x")
  apply(rename_tac x)(*strict*)
  apply(clarsimp)
  apply(rename_tac x a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event x")
  apply(rename_tac x a list)(*strict*)
  prefer 2
  apply(rename_tac x a list aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x a list)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
  apply(rename_tac x a list)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
   apply(rename_tac x a list)(*strict*)
   apply(force)
  apply(rename_tac x a list)(*strict*)
  apply(force)
  apply(rename_tac x a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac x a s1)(*strict*)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {x}")
  apply(rename_tac x a s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac x a s1)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
      apply(rename_tac x a s1)(*strict*)
      apply(force)
     apply(rename_tac x a s1)(*strict*)
     apply(force)
    apply(rename_tac x a s1)(*strict*)
    apply(force)
   apply(rename_tac x a s1)(*strict*)
   apply(force)
  apply(rename_tac x a s1)(*strict*)
  apply(force)
  apply(rename_tac x a s1)(*strict*)
  apply(force)
  apply(thin_tac "e1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G) \<longrightarrow> e2 \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)")
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
  apply(rename_tac x)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
  apply(rename_tac x)(*strict*)
  apply(force)
  apply(rename_tac x)(*strict*)
  apply(force)
  apply(rename_tac x)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1)(*strict*)
  apply(erule_tac
    P="(\<exists>y. edge_event x = Some y) \<and> edge_push x = [s1]"
    in disjE)
  apply(rename_tac x s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1)(*strict*)
  apply(erule_tac
    P="edge_event x = None \<and> (\<exists>s2. edge_push x = [s2, s1])"
    in disjE)
  apply(rename_tac x s1)(*strict*)
  prefer 2
  apply(clarsimp)
  apply(rename_tac x s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2)(*strict*)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e1 = {x}")
  apply(rename_tac x s1 s2)(*strict*)
  prefer 2
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
      apply(rename_tac x s1 s2)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rule_tac
    x="x"
    in bexI)
  apply(rename_tac x s1 s2)(*strict*)
  prefer 2
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(rule disjI2)
  apply(rule disjI2)
  apply(rule conjI)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(rule conjI)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(rule conjI)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(erule disjE)
  apply(rename_tac x s1 s2)(*strict*)
  apply(rule disjI1)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
  apply(erule disjE)
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(case_tac "edge_event xa")
   apply(rename_tac x s1 s2 xa)(*strict*)
   apply(clarsimp)
  apply(rename_tac x s1 s2 xa a)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
   apply(rename_tac x s1 s2 xa a)(*strict*)
   prefer 2
   apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
      apply(rename_tac x s1 s2 xa a)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa a)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2 xa a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(erule disjE)
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(case_tac "edge_push xa")
   apply(rename_tac x s1 s2 xa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
    apply(rename_tac x s1 s2 xa)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 s2 xa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
      apply(rename_tac x s1 s2 xa)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(case_tac "edge_push xa")
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event xa")
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  prefer 2
  apply(rename_tac x s1 s2 xa a list aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
   apply(rename_tac x s1 s2 xa a list)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
      apply(rename_tac x s1 s2 xa a s1a)(*strict*)
      apply(force)
     apply(rename_tac x s1 s2 xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa a s1a)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
  apply(erule disjE)
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(case_tac "edge_event xa")
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
  apply(rename_tac x s1 s2 xa a)(*strict*)
  prefer 2
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
     apply(rename_tac x s1 s2 xa a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa a)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2 xa a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(erule disjE)
  apply(rename_tac x s1 s2)(*strict*)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {}")
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(case_tac "edge_push xa")
  apply(rename_tac x s1 s2 xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event xa")
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  prefer 2
  apply(rename_tac x s1 s2 xa a list aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(subgoal_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e2 = {xa}")
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
     apply(rename_tac x s1 s2 xa a s1a)(*strict*)
     apply(force)
    apply(rename_tac x s1 s2 xa a s1a)(*strict*)
    apply(force)
   apply(rename_tac x s1 s2 xa a s1a)(*strict*)
   apply(force)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(force)
  apply(rename_tac x s1 s2 xa a s1a)(*strict*)
  apply(force)
  done

lemma cfgLM_positions_remain_compatible: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n = Some (pair e1 c1)
  \<Longrightarrow> d2 n = Some (pair e2 c2)
  \<Longrightarrow> cfg_conf c1 = (liftB v1) @ teA B1 # (liftA r1)
  \<Longrightarrow> cfg_conf c2 = (liftB v2) @ teA B2 # (liftA r2)
  \<Longrightarrow> v1@x1=v2@x2
  \<Longrightarrow> (\<forall>k. Suc 0\<le>k\<and>k\<le>n \<longrightarrow>
  F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k)))
  = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k))))
  \<and> v1=v2
  \<and> equal_stacks (B1#r1) (B2#r2)
  \<and> (\<exists>m. equal_front_states (B1#(take m r1)) (B2#(take m r2))
  \<and> (case drop m r1 of [] \<Rightarrow> True | A1#w1 \<Rightarrow>
  (case drop m r2 of [] \<Rightarrow> True | A2#w2 \<Rightarrow>
  \<not> equal_front_state A1 A2
  )
  ))"
  apply(induct n arbitrary: e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)
   apply(rename_tac e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
   apply(simp add: cfgLM.derivation_initial_def cfg_initial_configurations_def)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
   apply(case_tac v2)
    apply(rename_tac B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 r2 v1)(*strict*)
    apply(case_tac r2)
     apply(rename_tac B1 r1 r2 v1)(*strict*)
     apply(clarsimp)
     apply(rename_tac B1 r1 v1)(*strict*)
     apply(case_tac v1)
      apply(rename_tac B1 r1 v1)(*strict*)
      apply(clarsimp)
      apply(rename_tac r1)(*strict*)
      apply(case_tac r1)
       apply(rename_tac r1)(*strict*)
       apply(clarsimp)
       apply(simp add: equal_stacks_def equal_stack_def Let_def)
       apply(simp add: equal_front_states_def equal_front_state_def Let_def)
      apply(rename_tac r1 a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac B1 r1 v1 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac B1 r1 r2 v1 a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 v1 v2 x1 x2 a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac n e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d1 n = Some (pair e1 c1) \<and> d1 (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   apply(rename_tac n e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
    apply(force)
   apply(rename_tac n e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
   apply(force)
  apply(rename_tac n e1 c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d2 n = Some (pair e1 c1) \<and> d2 (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r)(*strict*)
    apply(force)
   apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r)(*strict*)
   apply(force)
  apply(rename_tac n c1 e2 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac n c1 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac n c1 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b la ra)(*strict*)
  apply(case_tac c1)
  apply(rename_tac n c1 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b la ra cfg_confa)(*strict*)
  apply(case_tac c2)
  apply(rename_tac n c1 c2 B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b la ra cfg_confa cfg_confaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b la ra)(*strict*)
  apply(case_tac c1a)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b la ra cfg_confa)(*strict*)
  apply(case_tac c1b)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a c1a l r e1 e2b c1b la ra cfg_confa cfg_confaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
  apply(subgoal_tac "setA (l @ teA (prod_lhs e2a) # r)={} \<or> (\<exists>w1 w2 B. (l @ teA (prod_lhs e2a) # r)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
   prefer 2
   apply(rule LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
  apply(subgoal_tac "setA (la @ teA (prod_lhs e2b) # ra)={} \<or> (\<exists>w1 w2 B. (la @ teA (prod_lhs e2b) # ra)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
  apply(erule_tac
      P="setA (l @ teA (prod_lhs e2a) # r) = {}"
      in disjE)
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
   apply (metis elemInsetA emptyE)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
  apply(erule disjE)
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
   apply (metis elemInsetA emptyE)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
  apply(subgoal_tac "la=liftB w1a")
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
   prefer 2
   apply (metis liftA.simps(2) split_decide1)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
  apply(subgoal_tac "l=liftB w1")
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
   prefer 2
   apply (metis liftA.simps(2) split_decide1)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a l r e1 e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a e1 e2b w1 w1a w2 w2a)(*strict*)
  apply(erule_tac
      x="e1a"
      in meta_allE)
  apply(clarsimp)
  apply(erule_tac
      x="\<lparr>cfg_conf = liftB w1 @ teA (prod_lhs e2a) # liftA w2\<rparr>"
      in meta_allE)
  apply(clarsimp)
  apply(erule_tac
      x="e1"
      in meta_allE)
  apply(clarsimp)
  apply(erule_tac
      x="\<lparr>cfg_conf = liftB w1a @ teA (prod_lhs e2b) # liftA w2a\<rparr>"
      in meta_allE)
  apply(clarsimp)
  apply(erule_tac
      x="prod_lhs e2a"
      in meta_allE)
  apply(erule_tac
      x="w2"
      in meta_allE)
  apply(erule_tac
      x="prod_lhs e2b"
      in meta_allE)
  apply(erule_tac
      x="w2a"
      in meta_allE)
  apply(erule_tac
      x="w1"
      in meta_allE)
  apply(erule_tac
      x="w1a"
      in meta_allE)
  apply(clarsimp)
  apply(subgoal_tac "prefix w1 v1")
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a e1 e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply (rule prefix_of_terminalInitial)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a e1 e2b w1 w1a w2 w2a)(*strict*)
  apply(subgoal_tac "prefix w1a v2")
   apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a e1 e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply (rule prefix_of_terminalInitial)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 v1 v2 x1 x2 e1a e2a e1 e2b w1 w1a w2 w2a)(*strict*)
  apply(simp add: prefix_def)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1 w1a w2 w2a c ca)(*strict*)
  apply(erule_tac
      x="c@x1"
      in meta_allE)
  apply(erule_tac
      x="ca@x2"
      in meta_allE)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
  apply(simp add: liftB_commutes_over_concat)
  apply(thin_tac "setA (liftB w1a) = {}")
  apply(subgoal_tac "state_adjacency_and_no_l2_before_l3 (prod_lhs e2a#w2)")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   prefer 2
   apply(rule_tac
      d="d1"
      and n="n"
      in cfgLM_reachable_have_state_adjacency_and_no_l2_before_l3)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
  apply(subgoal_tac "state_adjacency_and_no_l2_before_l3 (prod_lhs e2b#w2a)")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      and n="n"
      in cfgLM_reachable_have_state_adjacency_and_no_l2_before_l3)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
  apply(subgoal_tac "e2a \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   prefer 2
   apply(rule_tac
      A="cfg_productions G'"
      in set_mp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
  apply(subgoal_tac "e2b \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   prefer 2
   apply(rule_tac
      A="cfg_productions G'"
      in set_mp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1a e2a e1 e2b w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac e1 e3 e2 e4 w1a w2 w2a c ca m)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(rule context_conjI)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m k)(*strict*)
   apply(erule_tac
      x="k"
      in allE)
   apply(clarsimp)
   apply(subgoal_tac "k=Suc n")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m k)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m k)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(simp add: get_label_def)
   apply(erule_tac
      P="e3 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G"
      in disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def)
     apply(erule_tac
      P="\<exists>x\<in> epda_delta G. e3 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G))"
      in disjE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
      apply(erule disjE)
    (*read1/read1*)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(case_tac "edge_event x")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(case_tac "edge_event xa")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
       apply(clarsimp)
       apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
      and s="{x}"
      in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
       apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
      and s="{xa}"
      in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
       apply(clarsimp)
       apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        prefer 2
        apply(rule valid_simple_dpda_edge_alt)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
       apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        prefer 2
        apply(rule valid_simple_dpda_edge_alt)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa s1 s1a)(*strict*)
       apply(subgoal_tac "a=aa")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa s1 s1a)(*strict*)
        prefer 2
        apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a aa s1 s1a qt qta)(*strict*)
        apply(case_tac ca)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a aa s1 s1a qt qta)(*strict*)
         apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a aa s1 s1a qt qta ab list)(*strict*)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa a aa s1 s1a qt qta list)(*strict*)
        apply(case_tac c)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa a aa s1 s1a qt qta list)(*strict*)
         apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa a aa s1 s1a qt qta list ab lista)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa s1 s1a)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
       apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        prefer 2
        apply(simp add: cfgLM_accessible_productions_def)
        apply(rule context_conjI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
         apply(simp add: cfg_sub_def)
         apply(clarsimp)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
        apply(rule_tac
      x="d1"
      in exI)
        apply(rule conjI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
         apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        apply(rule_tac
      x="Suc n"
      in exI)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
       apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        prefer 2
        apply(rule_tac
      A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
      in set_mp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
         apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
         apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
        apply(rule_tac
      x="e3"
      in bexI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
         apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
       apply(rule_tac
      G="G"
      in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
             apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
             apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
           apply(rule_tac
      t="epdaS_accessible_edges G"
      and s="epdaH_accessible_edges G"
      in ssubst)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
            apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
         apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
         apply(clarsimp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa aa s1 s1a qt qta)(*strict*)
         apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
         apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 qt # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a qta # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa aa s1 s1a qt qta)(*strict*)
         apply(clarsimp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa aa s1a qt qta)(*strict*)
         apply(erule_tac
      x="0"
      in allE)
         apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
        apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa aa s1 s1a qt qta)(*strict*)
        apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
        apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 qt # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a qta # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa aa s1 s1a qt qta)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa aa s1 s1a)(*strict*)
       apply(simp add: option_to_list_def prefix_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
      apply(erule disjE)
    (*read1/pop1*)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(case_tac "edge_event x")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(case_tac "edge_push xa")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        prefer 2
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa list)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(clarsimp)
       apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
      and s="{x}"
      in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
      and s="{xa}"
      in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(clarsimp)
       apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        prefer 2
        apply(rule valid_simple_dpda_edge_alt)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        prefer 2
        apply(rule valid_simple_dpda_edge_alt)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        prefer 2
        apply(simp add: cfgLM_accessible_productions_def)
        apply(rule context_conjI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(simp add: cfg_sub_def)
         apply(clarsimp)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
        apply(rule_tac
      x="d1"
      in exI)
        apply(rule conjI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(rule_tac
      x="Suc n"
      in exI)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        prefer 2
        apply(rule_tac
      A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
      in set_mp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
         apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
        apply(rule_tac
      x="e3"
      in bexI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(rule_tac
      G="G"
      in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
             apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
             apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
           apply(rule_tac
      t="epdaS_accessible_edges G"
      and s="epdaH_accessible_edges G"
      in ssubst)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
            apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
         apply(clarsimp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
         apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
         apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 qt # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a (edge_trg xa) # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
         apply(clarsimp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1a qt)(*strict*)
         apply(erule_tac
      x="0"
      in allE)
         apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
        apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
        apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 qt # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a (edge_trg xa) # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(simp add: option_to_list_def prefix_def)
    (*read1/push1*)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       prefer 2
       apply(rule valid_simple_dpda_edge_alt)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       prefer 2
       apply(rule valid_simple_dpda_edge_alt)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(case_tac "edge_event x")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(case_tac "edge_push xa")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
      apply(clarsimp)
      apply(case_tac "edge_event xa")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
       prefer 2
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
      and s="{x}"
      in ssubst)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
      and s="{xa}"
      in ssubst)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
            apply(force)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(clarsimp)
      apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       prefer 2
       apply(simp add: cfgLM_accessible_productions_def)
       apply(rule context_conjI)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: cfg_sub_def)
        apply(clarsimp)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
       apply(rule_tac
      x="d1"
      in exI)
       apply(rule conjI)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule_tac
      x="Suc n"
      in exI)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       prefer 2
       apply(rule_tac
      A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
      in set_mp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
        apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
       apply(rule_tac
      x="e3"
      in bexI)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
      G="G"
      in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
           apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(rule_tac
      t="epdaS_accessible_edges G"
      and s="epdaH_accessible_edges G"
      in ssubst)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
           apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
           apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
        apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
        apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 qt # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a qta # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1a a aa qt qs qta)(*strict*)
        apply(erule_tac
      x="0"
      in allE)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
       apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
       apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 qt # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a qta # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: option_to_list_def prefix_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
     apply(erule_tac
      P="\<exists>x\<in> epda_delta G. e4 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G))"
      in disjE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
      apply(erule disjE)
    (*pop1/read1*)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(case_tac "edge_event x")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(case_tac "edge_push xa")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        prefer 2
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a aa list)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(clarsimp)
       apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
      and s="{x}"
      in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(rule_tac
      t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
      and s="{xa}"
      in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(clarsimp)
       apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        prefer 2
        apply(rule valid_simple_dpda_edge_alt)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        prefer 2
        apply(rule valid_simple_dpda_edge_alt)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        prefer 2
        apply(simp add: cfgLM_accessible_productions_def)
        apply(rule context_conjI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(simp add: cfg_sub_def)
         apply(clarsimp)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
        apply(rule_tac
      x="d2"
      in exI)
        apply(rule conjI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(rule_tac
      x="Suc n"
      in exI)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(rule sym)
       apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        prefer 2
        apply(rule_tac
      A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
      in set_mp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
         apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
        apply(rule_tac
      x="e4"
      in bexI)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(rule_tac
      G="G"
      in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
             apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
             apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
           apply(rule_tac
      t="epdaS_accessible_edges G"
      and s="epdaH_accessible_edges G"
      in ssubst)
            apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
            apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
         apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
         apply(clarsimp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
         apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
         apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src xa) s1a (edge_trg xa) # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src x) s1 qt # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
         apply(clarsimp)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 qt)(*strict*)
         apply(erule_tac
      x="0"
      in allE)
         apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
        apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
        apply(clarsimp)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
        apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
        apply(erule_tac
      x="0"
      and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src xa) s1a (edge_trg xa) # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src x) s1 qt # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
      in allE)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa a s1 s1a qt)(*strict*)
        apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa a s1 s1a)(*strict*)
       apply(simp add: option_to_list_def prefix_def)
  (*push1/read1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(case_tac "edge_push xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{xa}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     prefer 2
     apply(simp add: cfgLM_accessible_productions_def)
     apply(rule context_conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: cfg_sub_def)
      apply(clarsimp)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
     apply(rule_tac
    x="d2"
    in exI)
     apply(rule conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule_tac
    x="Suc n"
    in exI)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     prefer 2
     apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
      apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
     apply(rule_tac
    x="e4"
    in bexI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule sym)
    apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src xa) s1a qta # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src x) s1 qt # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
    in allE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 a aa qt qs qta)(*strict*)
      apply(erule_tac
    x="0"
    in allE)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src xa) s1a qta # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src x) s1 qt # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
    in allE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt qs qta)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: option_to_list_def prefix_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e3 \<in> (case edge_push x of [] \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_pop x | a # y \<Rightarrow> {})"
    in disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(erule disjE)
  (*pop1/pop1*)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      prefer 2
      apply(rule valid_simple_dpda_edge_alt)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      prefer 2
      apply(rule valid_simple_dpda_edge_alt)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(case_tac "edge_push x")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      prefer 2
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(case_tac "edge_push xa")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      prefer 2
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
     apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      prefer 2
      apply(simp add: cfgLM_accessible_productions_def)
      apply(rule context_conjI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(simp add: cfg_sub_def)
       apply(clarsimp)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
      apply(rule_tac
    x="d2"
    in exI)
      apply(rule conjI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(rule_tac
    x="Suc n"
    in exI)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      prefer 2
      apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
       apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
      apply(rule_tac
    x="e4"
    in bexI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(rule sym)
     apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
           apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
         apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
          apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
       apply(erule_tac
    x="0"
    and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 (edge_trg x) # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a (edge_trg xa) # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
    in allE)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1a)(*strict*)
       apply(erule_tac
    x="0"
    in allE)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 (edge_trg x) # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a (edge_trg xa) # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
    in allE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(simp add: option_to_list_def prefix_def)
  (*pop1/push1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_push xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      prefer 2
      apply(simp add: cfgLM_accessible_productions_def)
      apply(rule context_conjI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(simp add: cfg_sub_def)
       apply(clarsimp)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
      apply(rule_tac
    x="d2"
    in exI)
      apply(rule conjI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule_tac
    x="Suc n"
    in exI)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      prefer 2
      apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
       apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
      apply(rule_tac
    x="e4"
    in bexI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule sym)
     apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
           apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a qs qt)(*strict*)
       apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
       apply(erule_tac
    x="0"
    and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 (edge_trg x) # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a qt # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
    in allE)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a qs qt)(*strict*)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1a a qs qt)(*strict*)
       apply(erule_tac
    x="0"
    in allE)
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a qs qt)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    and P="\<lambda>y. y < Suc (length w2) \<and> y < Suc (length w2a) \<longrightarrow> (case (cons_l3   (edge_src x) s1 (edge_trg x) # w2) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A) = (case (cons_l3   (edge_src xa) s1a qt # w2a) ! y of cons_l2 q A \<Rightarrow> A | cons_l3 q1 A q2 \<Rightarrow> A)"
    in allE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a qs qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: option_to_list_def prefix_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*push1/pop1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
     apply(clarsimp)
     apply(case_tac "edge_event x")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
      prefer 2
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
     apply(case_tac "edge_push xa")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
      prefer 2
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(case_tac "edge_event xa")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      prefer 2
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(clarsimp)
     apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
           apply(force)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(clarsimp)
     apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      prefer 2
      apply(simp add: cfgLM_accessible_productions_def)
      apply(rule context_conjI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(simp add: cfg_sub_def)
       apply(clarsimp)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
      apply(rule_tac
    x="d2"
    in exI)
      apply(rule conjI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule_tac
    x="Suc n"
    in exI)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      prefer 2
      apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
       apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
      apply(rule_tac
    x="e4"
    in bexI)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule sym)
     apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
           apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
           apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
       apply(clarsimp)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a qs qt)(*strict*)
       apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
       apply(erule_tac
    x="0"
    in allE)+
       apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a qs qt)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    in allE)+
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: option_to_list_def prefix_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
  (*push1/push1*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista)(*strict*)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista ab)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d2"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e4"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule sym)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qsa qt qta)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qsa qt qta)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def F_SDPDA_TO_CFG_STD__edges_l2_def)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e3 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G))"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*read1/read2*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(case_tac "edge_event xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "a=aa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     prefer 2
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
     apply(case_tac ca)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt ab list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa qt list)(*strict*)
     apply(case_tac c)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa qt list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa qt list ab lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     prefer 2
     apply(simp add: cfgLM_accessible_productions_def)
     apply(rule context_conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(simp add: cfg_sub_def)
      apply(clarsimp)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
     apply(rule_tac
    x="d2"
    in exI)
     apply(rule conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(rule_tac
    x="Suc n"
    in exI)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     prefer 2
     apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
      apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
     apply(rule_tac
    x="e4"
    in bexI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(rule sym)
    apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
         apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a aa qt)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    in allE)+
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a aa qt)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(simp add: option_to_list_def prefix_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*read1/final2*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_final_single_source)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 i qt A)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qt A)(*strict*)
    apply(case_tac ca)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qt A)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qt A aa list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a qt A aa list)(*strict*)
     apply(case_tac w2a)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a qt A aa list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a qt A aa list ab lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qt A)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a qt A)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a qt A)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a qt A aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a qt A aa list)(*strict*)
    apply(subgoal_tac "r2=list")
     apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a qt A aa list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a qt A aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qt A aa list)(*strict*)
    apply(case_tac c)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qt A aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qt A aa list ab lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 m x a qt A aa list lista)(*strict*)
    apply(case_tac lista)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 m x a qt A aa list lista)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 e1 e2 w1a w2 m x a qt A aa list lista ab listb)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 m x a qt A aa list lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n r1 e1 e2 w1a w2 m x a qt A aa list)(*strict*)
    apply(subgoal_tac "r1=w2")
     apply(rename_tac n r1 e1 e2 w1a w2 m x a qt A aa list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n r1 e1 e2 w1a w2 m x a qt A aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 e2 w1a w2 m x a qt A aa list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    and P="\<lambda>w1. \<forall>Aa B. (\<exists>w2a. cons_l3 (edge_src x) A qt # w2 = w1 @ Aa # B # w2a) \<longrightarrow> (case Aa of cons_l2 q X \<Rightarrow> False | cons_l3 q1 AX q2 \<Rightarrow> case B of cons_l2 q3 Y \<Rightarrow> q2 = q3 | cons_l3 q3 BX q4 \<Rightarrow> q2 = q3)"
    in allE)
    apply(rename_tac n e1 e2 w1a w2 m x a qt A aa list)(*strict*)
    apply(erule_tac
    x="[]"
    in allE)
    apply(clarsimp)
  (*read1/push2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d1"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e3"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
     apply(erule disjE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e4 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_read x)"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*read2/pop1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_push xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{xa}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     prefer 2
     apply(simp add: cfgLM_accessible_productions_def)
     apply(rule context_conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: cfg_sub_def)
      apply(clarsimp)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
     apply(rule_tac
    x="d2"
    in exI)
     apply(rule conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule_tac
    x="Suc n"
    in exI)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     prefer 2
     apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
      apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
     apply(rule_tac
    x="e4"
    in bexI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule sym)
    apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    in allE)+
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: option_to_list_def prefix_def)
  (*read2/push1*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{xa}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(force)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     prefer 2
     apply(simp add: cfgLM_accessible_productions_def)
     apply(rule context_conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: cfg_sub_def)
      apply(clarsimp)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
     apply(rule_tac
    x="d2"
    in exI)
     apply(rule conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule_tac
    x="Suc n"
    in exI)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     prefer 2
     apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
      apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
     apply(rule_tac
    x="e4"
    in bexI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule sym)
    apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    in allE)+
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: option_to_list_def prefix_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e3 \<in> (case edge_push x of [] \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_pop x | a # y \<Rightarrow> {})"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*pop1/final2*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 i A)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x A)(*strict*)
    apply(case_tac ca)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x A)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x A a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x A a list)(*strict*)
     apply(case_tac w2a)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x A a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x A a list aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x A)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x A)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x A)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x A a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x A a list)(*strict*)
    apply(subgoal_tac "r2=list")
     apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x A a list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x A a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x A a list)(*strict*)
    apply(case_tac c)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x A a list)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x A a list aa lista)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 m x A a list aa lista)(*strict*)
     apply(case_tac w2)
      apply(rename_tac n B1 r1 e1 e2 w1a w2 m x A a list aa lista)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 m x A a list aa lista ab listb)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x A a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 m x A a list)(*strict*)
    apply(case_tac w2)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 m x A a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 m x A a list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n r1 e1 e2 w1a m x A a list aa lista)(*strict*)
    apply(subgoal_tac "r1=lista")
     apply(rename_tac n r1 e1 e2 w1a m x A a list aa lista)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n r1 e1 e2 w1a m x A a list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 e2 w1a m x A a list aa lista)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
  (*pop1/push2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d2"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e4"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(rule sym)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a)(*strict*)
     apply(erule disjE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*push1/final2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list s1)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list s1)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list s1 aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list s1)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 i qs A qt)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qs A qt)(*strict*)
   apply(case_tac ca)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qs A qt)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qs A qt aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a qs A qt aa list)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a qs A qt aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a qs A qt aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a qs A qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a qs A qt)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a qs A qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a qs A qt aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a qs A qt aa list)(*strict*)
   apply(subgoal_tac "r2=list")
    apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a qs A qt aa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a qs A qt aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qs A qt aa list)(*strict*)
   apply(case_tac c)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qs A qt aa list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qs A qt aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a qs A qt aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n r1 e1 e2 w1a w2 m x a qs A qt aa list)(*strict*)
   apply(case_tac r1)
    apply(rename_tac n r1 e1 e2 w1a w2 m x a qs A qt aa list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n r1 e1 e2 w1a w2 m x a qs A qt aa list ab lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2 m x a qs A qt aa list lista)(*strict*)
   apply(subgoal_tac "lista=w2")
    apply(rename_tac n e1 e2 w1a w2 m x a qs A qt aa list lista)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n e1 e2 w1a w2 m x a qs A qt aa list lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2 m x a qs A qt aa list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  (*push1/push2*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
  apply(case_tac "edge_push x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_push xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(case_tac "edge_event x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(simp add: cfgLM_accessible_productions_def)
   apply(rule context_conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfg_sub_def)
    apply(clarsimp)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
   apply(rule_tac
    x="d2"
    in exI)
   apply(rule conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    x="Suc n"
    in exI)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
    apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
   apply(rule_tac
    x="e4"
    in bexI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule sym)
  apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qs qt)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qs qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qs qt)(*strict*)
   apply(erule disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa qs qt)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def F_SDPDA_TO_CFG_STD__edges_l3_def)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e3 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_read x)"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*read2/read1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_event xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "a=aa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     prefer 2
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
     apply(case_tac ca)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt ab list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa qt list)(*strict*)
     apply(case_tac c)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa qt list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa qt list ab lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     prefer 2
     apply(simp add: cfgLM_accessible_productions_def)
     apply(rule context_conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(simp add: cfg_sub_def)
      apply(clarsimp)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
     apply(rule_tac
    x="d2"
    in exI)
     apply(rule conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(rule_tac
    x="Suc n"
    in exI)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     prefer 2
     apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
      apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
     apply(rule_tac
    x="e4"
    in bexI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(rule sym)
    apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
         apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a aa qt)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    in allE)+
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a aa qt)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(simp add: option_to_list_def prefix_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*read2/pop1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(case_tac "edge_push xa")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     prefer 2
     apply(simp add: cfgLM_accessible_productions_def)
     apply(rule context_conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: cfg_sub_def)
      apply(clarsimp)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
     apply(rule_tac
    x="d1"
    in exI)
     apply(rule conjI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule_tac
    x="Suc n"
    in exI)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     prefer 2
     apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
      apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
     apply(rule_tac
    x="e3"
    in bexI)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
          apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
          apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
      apply(clarsimp)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
      apply(erule_tac
    x="0"
    in allE)+
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: option_to_list_def prefix_def)
  (*read2/push1*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d1"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e3"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e4 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G))"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*final2/read1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 i qt A)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qt)(*strict*)
    apply(case_tac c)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qt)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qt aa list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x a s1 qt aa list)(*strict*)
     apply(case_tac w2)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x a s1 qt aa list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x a s1 qt aa list ab lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x a s1 qt)(*strict*)
    apply(case_tac ca)
     apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x a s1 qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x a s1 qt aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a m x a s1 qt list)(*strict*)
    apply(case_tac w2)
     apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a m x a s1 qt list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a m x a s1 qt list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista)(*strict*)
    apply(subgoal_tac "r1=lista")
     apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista)(*strict*)
    apply(case_tac list)
     apply(rename_tac n B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista)(*strict*)
     prefer 2
     apply(rename_tac n B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista ab listb)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a m x a s1 qt list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n r2 e1 e2 w1a w2a m x a s1 qt aa lista)(*strict*)
    apply(subgoal_tac "r2=w2a")
     apply(rename_tac n r2 e1 e2 w1a w2a m x a s1 qt aa lista)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n r2 e1 e2 w1a w2a m x a s1 qt aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 e2 w1a w2a m x a s1 qt aa lista)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
  (*read1/push2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_read_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d2"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e4"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule sym)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
     apply(erule disjE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qt)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    P="e3 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(erule disjE)
  (*final2/pop1*)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(clarsimp)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 i A)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1)(*strict*)
    apply(case_tac c)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1)(*strict*)
     prefer 2
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x s1 a list)(*strict*)
     apply(case_tac w2)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x s1 a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x s1 a list aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x s1)(*strict*)
    apply(case_tac w2)
     apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x s1)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x s1 a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a ca m x s1 a list)(*strict*)
    apply(subgoal_tac "r1=list")
     apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a ca m x s1 a list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a ca m x s1 a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a list)(*strict*)
    apply(case_tac ca)
     apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a list)(*strict*)
     prefer 2
     apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a list aa lista)(*strict*)
     apply(clarsimp)
     apply(rename_tac n B2 r2 e1 e2 w1a w2a m x s1 a list aa lista)(*strict*)
     apply(case_tac w2a)
      apply(rename_tac n B2 r2 e1 e2 w1a w2a m x s1 a list aa lista)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B2 r2 e1 e2 w1a w2a m x s1 a list aa lista ab listb)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a m x s1 a list)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac n B2 r2 e1 e2 w1a w2a m x s1 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a m x s1 a list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n r2 e1 e2 w1a m x s1 a list aa lista)(*strict*)
    apply(subgoal_tac "r2=lista")
     apply(rename_tac n r2 e1 e2 w1a m x s1 a list aa lista)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac n r2 e1 e2 w1a m x s1 a list aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 e2 w1a m x s1 a list aa lista)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
  (*final2/push1*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 i qs A qt)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qs qt)(*strict*)
   apply(case_tac c)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qs qt)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qs qt aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x a s1 qs qt aa list)(*strict*)
    apply(case_tac w2)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x a s1 qs qt aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a ca m x a s1 qs qt aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 qs qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x a s1 qs qt)(*strict*)
   apply(case_tac w2)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x a s1 qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a ca m x a s1 qs qt aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list)(*strict*)
   apply(subgoal_tac "r1=list")
    apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n r1 B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list)(*strict*)
   apply(case_tac ca)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list)(*strict*)
    prefer 2
    apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x a s1 qs qt aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n r2 e1 e2 w1a w2a m x a s1 qs qt aa list)(*strict*)
   apply(case_tac r2)
    apply(rename_tac n r2 e1 e2 w1a w2a m x a s1 qs qt aa list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n r2 e1 e2 w1a w2a m x a s1 qs qt aa list ab lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2a m x a s1 qs qt aa list lista)(*strict*)
   apply(subgoal_tac "lista=w2a")
    apply(rename_tac n e1 e2 w1a w2a m x a s1 qs qt aa list lista)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n e1 e2 w1a w2a m x a s1 qs qt aa list lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2a m x a s1 qs qt aa list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*push2/pop1*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(case_tac "edge_push xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(force)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d2"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e4"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(rule sym)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a)(*strict*)
     apply(erule disjE)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a)(*strict*)
      apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  (*push2/push1*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
  apply(case_tac "edge_push x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
  apply(case_tac "edge_push xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(case_tac "edge_event xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l3_push_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(simp add: cfgLM_accessible_productions_def)
   apply(rule context_conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfg_sub_def)
    apply(clarsimp)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
   apply(rule_tac
    x="d2"
    in exI)
   apply(rule conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    x="Suc n"
    in exI)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
    apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
   apply(rule_tac
    x="e4"
    in bexI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule sym)
  apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a aa qs qt)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a aa qs qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a aa qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a aa qs qt)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a aa qs qt)(*strict*)
   apply(erule disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a aa qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 a aa qs qt)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e3 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_read x)"
    in disjE)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*read2/read2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(case_tac "edge_event xa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "a=aa")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    prefer 2
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l2_read_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(case_tac ca)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a a aa ab list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa list)(*strict*)
    apply(case_tac c)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x xa s1 s1a a aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
   apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    prefer 2
    apply(simp add: cfgLM_accessible_productions_def)
    apply(rule context_conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: cfg_sub_def)
     apply(clarsimp)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
    apply(rule_tac
    x="d2"
    in exI)
    apply(rule conjI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(rule_tac
    x="Suc n"
    in exI)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
   apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    prefer 2
    apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
     apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
    apply(rule_tac
    x="e4"
    in bexI)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
   apply(rule sym)
   apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
         apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
         apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
        apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
     apply(erule_tac
    x="0"
    in allE)+
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a aa)(*strict*)
   apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*final2/read2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x a s1)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a s1 i A)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a A)(*strict*)
   apply(case_tac ca)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a A)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a A aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a A aa list)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a A aa list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x a A aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x a A)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a A)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a A)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 w1a w2 w2a c m x a A aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a A aa list)(*strict*)
   apply(subgoal_tac "r2=list")
    apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a A aa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n B1 r1 r2 e1 e2 w1a w2 c m x a A aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x a A aa list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  (*read2/push2*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
  apply(case_tac "edge_event x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_push xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "e3 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(simp add: cfgLM_accessible_productions_def)
   apply(rule context_conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfg_sub_def)
    apply(clarsimp)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
   apply(rule_tac
    x="d1"
    in exI)
   apply(rule conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    x="Suc n"
    in exI)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
    apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
   apply(rule_tac
    x="e3"
    in bexI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
   apply(erule disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    P="\<exists>x\<in> epda_delta G. e4 \<in> (case edge_event x of None \<Rightarrow> {} | Some A \<Rightarrow> F_SDPDA_TO_CFG_STD__edges_l2_read x)"
    in disjE)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*read2/final2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 a i A)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 a)(*strict*)
   apply(case_tac ca)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a list)(*strict*)
   apply(case_tac list)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a list aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a)(*strict*)
   apply(subgoal_tac "r2=w2a")
    apply(rename_tac n B1 r1 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n B1 r1 r2 x1 x2 e1 e2 w1a w2 w2a c m x s1 a)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 x1 x2 e1 e2 w1a w2 w2a c m x s1 a)(*strict*)
   apply(case_tac c)
    apply(rename_tac n B1 r1 x1 x2 e1 e2 w1a w2 w2a c m x s1 a)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 x1 x2 e1 e2 w1a w2 w2a c m x s1 a aa list)(*strict*)
    apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 w2a m x s1 a list)(*strict*)
    apply(case_tac w2)
     apply(rename_tac n B1 r1 e1 e2 w1a w2 w2a m x s1 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 w2a m x s1 a list aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 x1 x2 e1 e2 w1a w2 w2a c m x s1 a)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 w2a m x s1 a)(*strict*)
   apply(case_tac w2)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 w2a m x s1 a)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 w2a m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n r1 e1 e2 w1a w2a m x s1 a aa list)(*strict*)
   apply(subgoal_tac "r1=list")
    apply(rename_tac n r1 e1 e2 w1a w2a m x s1 a aa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n r1 e1 e2 w1a w2a m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2a m x s1 a aa list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  (*read2/push2*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
  apply(case_tac "edge_event x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_push xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event xa")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list ab)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{x}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_read_single_source)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{xa}"
    in ssubst)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(force)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(simp add: cfgLM_accessible_productions_def)
   apply(rule context_conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: cfg_sub_def)
    apply(clarsimp)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
   apply(rule_tac
    x="d2"
    in exI)
   apply(rule conjI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule_tac
    x="Suc n"
    in exI)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(subgoal_tac "x \<in> epdaH_accessible_edges G")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   prefer 2
   apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
    apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
   apply(rule_tac
    x="e4"
    in bexI)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule sym)
  apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
        apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
    apply(erule_tac
    x="0"
    in allE)+
    apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
   apply(erule disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x xa s1a a aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    P="e3 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G)"
    in disjE)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*final2/final2*)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 w1a w2 w2a c ca m i ia A Aa)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
  (*final2/push2*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
  apply(case_tac "edge_push x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list)(*strict*)
  apply(case_tac "edge_event x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x s1 a i A)(*strict*)
  apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
  apply(erule_tac
    x="0"
    in allE)+
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x s1 a)(*strict*)
  apply(case_tac c)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x s1 a)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a ca m x s1 a aa list)(*strict*)
   apply(case_tac w2)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a ca m x s1 a aa list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a ca m x s1 a aa list ab lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e2 e4 w1a w2 w2a c ca m x s1 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 e1 e2 e4 w1a w2 w2a ca m x s1 a)(*strict*)
  apply(case_tac w2)
   apply(rename_tac n B1 r1 B2 r2 e1 e2 e4 w1a w2 w2a ca m x s1 a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 e1 e2 e4 w1a w2 w2a ca m x s1 a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n r1 B2 r2 e1 e2 e4 w1a w2a ca m x s1 a aa list)(*strict*)
  apply(subgoal_tac "r1=list")
   apply(rename_tac n r1 B2 r2 e1 e2 e4 w1a w2a ca m x s1 a aa list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac n r1 B2 r2 e1 e2 e4 w1a w2a ca m x s1 a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B2 r2 e1 e2 e4 w1a w2a ca m x s1 a aa list)(*strict*)
  apply(erule disjE)
   apply(rename_tac n B2 r2 e1 e2 e4 w1a w2a ca m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a aa list)(*strict*)
   apply(case_tac ca)
    apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a aa list)(*strict*)
    prefer 2
    apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B2 r2 e1 e2 w1a w2a ca m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n r2 e1 e2 w1a w2a m x s1 a aa list)(*strict*)
   apply(subgoal_tac "r2=w2a")
    apply(rename_tac n r2 e1 e2 w1a w2a m x s1 a aa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n r2 e1 e2 w1a w2a m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2a m x s1 a aa list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  apply(rename_tac n B2 r2 e1 e2 e4 w1a w2a ca m x s1 a aa list)(*strict*)
  apply(simp add: state_adjacency_and_no_l2_before_l3_def)
  apply(erule_tac
    x="[]"
    in allE)+
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule disjE)
  (*push2/final2*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
  apply(case_tac "edge_push x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list)(*strict*)
  apply(case_tac "edge_event x")
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x s1 a)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x s1 a i A)(*strict*)
  apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
  apply(erule_tac
    x="0"
    in allE)+
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x s1 a)(*strict*)
  apply(case_tac ca)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x s1 a)(*strict*)
   prefer 2
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c m x s1 a aa list)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c m x s1 a aa list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c m x s1 a aa list ab lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 w1a w2 w2a c ca m x s1 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 e1 e3 e2 w1a w2 w2a c m x s1 a)(*strict*)
  apply(case_tac w2a)
   apply(rename_tac n B1 r1 B2 r2 e1 e3 e2 w1a w2 w2a c m x s1 a)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 e1 e3 e2 w1a w2 w2a c m x s1 a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 r2 e1 e3 e2 w1a w2 c m x s1 a aa list)(*strict*)
  apply(subgoal_tac "r2=list")
   apply(rename_tac n B1 r1 r2 e1 e3 e2 w1a w2 c m x s1 a aa list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac n B1 r1 r2 e1 e3 e2 w1a w2 c m x s1 a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 e1 e3 e2 w1a w2 c m x s1 a aa list)(*strict*)
  apply(erule disjE)
   apply(rename_tac n B1 r1 e1 e3 e2 w1a w2 c m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x s1 a aa list)(*strict*)
   apply(case_tac c)
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x s1 a aa list)(*strict*)
    prefer 2
    apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x s1 a aa list ab lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 e1 e2 w1a w2 c m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n r1 e1 e2 w1a w2 m x s1 a aa list)(*strict*)
   apply(subgoal_tac "r1=w2")
    apply(rename_tac n r1 e1 e2 w1a w2 m x s1 a aa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac n r1 e1 e2 w1a w2 m x s1 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 w1a w2 m x s1 a aa list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  apply(rename_tac n B1 r1 e1 e3 e2 w1a w2 c m x s1 a aa list)(*strict*)
  apply(simp add: state_adjacency_and_no_l2_before_l3_def)
  apply(erule_tac
    x="[]"
    in allE)+
  apply(clarsimp)
  (*push2/push2*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop xa=[s1] \<and> ((edge_event xa \<noteq> None \<and> edge_push xa=[s1]) \<or> (edge_event xa = None \<and> edge_push xa=[s2,s1]) \<or> (edge_event xa = None \<and> edge_push xa=[])))")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
  apply(case_tac "edge_push x")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event x")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
  prefer 2
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
  apply(case_tac "edge_push xa")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista)(*strict*)
  apply(case_tac "edge_event xa")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista)(*strict*)
  prefer 2
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista ab)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3"
    and s="{x}"
    in ssubst)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    t="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4"
    and s="{xa}"
    in ssubst)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule F_SDPDA_TO_CFG_STD__edges_l2_push_single_source)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "e4 \<in> cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G)")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  prefer 2
  apply(simp add: cfgLM_accessible_productions_def)
  apply(rule context_conjI)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: cfg_sub_def)
   apply(clarsimp)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(simp add: cfgLM.get_accessible_destinations_def cfg_destination_def cfg_get_destinations_def)
  apply(rule_tac
    x="d2"
    in exI)
  apply(rule conjI)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule_tac
    x="Suc n"
    in exI)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(subgoal_tac "xa \<in> epdaH_accessible_edges G")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  prefer 2
  apply(rule_tac
    A="F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD G (cfgLM_accessible_productions (F_SDPDA_TO_CFG_STD G))"
    in set_mp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(rule F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1)
   apply(simp add: F_SDPDA_TO_CFG_STD__SpecInput_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_def)
  apply(rule_tac
    x="e4"
    in bexI)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(rule sym)
  apply(rule_tac
    G="G"
    in epdaS_apply_is_forward_edge_deterministic_accessibleE_with_ReachableEdge)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
       apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(rule_tac
    t="epdaS_accessible_edges G"
    and s="epdaH_accessible_edges G"
    in ssubst)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
      apply(rule epdaH_accessible_edges_vs_epdaS_accessible_edges)
      apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
   apply(erule_tac
    x="0"
    in allE)+
   apply(clarsimp)
   apply(erule_tac
    P="e3 = \<lparr>prod_lhs = cons_l2 (edge_src x) s1, prod_rhs = [teA (cons_l2   (edge_trg x) a)]\<rparr>"
    in disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(erule disjE)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
     apply(clarsimp)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(erule disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
  apply(simp add: equal_front_states_def equal_front_state_def equal_stacks_def equal_stack_def Let_def)
  apply(erule_tac
    x="0"
    in allE)+
  apply(clarsimp)
  apply(erule_tac
    P="e3 = \<lparr>prod_lhs = cons_l2 (edge_src x) s1, prod_rhs = [teA (cons_l2   (edge_trg x) a)]\<rparr>"
    in disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(erule disjE)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(erule disjE)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m x xa s1 s1a a aa)(*strict*)
  apply(clarsimp)
  apply(simp add: option_to_list_def prefix_def)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac "\<forall>k. Suc 0 \<le> k \<and> k \<le> n \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d2 k)))")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(erule_tac
    x="Suc n"
    in allE)
  apply(clarsimp)
  apply(simp add: get_label_def)
  apply(subgoal_tac "(\<exists>x\<in> epda_delta SSG. edge_event x \<noteq> None \<and> (SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states SSG) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<and> (SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states SSG) \<or> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<or> edge_event x = None \<and> edge_push x = [] \<and> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<and> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<or> edge_event x = None \<and> edge_push x \<noteq> [] \<and> (SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states SSG) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states SSG)) \<and> (SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states SSG) \<or> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states SSG))) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG) (epda_gamma SSG) \<and> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG) (epda_gamma SSG)" for SSe1 SSe2 SSG)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  prefer 2
  apply(rule_tac
    ?e1.0="e3"
    and ?e2.0="e4"
    in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_equal_then_from_special_sets)
       apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
       apply(force)
      apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
      apply(force)
     apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
     apply(force)
    apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
    apply(force)
   apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
   apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(force)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac "e3 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<or> e3 \<in> F_SDPDA_TO_CFG_STD__edges_l2 G")
  apply(thin_tac "e4 \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<or> e4 \<in> F_SDPDA_TO_CFG_STD__edges_l2 G")
  apply(thin_tac "cfgLM.derivation_initial G' d1")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac "cfgLM.derivation_initial G' d2")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac "d1 (Suc n) = Some (pair (Some e3) \<lparr>cfg_conf = liftB w1a @ prod_rhs e3 @ liftA w2\<rparr>)")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac " d2 (Suc n) = Some (pair (Some e4) \<lparr>cfg_conf = liftB w1a @ prod_rhs e4 @ liftA w2a\<rparr>)")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac " d1 n = Some (pair e1 \<lparr>cfg_conf = liftB w1a @ teA (prod_lhs e3) # liftA w2\<rparr>)")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac " d2 n = Some (pair e2 \<lparr>cfg_conf = liftB w1a @ teA (prod_lhs e4) # liftA w2a\<rparr>)")
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(thin_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e3 = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G e4")
  apply(thin_tac "e3 \<in> cfg_productions G'")
  apply(thin_tac "e4 \<in> cfg_productions G'")
  apply(erule disjE)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x)(*strict*)
  prefer 2
  apply(rule valid_simple_dpda_edge_alt)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x)(*strict*)
   apply(force)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x)(*strict*)
  apply(force)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(erule_tac
    P="(\<exists>y. edge_event x = Some y) \<and> (e3 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G) \<or> e3 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<and> (e4 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G) \<or> e4 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x)"
    in disjE)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
  apply(erule_tac
    P="e3 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G)"
    in disjE)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
   apply(erule disjE)
  (*read1/read1*)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt qta)(*strict*)
    apply(case_tac c)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt qta)(*strict*)
     apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt qta a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta list)(*strict*)
    apply(case_tac list)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta list)(*strict*)
     prefer 2
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta list a lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta list)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta)(*strict*)
    apply(subgoal_tac "r1=w2")
     apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta)(*strict*)
    apply(clarsimp)
    apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta)(*strict*)
    apply(case_tac ca)
     apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta)(*strict*)
     apply(clarsimp)
    apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt qta a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac B2 r2 w2 w2a m x s1 qt qta a list)(*strict*)
    apply(case_tac list)
     apply(rename_tac B2 r2 w2 w2a m x s1 qt qta a list)(*strict*)
     prefer 2
     apply(rename_tac B2 r2 w2 w2a m x s1 qt qta a list aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac B2 r2 w2 w2a m x s1 qt qta a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac r2 w2 w2a m x s1 qt qta a)(*strict*)
    apply(subgoal_tac "r2=w2a")
     apply(rename_tac r2 w2 w2a m x s1 qt qta a)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac r2 w2 w2a m x s1 qt qta a)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt qta a)(*strict*)
    apply(rule conjI)
     apply(rename_tac w2 w2a m x s1 qt qta a)(*strict*)
     apply(simp add: equal_stacks_def equal_stack_def Let_def)
     apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 qt qta a i)(*strict*)
     apply(erule_tac
    x="i"
    in allE)
     apply(case_tac i)
      apply(rename_tac w2 w2a m x s1 qt qta a i)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 qt qta a i nat)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt qta a)(*strict*)
    apply(rule_tac
    x="m"
    in exI)
    apply(rule conjI)
     apply(rename_tac w2 w2a m x s1 qt qta a)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def Let_def)
     apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 qt qta a i)(*strict*)
     apply(erule_tac
    x="i"
    in allE)
     apply(clarsimp)
     apply(case_tac i)
      apply(rename_tac w2 w2a m x s1 qt qta a i)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 qt qta a i nat)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt qta a)(*strict*)
    apply(case_tac "drop m w2")
     apply(rename_tac w2 w2a m x s1 qt qta a)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt qta a aa list)(*strict*)
    apply(clarsimp)
  (*read1/read2*)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt)(*strict*)
   apply(case_tac c)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list)(*strict*)
   apply(case_tac list)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list a lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
   apply(subgoal_tac "r1=w2")
    apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
   apply(case_tac ca)
    apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 w2 w2a m x s1 qt a list)(*strict*)
   apply(case_tac list)
    apply(rename_tac B2 r2 w2 w2a m x s1 qt a list)(*strict*)
    prefer 2
    apply(rename_tac B2 r2 w2 w2a m x s1 qt a list aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac B2 r2 w2 w2a m x s1 qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac r2 w2 w2a m x s1 qt a)(*strict*)
   apply(subgoal_tac "r2=w2a")
    apply(rename_tac r2 w2 w2a m x s1 qt a)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac r2 w2 w2a m x s1 qt a)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
   apply(rule conjI)
    apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
    apply(simp add: equal_stacks_def equal_stack_def Let_def)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
    apply(erule_tac
    x="i"
    in allE)
    apply(case_tac i)
     apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i nat)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
   apply(rule_tac
    x="m"
    in exI)
   apply(rule conjI)
    apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
    apply(erule_tac
    x="i"
    in allE)
    apply(clarsimp)
    apply(case_tac i)
     apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i nat)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
   apply(case_tac "drop m w2")
    apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a aa list)(*strict*)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
  apply(erule disjE)
  (*read2/read1*)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt)(*strict*)
   apply(case_tac c)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list)(*strict*)
   apply(case_tac list)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list a lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt list)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
   apply(subgoal_tac "r1=w2")
    apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
   apply(case_tac ca)
    apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 w2 w2a m x s1 qt a list)(*strict*)
   apply(case_tac list)
    apply(rename_tac B2 r2 w2 w2a m x s1 qt a list)(*strict*)
    prefer 2
    apply(rename_tac B2 r2 w2 w2a m x s1 qt a list aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac B2 r2 w2 w2a m x s1 qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac r2 w2 w2a m x s1 qt a)(*strict*)
   apply(subgoal_tac "r2=w2a")
    apply(rename_tac r2 w2 w2a m x s1 qt a)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac r2 w2 w2a m x s1 qt a)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
   apply(rule conjI)
    apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
    apply(simp add: equal_stacks_def equal_stack_def Let_def)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
    apply(erule_tac
    x="i"
    in allE)
    apply(case_tac i)
     apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i nat)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
   apply(rule_tac
    x="m"
    in exI)
   apply(rule conjI)
    apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
    apply(erule_tac
    x="i"
    in allE)
    apply(clarsimp)
    apply(case_tac i)
     apply(rename_tac w2 w2a m x s1 qt a i)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 qt a i nat)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
   apply(case_tac "drop m w2")
    apply(rename_tac w2 w2a m x s1 qt a)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 qt a aa list)(*strict*)
   apply(clarsimp)
  (*read2/read2*)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 y)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y)(*strict*)
  apply(case_tac c)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y)(*strict*)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 y a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y list)(*strict*)
  apply(case_tac list)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y list)(*strict*)
   prefer 2
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y list a lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 y list)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y)(*strict*)
  apply(subgoal_tac "r1=w2")
   apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac r1 B2 r2 x1 x2 w2 w2a ca m x s1 y)(*strict*)
  apply(clarsimp)
  apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y)(*strict*)
  apply(case_tac ca)
   apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y)(*strict*)
   apply(clarsimp)
  apply(rename_tac B2 r2 x1 x2 w2 w2a ca m x s1 y a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B2 r2 w2 w2a m x s1 a list)(*strict*)
  apply(case_tac list)
   apply(rename_tac B2 r2 w2 w2a m x s1 a list)(*strict*)
   prefer 2
   apply(rename_tac B2 r2 w2 w2a m x s1 a list aa lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac B2 r2 w2 w2a m x s1 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac r2 w2 w2a m x s1 a)(*strict*)
  apply(subgoal_tac "r2=w2a")
   apply(rename_tac r2 w2 w2a m x s1 a)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac r2 w2 w2a m x s1 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac w2 w2a m x s1 a)(*strict*)
  apply(rule conjI)
   apply(rename_tac w2 w2a m x s1 a)(*strict*)
   apply(simp add: equal_stacks_def equal_stack_def Let_def)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 a i)(*strict*)
   apply(erule_tac
    x="i"
    in allE)
   apply(case_tac i)
    apply(rename_tac w2 w2a m x s1 a i)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 a i nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac w2 w2a m x s1 a)(*strict*)
  apply(rule_tac
    x="m"
    in exI)
  apply(rule conjI)
   apply(rename_tac w2 w2a m x s1 a)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 a i)(*strict*)
   apply(erule_tac
    x="i"
    in allE)
   apply(clarsimp)
   apply(case_tac i)
    apply(rename_tac w2 w2a m x s1 a i)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 a i nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac w2 w2a m x s1 a)(*strict*)
  apply(case_tac "drop m w2")
   apply(rename_tac w2 w2a m x s1 a)(*strict*)
   apply(clarsimp)
  apply(rename_tac w2 w2a m x s1 a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(erule_tac
    P="(\<exists>y. edge_event x = Some y) \<and> edge_push x = [s1]"
    in disjE)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(erule disjE)
  (*pop1/pop1*)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(erule_tac
    P="edge_event x = None \<and> edge_push x = [] \<and> e3 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<and> e4 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x"
    in disjE)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(erule disjE)
  (*pop1/pop1*)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(clarsimp)
  (*pop1/pop1*)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
    apply(force)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
   apply(force)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
  apply(case_tac c)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
   prefer 2
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 a list)(*strict*)
   apply(case_tac w2)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a ca m x s1 a list aa lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 w2 w2a ca m x s1)(*strict*)
  apply(case_tac w2)
   apply(rename_tac B1 r1 B2 r2 w2 w2a ca m x s1)(*strict*)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 w2 w2a ca m x s1 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 B2 r2 w2a ca m x s1 a list)(*strict*)
  apply(case_tac ca)
   apply(rename_tac r1 B2 r2 w2a ca m x s1 a list)(*strict*)
   prefer 2
   apply(rename_tac r1 B2 r2 w2a ca m x s1 a list aa lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 B2 r2 w2a m x s1 a list aa lista)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac r1 B2 r2 w2a m x s1 a list aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 B2 r2 w2a m x s1 a list aa lista ab listb)(*strict*)
   apply(clarsimp)
  apply(rename_tac r1 B2 r2 w2a ca m x s1 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 B2 r2 w2a m x s1 a list)(*strict*)
  apply(case_tac w2a)
   apply(rename_tac r1 B2 r2 w2a m x s1 a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac r1 B2 r2 w2a m x s1 a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 r2 m x s1 a list aa lista)(*strict*)
  apply(subgoal_tac "r2=lista")
   apply(rename_tac r1 r2 m x s1 a list aa lista)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac r1 r2 m x s1 a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 m x s1 a list aa lista)(*strict*)
  apply(subgoal_tac "r1=list")
   apply(rename_tac r1 m x s1 a list aa lista)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac r1 m x s1 a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m x s1 a list aa lista)(*strict*)
  apply(rule conjI)
   apply(rename_tac m x s1 a list aa lista)(*strict*)
   apply(simp add: equal_stacks_def)
   apply(clarsimp)
   apply(rename_tac m x s1 a list aa lista i)(*strict*)
   apply(erule_tac
    x="Suc i"
    in allE)
   apply(case_tac i)
    apply(rename_tac m x s1 a list aa lista i)(*strict*)
    apply(clarsimp)
   apply(rename_tac m x s1 a list aa lista i nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac m x s1 a list aa lista)(*strict*)
  apply(subgoal_tac "equal_front_state a aa")
   apply(rename_tac m x s1 a list aa lista)(*strict*)
   prefer 2
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
   apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(case_tac a)
    apply(rename_tac m x s1 a list aa lista q b)(*strict*)
    apply(clarsimp)
    apply(rename_tac m x s1 list aa lista b)(*strict*)
    apply(case_tac aa)
     apply(rename_tac m x s1 list aa lista b q ba)(*strict*)
     apply(clarsimp)
    apply(rename_tac m x s1 list aa lista b q1 ba q2)(*strict*)
    apply(clarsimp)
   apply(rename_tac m x s1 a list aa lista q1 b q2)(*strict*)
   apply(clarsimp)
   apply(rename_tac m x s1 list aa lista b q2)(*strict*)
   apply(case_tac aa)
    apply(rename_tac m x s1 list aa lista b q2 q ba)(*strict*)
    apply(clarsimp)
   apply(rename_tac m x s1 list aa lista b q2 q1 ba q2a)(*strict*)
   apply(clarsimp)
  apply(rename_tac m x s1 a list aa lista)(*strict*)
  apply(case_tac m)
   apply(rename_tac m x s1 a list aa lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac m x s1 a list aa lista nat)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 a list aa lista nat)(*strict*)
  apply(rule_tac
    x="nat"
    in exI)
  apply(rule conjI)
   apply(rename_tac x s1 a list aa lista nat)(*strict*)
   apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(clarsimp)
   apply(rename_tac x s1 a list aa lista nat i)(*strict*)
   apply(case_tac i)
    apply(rename_tac x s1 a list aa lista nat i)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 a list aa lista nat i nata)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 a list aa lista nat nata)(*strict*)
   apply(erule_tac
    x="Suc (Suc nata)"
    in allE)
   apply(clarsimp)
  apply(rename_tac x s1 a list aa lista nat)(*strict*)
  apply(case_tac "drop nat list")
   apply(rename_tac x s1 a list aa lista nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac x s1 a list aa lista nat ab listb)(*strict*)
  apply(clarsimp)
  (*push*)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(erule disjE)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
  apply(erule_tac
    P="e3 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G)"
    in disjE)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(erule disjE)
  (*push1/push1*)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
    apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
     prefer 2
     apply(rule valid_simple_dpda_edge_alt)
      apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
      apply(force)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
     apply(force)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
    apply(clarsimp)
    apply(case_tac c)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
     prefer 2
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa qt qta)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 B2 r2 w2 w2a ca m x s1 s2 qs qsa qt qta)(*strict*)
    apply(case_tac ca)
     apply(rename_tac r1 B2 r2 w2 w2a ca m x s1 s2 qs qsa qt qta)(*strict*)
     prefer 2
     apply(rename_tac r1 B2 r2 w2 w2a ca m x s1 s2 qs qsa qt qta a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac r1 B2 r2 w2 w2a ca m x s1 s2 qs qsa qt qta)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 r2 w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
    apply(case_tac r2)
     apply(rename_tac r1 r2 w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
     apply(clarsimp)
    apply(rename_tac r1 r2 w2 w2a m x s1 s2 qs qsa qt qta a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qsa qt qta list)(*strict*)
    apply(subgoal_tac "list=w2a")
     apply(rename_tac r1 w2 w2a m x s1 s2 qs qsa qt qta list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qsa qt qta list)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
    apply(case_tac r1)
     apply(rename_tac r1 w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
     apply(clarsimp)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qsa qt qta a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta list)(*strict*)
    apply(subgoal_tac "list=w2")
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta list)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
    apply(rule conjI)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
     apply(simp add: equal_stacks_def equal_stack_def Let_def)
     apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta i)(*strict*)
     apply(erule_tac
    x="i - Suc 0"
    in allE)
     apply(case_tac i)
      apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta i)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta i nat)(*strict*)
     apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta nat)(*strict*)
     apply(case_tac nat)
      apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta nat)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta nat nata)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
    apply(case_tac "qs=qsa")
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
     apply(rule_tac
    x="Suc m"
    in exI)
     apply(rule conjI)
      apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
      apply(simp add: equal_front_states_def equal_front_state_def Let_def)
      apply(clarsimp)
      apply(rename_tac w2 w2a m x s1 s2 qsa qt qta i)(*strict*)
      apply(erule_tac
    x="i-Suc 0"
    in allE)
      apply(case_tac i)
       apply(rename_tac w2 w2a m x s1 s2 qsa qt qta i)(*strict*)
       apply(clarsimp)
      apply(rename_tac w2 w2a m x s1 s2 qsa qt qta i nat)(*strict*)
      apply(clarsimp)
      apply(rename_tac w2 w2a m x s1 s2 qsa qt qta nat)(*strict*)
      apply(case_tac nat)
       apply(rename_tac w2 w2a m x s1 s2 qsa qt qta nat)(*strict*)
       apply(clarsimp)
      apply(rename_tac w2 w2a m x s1 s2 qsa qt qta nat nata)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
     apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qsa qt qta)(*strict*)
     apply(case_tac "drop m w2")
      apply(rename_tac w2 w2a m x s1 s2 qsa qt qta)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 w2a m x s1 s2 qsa qt qta a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
    apply(rule_tac
    x="0"
    in exI)
    apply(rule conjI)
     apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def Let_def)
    apply(rename_tac w2 w2a m x s1 s2 qs qsa qt qta)(*strict*)
    apply(clarsimp)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
  (*push1/push2*)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
     apply(force)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
    apply(force)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
   apply(clarsimp)
   apply(case_tac c)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e4 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 B2 r2 e4 w2 w2a ca m x s1 s2 qs qt)(*strict*)
   apply(case_tac r1)
    apply(rename_tac r1 B2 r2 e4 w2 w2a ca m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 B2 r2 e4 w2 w2a ca m x s1 s2 qs qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 e4 w2 w2a ca m x s1 s2 qs qt list)(*strict*)
   apply(subgoal_tac "list=w2")
    apply(rename_tac B2 r2 e4 w2 w2a ca m x s1 s2 qs qt list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac B2 r2 e4 w2 w2a ca m x s1 s2 qs qt list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 e4 w2 w2a ca m x s1 s2 qs qt)(*strict*)
   apply(erule disjE)
    apply(rename_tac B2 r2 e4 w2 w2a ca m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt)(*strict*)
    apply(case_tac ca)
     apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt)(*strict*)
     prefer 2
     apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac r2 w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(subgoal_tac "r2=w2a")
     apply(rename_tac r2 w2 w2a m x s1 s2 qs qt)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac r2 w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac w2 w2a m x s1 s2 qs qt)(*strict*)
     prefer 2
     apply(rename_tac w2 w2a m x s1 s2 qs qt a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac w2 m x s1 s2 qs qt a list)(*strict*)
     apply(simp add: state_adjacency_and_no_l2_before_l3_def)
     apply(erule_tac
    x="[]"
    in allE)+
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qs qt)(*strict*)
    apply(rule conjI)
     apply(rename_tac w2 m x s1 s2 qs qt)(*strict*)
     apply(simp add: equal_stacks_def equal_stack_def Let_def)
    apply(rename_tac w2 m x s1 s2 qs qt)(*strict*)
    apply(rule_tac
    x="0"
    in exI)
    apply(clarsimp)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(rename_tac B2 r2 e4 w2 w2a ca m x s1 s2 qs qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac ca)
    apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt qsa)(*strict*)
    prefer 2
    apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt qsa a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B2 r2 w2 w2a ca m x s1 s2 qs qt qsa)(*strict*)
   apply(clarsimp)
   apply(rename_tac r2 w2 w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac r2)
    apply(rename_tac r2 w2 w2a m x s1 s2 qs qt qsa)(*strict*)
    apply(clarsimp)
   apply(rename_tac r2 w2 w2a m x s1 s2 qs qt qsa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa list)(*strict*)
   apply(subgoal_tac "list=w2a")
    apply(rename_tac w2 w2a m x s1 s2 qs qt qsa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac w2 w2a m x s1 s2 qs qt qsa)(*strict*)
    prefer 2
    apply(rename_tac w2 w2a m x s1 s2 qs qt qsa a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qs qt qsa a list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
   apply(rule conjI)
    apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
    apply(simp add: equal_stacks_def equal_stack_def Let_def)
    apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qs qt qsa i)(*strict*)
    apply(case_tac i)
     apply(rename_tac w2 m x s1 s2 qs qt qsa i)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qs qt qsa i nat)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac "qs=qsa")
    apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
    apply(rule_tac
    x="Suc m"
    in exI)
    apply(rule conjI)
     apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def Let_def)
     apply(clarsimp)
     apply(rename_tac w2 m x s1 s2 qt qsa i)(*strict*)
     apply(case_tac i)
      apply(rename_tac w2 m x s1 s2 qt qsa i)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2 m x s1 s2 qt qsa i nat)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qt qsa)(*strict*)
    apply(case_tac "drop m w2")
     apply(rename_tac w2 m x s1 s2 qt qsa)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2 m x s1 s2 qt qsa a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
   apply(rule_tac
    x="0"
    in exI)
   apply(rule conjI)
    apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(rename_tac w2 m x s1 s2 qs qt qsa)(*strict*)
   apply(clarsimp)
   apply(simp add: equal_front_states_def equal_front_state_def Let_def)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
  apply(erule disjE)
  (*push1/push2*)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
   apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
    prefer 2
    apply(rule valid_simple_dpda_edge_alt)
     apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
     apply(force)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
    apply(force)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
   apply(clarsimp)
   apply(case_tac ca)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 w2 w2a c ca m x s1 s2 qs qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 r2 e3 w2 w2a c m x s1 s2 qs qt)(*strict*)
   apply(case_tac r2)
    apply(rename_tac B1 r1 r2 e3 w2 w2a c m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 r2 e3 w2 w2a c m x s1 s2 qs qt a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 e3 w2 w2a c m x s1 s2 qs qt list)(*strict*)
   apply(subgoal_tac "list=w2a")
    apply(rename_tac B1 r1 e3 w2 w2a c m x s1 s2 qs qt list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac B1 r1 e3 w2 w2a c m x s1 s2 qs qt list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 e3 w2 w2a c m x s1 s2 qs qt)(*strict*)
   apply(erule disjE)
    apply(rename_tac B1 r1 e3 w2 w2a c m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt)(*strict*)
    apply(case_tac c)
     apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt)(*strict*)
     prefer 2
     apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(subgoal_tac "r1=w2")
     apply(rename_tac r1 w2 w2a m x s1 s2 qs qt)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(case_tac w2)
     apply(rename_tac w2 w2a m x s1 s2 qs qt)(*strict*)
     prefer 2
     apply(rename_tac w2 w2a m x s1 s2 qs qt a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac w2a m x s1 s2 qs qt a list)(*strict*)
     apply(simp add: state_adjacency_and_no_l2_before_l3_def)
     apply(erule_tac
    x="[]"
    in allE)+
     apply(clarsimp)
    apply(rename_tac w2 w2a m x s1 s2 qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2a m x s1 s2 qs qt)(*strict*)
    apply(rule conjI)
     apply(rename_tac w2a m x s1 s2 qs qt)(*strict*)
     apply(simp add: equal_stacks_def equal_stack_def Let_def)
    apply(rename_tac w2a m x s1 s2 qs qt)(*strict*)
    apply(rule_tac
    x="0"
    in exI)
    apply(clarsimp)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(rename_tac B1 r1 e3 w2 w2a c m x s1 s2 qs qt)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac c)
    apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt qsa)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt qsa a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 w2 w2a c m x s1 s2 qs qt qsa)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 w2 w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac r1)
    apply(rename_tac r1 w2 w2a m x s1 s2 qs qt qsa)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 w2 w2a m x s1 s2 qs qt qsa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa list)(*strict*)
   apply(subgoal_tac "list=w2")
    apply(rename_tac w2 w2a m x s1 s2 qs qt qsa list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac w2)
    apply(rename_tac w2 w2a m x s1 s2 qs qt qsa)(*strict*)
    prefer 2
    apply(rename_tac w2 w2a m x s1 s2 qs qt qsa a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac w2a m x s1 s2 qs qt qsa a list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
   apply(rename_tac w2 w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(clarsimp)
   apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(rule conjI)
    apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
    apply(simp add: equal_stacks_def equal_stack_def Let_def)
    apply(clarsimp)
    apply(rename_tac w2a m x s1 s2 qs qt qsa i)(*strict*)
    apply(case_tac i)
     apply(rename_tac w2a m x s1 s2 qs qt qsa i)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2a m x s1 s2 qs qt qsa i nat)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(case_tac "qs=qsa")
    apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
    apply(rule_tac
    x="Suc m"
    in exI)
    apply(rule conjI)
     apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
     apply(simp add: equal_front_states_def equal_front_state_def Let_def)
     apply(clarsimp)
     apply(rename_tac w2a m x s1 s2 qt qsa i)(*strict*)
     apply(case_tac i)
      apply(rename_tac w2a m x s1 s2 qt qsa i)(*strict*)
      apply(clarsimp)
     apply(rename_tac w2a m x s1 s2 qt qsa i nat)(*strict*)
     apply(clarsimp)
    apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
    apply(clarsimp)
   apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(rule_tac
    x="0"
    in exI)
   apply(rule conjI)
    apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
    apply(simp add: equal_front_states_def equal_front_state_def Let_def)
   apply(rename_tac w2a m x s1 s2 qs qt qsa)(*strict*)
   apply(clarsimp)
   apply(simp add: equal_front_states_def equal_front_state_def Let_def)
  (*push2/push2*)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
  apply(subgoal_tac "(\<exists>s1 s2. edge_pop x=[s1] \<and> ((edge_event x \<noteq> None \<and> edge_push x=[s1]) \<or> (edge_event x = None \<and> edge_push x=[s2,s1]) \<or> (edge_event x = None \<and> edge_push x=[])))")
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   prefer 2
   apply(rule valid_simple_dpda_edge_alt)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
    apply(force)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(force)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
  apply(clarsimp)
  apply(erule_tac
    P="e3 = \<lparr>prod_lhs = cons_l2 (edge_src x) s1, prod_rhs = [teA (cons_l2   (edge_trg x) s2)]\<rparr>"
    in disjE)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(erule disjE)
    apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2)(*strict*)
    apply(case_tac w2)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2)(*strict*)
     prefer 2
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 a list)(*strict*)
     apply(simp add: state_adjacency_and_no_l2_before_l3_def)
     apply(erule_tac
    x="[]"
    in allE)+
     apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2)(*strict*)
     prefer 2
     apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac B1 r1 B2 r2 x1 x2 c ca m x s1 s2 a list)(*strict*)
     apply(simp add: state_adjacency_and_no_l2_before_l3_def)
     apply(erule_tac
    x="[]"
    in allE)
     apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2)(*strict*)
    apply(case_tac c)
     apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2)(*strict*)
     prefer 2
     apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 B2 r2 ca x s1 s2)(*strict*)
    apply(case_tac ca)
     apply(rename_tac r1 B2 r2 ca x s1 s2)(*strict*)
     prefer 2
     apply(rename_tac r1 B2 r2 ca x s1 s2 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac r1 B2 r2 ca x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac r1 r2 x s1 s2)(*strict*)
    apply(case_tac r1)
     apply(rename_tac r1 r2 x s1 s2)(*strict*)
     prefer 2
     apply(rename_tac r1 r2 x s1 s2 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac r1 r2 x s1 s2)(*strict*)
    apply(case_tac r2)
     apply(rename_tac r1 r2 x s1 s2)(*strict*)
     prefer 2
     apply(rename_tac r1 r2 x s1 s2 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac r1 r2 x s1 s2)(*strict*)
    apply(clarsimp)
    apply(rename_tac x s1 s2)(*strict*)
    apply(simp add: equal_stacks_def equal_stack_def equal_front_states_def equal_front_state_def Let_def)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(case_tac w2)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs a list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca m x s1 s2 qs a list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs)(*strict*)
   apply(case_tac c)
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 B2 r2 ca x s1 s2 qs)(*strict*)
   apply(case_tac ca)
    apply(rename_tac r1 B2 r2 ca x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac r1 B2 r2 ca x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 B2 r2 ca x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 r2 x s1 s2 qs)(*strict*)
   apply(case_tac r1)
    apply(rename_tac r1 r2 x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac r1 r2 x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 r2 x s1 s2 qs)(*strict*)
   apply(case_tac r2)
    apply(rename_tac r1 r2 x s1 s2 qs)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 r2 x s1 s2 qs a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 s2 qs list)(*strict*)
   apply(case_tac list)
    apply(rename_tac x s1 s2 qs list)(*strict*)
    prefer 2
    apply(rename_tac x s1 s2 qs list a lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 s2 qs list)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 s2 qs)(*strict*)
   apply(simp add: equal_stacks_def equal_stack_def equal_front_states_def equal_front_state_def Let_def)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
  apply(erule disjE)
   apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(case_tac w2)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs a list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)+
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca m x s1 s2 qs a list)(*strict*)
    apply(simp add: state_adjacency_and_no_l2_before_l3_def)
    apply(erule_tac
    x="[]"
    in allE)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs)(*strict*)
   apply(case_tac c)
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 B2 r2 ca x s1 s2 qs)(*strict*)
   apply(case_tac ca)
    apply(rename_tac r1 B2 r2 ca x s1 s2 qs)(*strict*)
    prefer 2
    apply(rename_tac r1 B2 r2 ca x s1 s2 qs a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 B2 r2 ca x s1 s2 qs)(*strict*)
   apply(clarsimp)
   apply(rename_tac r1 r2 x s1 s2 qs)(*strict*)
   apply(case_tac r1)
    apply(rename_tac r1 r2 x s1 s2 qs)(*strict*)
    apply(clarsimp)
   apply(rename_tac r1 r2 x s1 s2 qs a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac r2 x s1 s2 qs list)(*strict*)
   apply(case_tac r2)
    apply(rename_tac r2 x s1 s2 qs list)(*strict*)
    prefer 2
    apply(rename_tac r2 x s1 s2 qs list a lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac r2 x s1 s2 qs list)(*strict*)
   apply(case_tac list)
    apply(rename_tac r2 x s1 s2 qs list)(*strict*)
    prefer 2
    apply(rename_tac r2 x s1 s2 qs list a lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac r2 x s1 s2 qs list)(*strict*)
   apply(clarsimp)
   apply(rename_tac x s1 s2 qs)(*strict*)
   apply(simp add: equal_stacks_def equal_stack_def equal_front_states_def equal_front_state_def Let_def)
   apply(rule_tac
    x="0"
    in exI)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1 s2)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa)(*strict*)
  apply(case_tac w2)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa)(*strict*)
   prefer 2
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs qsa a list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m x s1 s2 qs qsa)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs qsa)(*strict*)
  apply(case_tac w2a)
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs qsa)(*strict*)
   prefer 2
   apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs qsa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca m x s1 s2 qs qsa a list)(*strict*)
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2a c ca m x s1 s2 qs qsa)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs qsa)(*strict*)
  apply(case_tac c)
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs qsa)(*strict*)
   prefer 2
   apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs qsa a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 c ca x s1 s2 qs qsa)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 B2 r2 ca x s1 s2 qs qsa)(*strict*)
  apply(case_tac ca)
   apply(rename_tac r1 B2 r2 ca x s1 s2 qs qsa)(*strict*)
   prefer 2
   apply(rename_tac r1 B2 r2 ca x s1 s2 qs qsa a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac r1 B2 r2 ca x s1 s2 qs qsa)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 r2 x s1 s2 qs qsa)(*strict*)
  apply(case_tac r1)
   apply(rename_tac r1 r2 x s1 s2 qs qsa)(*strict*)
   apply(clarsimp)
  apply(rename_tac r1 r2 x s1 s2 qs qsa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac r2 x s1 s2 qs qsa list)(*strict*)
  apply(case_tac r2)
   apply(rename_tac r2 x s1 s2 qs qsa list)(*strict*)
   apply(clarsimp)
  apply(rename_tac r2 x s1 s2 qs qsa list a lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 qs qsa list lista)(*strict*)
  apply(case_tac list)
   apply(rename_tac x s1 s2 qs qsa list lista)(*strict*)
   prefer 2
   apply(rename_tac x s1 s2 qs qsa list lista a listb)(*strict*)
   apply(clarsimp)
  apply(rename_tac x s1 s2 qs qsa list lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 qs qsa lista)(*strict*)
  apply(case_tac lista)
   apply(rename_tac x s1 s2 qs qsa lista)(*strict*)
   prefer 2
   apply(rename_tac x s1 s2 qs qsa lista a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac x s1 s2 qs qsa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac x s1 s2 qs qsa)(*strict*)
  apply(rule conjI)
   apply(rename_tac x s1 s2 qs qsa)(*strict*)
   apply(simp add: equal_stacks_def equal_stack_def equal_front_states_def equal_front_state_def Let_def)
   apply(clarsimp)
   apply(rename_tac x s1 s2 qs qsa i)(*strict*)
   apply(case_tac i)
    apply(rename_tac x s1 s2 qs qsa i)(*strict*)
    apply(clarsimp)
   apply(rename_tac x s1 s2 qs qsa i nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac x s1 s2 qs qsa)(*strict*)
  apply(rule_tac
    x="if qs=qsa then Suc 0 else 0"
    in exI)
  apply(simp add: equal_stacks_def equal_stack_def equal_front_states_def equal_front_state_def Let_def)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m x s1)(*strict*)
  apply(clarsimp)
  (*final/final*)
  apply(rename_tac n B1 r1 B2 r2 x1 x2 e1 e3 e2 e4 w1a w2 w2a c ca m)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(rename_tac B1 r1 B2 r2 x1 x2 e3 e4 w2 w2a c ca m)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m i ia A Aa)(*strict*)
  apply(case_tac ca)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m i ia A Aa)(*strict*)
  prefer 2
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m i ia A Aa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c m i ia A Aa a list)(*strict*)
  apply(case_tac w2a)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c m i ia A Aa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c m i ia A Aa a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 x1 x2 w2 w2a c ca m i ia A Aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 w2 w2a c m i ia A Aa)(*strict*)
  apply(case_tac w2a)
  apply(rename_tac B1 r1 B2 r2 w2 w2a c m i ia A Aa)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 B2 r2 w2 w2a c m i ia A Aa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 r2 w2 c m i ia A Aa a list)(*strict*)
  apply(subgoal_tac "r2=list")
  apply(rename_tac B1 r1 r2 w2 c m i ia A Aa a list)(*strict*)
  prefer 2
  apply(rule liftA_inj)
  apply(force)
  apply(rename_tac B1 r1 r2 w2 c m i ia A Aa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 w2 c m i ia A Aa a list)(*strict*)
  apply(case_tac c)
  apply(rename_tac B1 r1 w2 c m i ia A Aa a list)(*strict*)
  prefer 2
  apply(rename_tac B1 r1 w2 c m i ia A Aa a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 w2 m i ia A Aa a list aa lista)(*strict*)
  apply(case_tac w2)
  apply(rename_tac B1 r1 w2 m i ia A Aa a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 w2 m i ia A Aa a list aa lista ab listb)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 w2 c m i ia A Aa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 w2 m i ia A Aa a list)(*strict*)
  apply(case_tac w2)
  apply(rename_tac B1 r1 w2 m i ia A Aa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac B1 r1 w2 m i ia A Aa a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac r1 m i ia A Aa a list aa lista)(*strict*)
  apply(subgoal_tac "r1=lista")
  apply(rename_tac r1 m i ia A Aa a list aa lista)(*strict*)
  prefer 2
  apply(rule liftA_inj)
  apply(force)
  apply(rename_tac r1 m i ia A Aa a list aa lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m i ia A Aa a list aa lista)(*strict*)
  apply(simp add: state_adjacency_and_no_l2_before_l3_def)
  apply(erule_tac
    x="[]"
    in allE)+
  apply(clarsimp)
  done

lemma equal_stacks_prefix: "
  X1 \<sqsubseteq> z1
  \<Longrightarrow> X2 \<sqsubseteq> z2
  \<Longrightarrow> equal_stacks (B1 # z1) (B2 # z2)
  \<Longrightarrow> equal_stacks (B1 # X1) (B2 # X2)"
  apply(simp add: equal_stacks_def prefix_def)
  apply(clarsimp)
  apply(rename_tac c ca i)(*strict*)
  apply(erule_tac
      x="i"
      in allE)
  apply(clarsimp)
  apply(simp add:equal_stack_def Let_def)
  apply(subgoal_tac "(B1 # X1) ! i = (B1 # X1 @ c) ! i")
   apply(rename_tac c ca i)(*strict*)
   apply(subgoal_tac "(B2 # X2) ! i = (B2 # X2 @ ca) ! i")
    apply(rename_tac c ca i)(*strict*)
    apply(clarsimp)
   apply(rename_tac c ca i)(*strict*)
   apply(rule_tac
      t="B2 # X2 @ ca"
      and s="(B2 # X2) @ ca"
      in ssubst)
    apply(rename_tac c ca i)(*strict*)
    apply(force)
   apply(rename_tac c ca i)(*strict*)
   apply(rule nth_appendX)
   apply(force)
  apply(rename_tac c ca i)(*strict*)
  apply(rule_tac
      t="B1 # X1 @ c"
      and s="(B1 # X1) @ c"
      in ssubst)
   apply(rename_tac c ca i)(*strict*)
   apply(force)
  apply(rename_tac c ca i)(*strict*)
  apply(rule nth_appendX)
  apply(force)
  done

lemma equal_stacks_append: "
  equal_stacks x1 y1
  \<Longrightarrow> length x1 = length y1
  \<Longrightarrow> equal_stacks x2 y2
  \<Longrightarrow> equal_stacks (x1@x2) (y1@y2)"
  apply(simp add: equal_stacks_def)
  apply(clarsimp)
  apply(rename_tac i)(*strict*)
  apply(case_tac "i<length x1")
   apply(rename_tac i)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="(x1 @ x2) ! i"
      and s="x1!i"
      in ssubst)
    apply(rename_tac i)(*strict*)
    apply(rule_tac nth_append_1)
    apply(force)
   apply(rename_tac i)(*strict*)
   apply(rule_tac
      t="(y1 @ y2) ! i"
      and s="y1!i"
      in ssubst)
    apply(rename_tac i)(*strict*)
    apply(rule_tac nth_append_1)
    apply(force)
   apply(rename_tac i)(*strict*)
   apply(force)
  apply(rename_tac i)(*strict*)
  apply(clarsimp)
  apply(thin_tac "\<forall>i<length y1. equal_stack (x1 ! i) (y1 ! i)")
  apply(erule_tac
      x="i-length y1"
      in allE)
  apply(erule impE)
   apply(rename_tac i)(*strict*)
   apply(force)
  apply(rename_tac i)(*strict*)
  apply(rule_tac
      t="(x1 @ x2) ! i"
      and s="x2!(i-length x1)"
      in ssubst)
   apply(rename_tac i)(*strict*)
   apply(rule_tac nth_append_2)
   apply(force)
  apply(rename_tac i)(*strict*)
  apply(rule_tac
      t="(y1 @ y2) ! i"
      and s="y2!(i-length y1)"
      in ssubst)
   apply(rename_tac i)(*strict*)
   apply(rule_tac nth_append_2)
   apply(force)
  apply(rename_tac i)(*strict*)
  apply(force)
  done

lemma equal_stacks_Cons: "
  equal_stacks (x1#y1) (x2#y2)
  \<Longrightarrow> equal_stacks y1 y2"
  apply(simp add: equal_stacks_def)
  apply(clarsimp)
  apply(rename_tac i)(*strict*)
  apply(force)
  done

definition commonSuffix :: "
  'a list set
  \<Rightarrow> 'a list set"
  where
    "commonSuffix A \<equiv>
  {w. (\<forall>w'\<in> A. suffix w' w) }"

lemma commonSuffix_triv: "
  {r'. suffix r r'}=commonSuffix {r}"
  apply(simp add: commonSuffix_def)
  done

lemma commonSuffix_to_suffix: "
  y \<in> commonSuffix ({x} \<union> A)
  \<Longrightarrow> suffix x y"
  apply(simp add: commonSuffix_def)
  done

lemma commonsuffix_remove_nonresult: "
  suffix w1 w2
  \<Longrightarrow> commonSuffix ({w1, w2} \<union> X) = commonSuffix ({w2} \<union> X)"
  apply(simp add: commonSuffix_def)
  apply(rule order_antisym)
   apply(clarsimp)
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(simp add: suffix_def)
  apply(clarsimp)
  done

lemma commonSuffix_with_empty: "
  commonSuffix ({[]} \<union> A) = {[]}"
  apply(simp add: commonSuffix_def)
  apply(rule order_antisym)
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(simp add: suffix_def)
  apply(clarsimp)
  apply(simp add: suffix_def)
  done

definition maxLength :: "
  'a list set
  \<Rightarrow> 'a list"
  where
    "maxLength A \<equiv>
   (THE w. w \<in> A
  \<and> (\<forall>w'\<in> A. length w' \<le> length w))"

lemma maxLength_in_A: "
  A \<noteq> {}
  \<Longrightarrow> (\<And>x y. x\<in> A \<Longrightarrow> y\<in> A \<Longrightarrow> suffix x y \<or> suffix y x)
  \<Longrightarrow> finite A
  \<Longrightarrow> maxLength A \<in> A"
  apply(simp add: maxLength_def)
  apply(subgoal_tac "\<exists>x\<in> A. \<forall>y\<in> A. suffix x y")
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(rule_tac
      a="x"
      in HOL.theI2)
     apply(rename_tac x)(*strict*)
     apply(clarsimp)
     apply(rename_tac x w')(*strict*)
     apply(erule_tac
      x="w'"
      in ballE)
      apply(rename_tac x w')(*strict*)
      apply(simp add: suffix_def)
      apply(force)
     apply(rename_tac x w')(*strict*)
     apply(force)
    apply(rename_tac x xa)(*strict*)
    apply(erule_tac
      x="xa"
      in ballE)
     apply(rename_tac x xa)(*strict*)
     apply(simp add: suffix_def)
     apply(force)
    apply(rename_tac x xa)(*strict*)
    apply(force)
   apply(rename_tac x xa)(*strict*)
   apply(force)
  apply(subgoal_tac "\<exists>x\<in> A. length x=Max {length x| x. x\<in> A}")
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(rule_tac
      x="x"
      in bexI)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x y)(*strict*)
    apply(erule_tac
      x="x"
      in meta_allE)
    apply(erule_tac
      x="y"
      in meta_allE)
    apply(clarsimp)
    apply(subgoal_tac "length y\<le>length x")
     apply(rename_tac x y)(*strict*)
     apply(simp add: suffix_def)
     apply(clarsimp)
    apply(rename_tac x y)(*strict*)
    apply(thin_tac "suffix y x")
    apply(clarsimp)
    apply(rule Max_ge)
     apply(rename_tac x y)(*strict*)
     apply(force)
    apply(rename_tac x y)(*strict*)
    apply(force)
   apply(rename_tac x)(*strict*)
   apply(force)
  apply(thin_tac "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<sqsupseteq> y \<or> y \<sqsupseteq> x")
  apply(subgoal_tac "\<exists>x\<in> {length x|x. x\<in> A}. x=Max{length x|x. x\<in> A}")
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(force)
  apply(subgoal_tac "{length x|x. x\<in> A}\<noteq>{}")
   prefer 2
   apply(force)
  apply(subgoal_tac "finite {length x|x. x\<in> A}")
   prefer 2
   apply(force)
  apply(thin_tac "A\<noteq>{}")
  apply(thin_tac "finite A")
  apply(rule Max_exists)
   apply(force)
  apply(force)
  done

lemma maximalSuffix_removal_hlp2: "
  \<forall>w'\<in> A. w' \<sqsupseteq> (a # v)
  \<Longrightarrow> maxLength (commonSuffix ({v, a # v} \<union> A)) = v"
  apply(simp add: maxLength_def)
  apply(rule_tac
      a="v"
      in HOL.theI2)
    apply(rule conjI)
     apply(simp add: commonSuffix_def)
     apply(rule conjI)
      apply(simp add: suffix_def)
     apply(rule conjI)
      apply(simp add: suffix_def)
     apply(clarsimp)
     apply(rename_tac w')(*strict*)
     apply(erule_tac
      x="w'"
      in ballE)
      apply(rename_tac w')(*strict*)
      prefer 2
      apply(force)
     apply(rename_tac w')(*strict*)
     apply(simp add: suffix_def)
     apply(clarsimp)
    apply(clarsimp)
    apply(rename_tac w')(*strict*)
    apply(simp add: commonSuffix_def)
    apply(clarsimp)
    apply(simp add: suffix_def)
    apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(simp add: commonSuffix_def)
   apply(clarsimp)
   apply(erule_tac
      x="v"
      in allE)+
   apply(simp add: suffix_def)
   apply(clarsimp)
   apply(rename_tac x c w')(*strict*)
   apply(erule_tac
      x="w'"
      in ballE)+
     apply(rename_tac x c w')(*strict*)
     apply(clarsimp)
    apply(rename_tac x c w')(*strict*)
    apply(clarsimp)
   apply(rename_tac x c w')(*strict*)
   apply(force)
  apply(rename_tac x)(*strict*)
  apply(clarsimp)
  apply(simp add: commonSuffix_def)
  apply(clarsimp)
  apply(erule_tac
      x="v"
      in allE)+
  apply(simp add: suffix_def)
  apply(clarsimp)
  apply(rename_tac x c w')(*strict*)
  apply(erule_tac
      x="w'"
      in ballE)+
    apply(rename_tac x c w')(*strict*)
    apply(clarsimp)
   apply(rename_tac x c w')(*strict*)
   apply(clarsimp)
  apply(rename_tac x c w')(*strict*)
  apply(force)
  done

definition maximalSuffix :: "
  'a list set
  \<Rightarrow> 'a list"
  where
    "maximalSuffix A \<equiv>
  maxLength (commonSuffix A)"

lemma maximalSuffix_triv: "
  r=maximalSuffix {r}"
  apply(simp add: maximalSuffix_def)
  apply(rule_tac
      t="commonSuffix {r}"
      and s="{r'. suffix r r'}"
      in subst)
   apply(rule commonSuffix_triv)
  apply(simp add: maxLength_def)
  apply(rule sym)
  apply(rule_tac
      a="r"
      in HOL.theI2)
    apply(simp add: suffix_def)
    apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(erule_tac
      x="r"
      in allE)
   apply(simp add: suffix_def)
   apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(clarsimp)
  apply(erule_tac
      x="r"
      in allE)
  apply(simp add: suffix_def)
  apply(clarsimp)
  done

lemma maximalSuffix_is_suffix: "
  finite A
  \<Longrightarrow> suffix x (maximalSuffix ({x}\<union>A))"
  apply(simp add: maximalSuffix_def)
  apply(rule_tac
      A="A"
      in commonSuffix_to_suffix)
  apply(subgoal_tac "maxLength (commonSuffix ({x} \<union> A)) \<in> commonSuffix ({x} \<union> A)")
   apply(force)
  apply(rule_tac
      A="commonSuffix ({x} \<union> A)"
      in maxLength_in_A)
    apply(simp add: commonSuffix_def)
    apply(rule_tac
      x="[]"
      in exI)
    apply(simp add: suffix_def)
   apply(rename_tac xa y)(*strict*)
   prefer 2
   apply(rule_tac
      B="suffix_closure {x}"
      in finite_subset)
    apply(simp add: commonSuffix_def suffix_def suffix_closure_def)
    apply(clarsimp)
   apply(rule suffix_closure_finite)
  apply(rename_tac xa y)(*strict*)
  apply(subgoal_tac "suffix x xa")
   apply(rename_tac xa y)(*strict*)
   apply(subgoal_tac "suffix x y")
    apply(rename_tac xa y)(*strict*)
    apply(thin_tac "finite A")
    apply(thin_tac "xa \<in> commonSuffix ({x} \<union> A)")
    apply(thin_tac "y \<in> commonSuffix ({x} \<union> A)")
    apply(simp add: suffix_def)
    apply(clarsimp)
    apply(rename_tac x y c ca)(*strict*)
    apply(subgoal_tac "prefix c ca \<or> prefix ca c")
     apply(rename_tac x y c ca)(*strict*)
     apply(erule disjE)
      apply(rename_tac x y c ca)(*strict*)
      apply(simp add: prefix_def)
      apply(clarsimp)
     apply(rename_tac x y c ca)(*strict*)
     apply(simp add: prefix_def)
     apply(force)
    apply(rename_tac x y c ca)(*strict*)
    apply(rule mutual_prefix_prefix)
    apply(force)
   apply(rename_tac xa y)(*strict*)
   apply(simp add: commonSuffix_def suffix_def suffix_closure_def)
  apply(rename_tac xa y)(*strict*)
  apply(simp add: commonSuffix_def suffix_def suffix_closure_def)
  done

lemma maximalSuffix_is_suffix_prime: "
  finite A
  \<Longrightarrow> x\<in> A
  \<Longrightarrow> suffix x (maximalSuffix A)"
  apply(rule_tac
      t="A"
      and s="{x}\<union>A"
      in ssubst)
   apply(force)
  apply(rule maximalSuffix_is_suffix)
  apply(force)
  done

lemma no_maximalSuffix_is_suffix: "
  finite A
  \<Longrightarrow> v \<in> A
  \<Longrightarrow> \<not> (suffix v w)
  \<Longrightarrow> \<not> maximalSuffix A \<sqsupseteq> w"
  apply(subgoal_tac "suffix v (maximalSuffix A)")
   prefer 2
   apply(rule maximalSuffix_is_suffix_prime)
    apply(force)
   apply(force)
  apply(simp add: suffix_def)
  apply(force)
  done

lemma maximalSuffix_remove_nonresult: "
  suffix w1 w2
  \<Longrightarrow> maximalSuffix ({w1,w2} \<union> X) = maximalSuffix ({w2} \<union> X)"
  apply(simp add: maximalSuffix_def)
  apply(subgoal_tac "commonSuffix ({w1, w2} \<union> X)=commonSuffix ({w2} \<union> X)")
   apply(clarsimp)
  apply(rule commonsuffix_remove_nonresult)
  apply(force)
  done

lemma maximalSuffix_remove_nonresult_prime: "
  finite X
  \<Longrightarrow> the (right_quotient_word (A2 # z2')
                  (maximalSuffix
                    ({A2 # z2', z2'} \<union>
                     X))) =
            A2 #
            the (right_quotient_word z2'
                  (maximalSuffix
                    ({z2'} \<union> X)))"
  apply(clarsimp)
  apply(subgoal_tac "the (right_quotient_word (A2 # z2') (maximalSuffix ({A2 # z2', z2'} \<union> X))) = A2 # the (right_quotient_word z2' (maximalSuffix ({z2'} \<union> X)))")
   apply(force)
  apply(rule_tac
      P="\<lambda>Y. the (right_quotient_word (A2 # z2') Y) = A2 # the (right_quotient_word z2' (maximalSuffix ({z2'} \<union> X)))"
      and s="maximalSuffix ({z2'} \<union> X)"
      in ssubst)
   apply(rule maximalSuffix_remove_nonresult)
   apply(simp add: suffix_def)
  apply(subgoal_tac "suffix z2' (maximalSuffix ({z2'} \<union> X))")
   apply(simp add: suffix_def)
   apply(clarsimp)
   apply(rename_tac c)(*strict*)
   apply(subgoal_tac "the (right_quotient_word (A2 # z2') (maximalSuffix ({z2'} \<union> X))) = A2 # the (right_quotient_word z2' (maximalSuffix ({z2'} \<union> X)))")
    apply(rename_tac c)(*strict*)
    apply(force)
   apply(rename_tac c)(*strict*)
   apply(rule_tac
      P="\<lambda>Y. the (right_quotient_word (A2 # Y) (maximalSuffix ({z2'} \<union> X))) = A2 # the (right_quotient_word Y (maximalSuffix ({z2'} \<union> X)))"
      and t="z2'"
      and s="c @ maximalSuffix ({z2'} \<union> X)"
      in ssubst)
    apply(rename_tac c)(*strict*)
    apply(force)
   apply(rename_tac c)(*strict*)
   apply(simp (no_asm) add: right_quotient_word_def)
  apply(rule maximalSuffix_is_suffix)
  apply(force)
  done

lemma maximalSuffix_removal: "
  v = b # w @ maximalSuffix ({v, a # v} \<union> A)
  \<Longrightarrow> maximalSuffix ({v, a # v} \<union> A) = maximalSuffix ({a # v} \<union> A)"
  apply(clarsimp)
  apply(simp add: maximalSuffix_def)
  apply(subgoal_tac "(commonSuffix ({v, a # v} \<union> A)) = (commonSuffix ({a # v} \<union> A))")
   apply(force)
  apply(simp (no_asm) add: commonSuffix_def)
  apply(rule order_antisym)
   apply(clarsimp)
  apply(clarsimp)
  apply(rename_tac x)(*strict*)
  apply(simp add: suffix_def)
  apply(clarsimp)
  apply(rename_tac x c)(*strict*)
  apply(case_tac c)
   apply(rename_tac x c)(*strict*)
   prefer 2
   apply(rename_tac x c aa list)(*strict*)
   apply(clarsimp)
  apply(rename_tac x c)(*strict*)
  apply(clarsimp)
  apply(fold suffix_def)
  apply(subgoal_tac "maxLength (commonSuffix ({v, a # v} \<union> A)) = v")
   apply(force)
  apply(rule maximalSuffix_removal_hlp2)
  apply(force)
  done

lemma maximalSuffix_with_empty: "
  maximalSuffix ({[]}\<union>A) = []"
  apply(simp add: maximalSuffix_def)
  apply(subgoal_tac "maxLength (commonSuffix ({[]} \<union> A)) = []")
   apply(force)
  apply(rule_tac
      t="commonSuffix ({[]} \<union> A)"
      and s="{[]}"
      in ssubst)
   apply(rule commonSuffix_with_empty)
  apply(simp add: maxLength_def)
  done

definition relnonterms :: "
  (('a, 'b) cfg_step_label, ('a, 'b) cfg_configuration) derivation
  \<Rightarrow> nat
  \<Rightarrow> nat
  \<Rightarrow> 'a list"
  where
    "relnonterms d n m \<equiv>
   ( let ConfD = (List.map (\<lambda>i. the (get_configuration (d i))) (nat_seq n m)) ; getStack = (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ; A = set (List.map getStack ConfD) in (the (right_quotient_word (getStack (hd ConfD)) (maximalSuffix A))))"

lemma relnonterms_triv: "
  valid_cfg G
  \<Longrightarrow> cfgLM.derivation_initial G d
  \<Longrightarrow> d n = Some (pair e1 \<lparr>cfg_conf=(liftB v1) @ teA B1 # (liftA r1)\<rparr>)
  \<Longrightarrow> relnonterms d n n = []"
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "nat_seq n n = [n]")
   apply(clarsimp)
   apply(simp add: get_configuration_def)
   apply(subgoal_tac "(THE r. \<exists>w B. liftB v1 @ teA B1 # liftA r1 = liftB w @ teA B # liftA r) = r1")
    apply(clarsimp)
    apply(rule_tac
      t="maximalSuffix {r1}"
      and s="r1"
      in subst)
     apply(rule maximalSuffix_triv)
    apply (metis right_quotient_word_full option.sel)
   apply(rule SPLIT_tail)
  apply (metis natUptTo_n_n)
  done

lemma relnonterms_prefix: "
  valid_cfg G'
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e1 \<lparr>cfg_conf = liftB y @ teA A1 # liftA r1\<rparr>)
  \<Longrightarrow> d (m+n) =
        Some (pair e2
               \<lparr>cfg_conf = liftB y' @ teA A2 # liftA r2\<rparr>)
       \<Longrightarrow> relnonterms d n (m + n) \<sqsubseteq> r1"
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "(THE r. \<exists>w B. cfg_conf (hd (map (\<lambda>i. the (get_configuration (d i))) (nat_seq n (m + n)))) = liftB w @ teA B # liftA r)=r1")
   prefer 2
   apply(subgoal_tac "nat_seq n (m + n)=n#nat_seq (Suc n) (m + n)")
    apply(clarsimp)
    apply(simp add: get_configuration_def)
    apply(rule HOL.theI2)
      apply(rule_tac
      x="y"
      in exI)
      apply(rule_tac
      x="A1"
      in exI)
      apply(clarsimp)
      apply(force)
     apply(rename_tac x)(*strict*)
     apply(clarsimp)
     apply(rename_tac x w B)(*strict*)
     apply(subgoal_tac "y=w")
      apply(rename_tac x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac x w B)(*strict*)
     apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x w B)(*strict*)
    apply(subgoal_tac "y=w")
     apply(rename_tac x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac x w B)(*strict*)
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
   apply (metis ConsApp nat_seq_drop_first add.commute)
  apply(rule_tac
      t="THE r. \<exists>w B. cfg_conf (hd (map (\<lambda>i. the (get_configuration (d i))) (nat_seq n (m + n)))) = liftB w @ teA B # liftA r"
      and s="r1"
      in ssubst)
   apply(force)
  apply(thin_tac "(THE r. \<exists>w B. cfg_conf (hd (map (\<lambda>i. the (get_configuration (d i))) (nat_seq n (m + n)))) = liftB w @ teA B # liftA r)=r1")
  apply(subgoal_tac "suffix r1 (maximalSuffix ((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d i))) ` set (nat_seq n (m + n))))")
   apply(simp add: suffix_def)
   apply(clarsimp)
   apply(rename_tac c)(*strict*)
   apply(simp add: right_quotient_word_def)
   apply(simp add: prefix_def)
  apply(subgoal_tac "\<exists>A. ((\<lambda>c::('a, 'b) cfg_configuration. THE r::'a list. \<exists>(w::'b list) B::'a. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i::nat. the (get_configuration (d i))) ` set (nat_seq n (m + n)))=A\<union>{r1}")
   apply(clarsimp)
   apply(rename_tac A)(*strict*)
   apply(subgoal_tac "r1 \<sqsupseteq> maximalSuffix ({r1} \<union> A)")
    apply(rename_tac A)(*strict*)
    apply(force)
   apply(rename_tac A)(*strict*)
   apply(rule maximalSuffix_is_suffix)
   apply(rule_tac
      B="(\<lambda>c::('a, 'b) cfg_configuration. THE r::'a list. \<exists>(w::'b list) B::'a. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i::nat. the (get_configuration (d i))) ` set (nat_seq n (m + n))"
      in finite_subset)
    apply(rename_tac A)(*strict*)
    apply(force)
   apply(rename_tac A)(*strict*)
   apply(simp (no_asm))
  apply(rule_tac
      x="(\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d i))) ` set (nat_seq n (m + n))"
      in exI)
  apply(subgoal_tac "r1 \<in> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d i))) ` set (nat_seq n (m + n))")
   apply(force)
  apply(subgoal_tac "nat_seq n (m + n)=n#nat_seq (Suc n) (m + n)")
   apply(clarsimp)
   apply(simp add: get_configuration_def)
   apply(rule HOL.theI2)
     apply(rule_tac
      x="y"
      in exI)
     apply(rule_tac
      x="A1"
      in exI)
     apply(clarsimp)
     apply(force)
    apply(rename_tac r)(*strict*)
    apply(clarsimp)
    apply(rename_tac r w B)(*strict*)
    apply(subgoal_tac "y=w")
     apply(rename_tac r w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac r)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac r w B)(*strict*)
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
   apply(rename_tac r)(*strict*)
   apply(clarsimp)
   apply(rename_tac r w B)(*strict*)
   apply(subgoal_tac "y=w")
    apply(rename_tac r w B)(*strict*)
    apply(clarsimp)
    apply(rename_tac r)(*strict*)
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac r w B)(*strict*)
   apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
  apply (metis ConsApp nat_seq_drop_first add.commute)
  done

lemma relnonterms_invariant_on_read: "
  valid_cfg G'
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e1 \<lparr>cfg_conf = liftB y @ teA B1 # liftA z1'\<rparr>)
  \<Longrightarrow> d (Suc (m + n)) \<noteq> None
  \<Longrightarrow> d (Suc n) =
        Some (pair (Some e)
               \<lparr>cfg_conf = liftB y @ teB a # teA A1 # liftA z1'\<rparr>)
  \<Longrightarrow> relnonterms d n (Suc (m + n)) = relnonterms d (Suc n) (Suc (m + n))"
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "nat_seq n (Suc (m + n)) = n#(nat_seq (Suc n) (Suc (m + n)))")
   apply(clarsimp)
   apply(rename_tac ya)(*strict*)
   apply(rule_tac
      t="THE r. \<exists>w B. cfg_conf (the (get_configuration (Some (pair e1 \<lparr>cfg_conf = liftB y @ teA B1 # liftA z1'\<rparr>)))) = liftB w @ teA B # liftA r"
      and s="z1'"
      in ssubst)
    apply(rename_tac ya)(*strict*)
    apply(rule HOL.theI2)
      apply(rename_tac ya)(*strict*)
      apply(rule_tac
      x="y"
      in exI)
      apply(rule_tac
      x="B1"
      in exI)
      apply(simp add: get_configuration_def)
     apply(rename_tac ya x)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x w B)(*strict*)
     apply(simp add: get_configuration_def)
     apply(subgoal_tac "y=w")
      apply(rename_tac ya x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac ya x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac ya x w B)(*strict*)
     apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
    apply(rename_tac ya x)(*strict*)
    apply(clarsimp)
    apply(rename_tac ya x w B)(*strict*)
    apply(simp add: get_configuration_def)
    apply(subgoal_tac "y=w")
     apply(rename_tac ya x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac ya x w B)(*strict*)
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
   apply(rename_tac ya)(*strict*)
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(rename_tac ya)(*strict*)
  apply(subgoal_tac "nat_seq (Suc n) (Suc (m + n)) = (Suc n)#(nat_seq (Suc (Suc n)) (Suc (m + n)))")
   apply(rename_tac ya)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="THE r. \<exists>w B. cfg_conf (the (get_configuration (Some (pair (Some e) \<lparr>cfg_conf = liftB y @ teB a # teA A1 # liftA z1'\<rparr>)))) = liftB w @ teA B # liftA r"
      and s="z1'"
      in ssubst)
    apply(rename_tac ya)(*strict*)
    apply(rule HOL.theI2)
      apply(rename_tac ya)(*strict*)
      apply(rule_tac
      x="y@[a]"
      in exI)
      apply(rule_tac
      x="A1"
      in exI)
      apply(simp add: get_configuration_def)
      apply(simp add: liftB_commutes_over_concat)
     apply(rename_tac ya x)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x w B)(*strict*)
     apply(simp add: get_configuration_def)
     apply(subgoal_tac "y@[a]=w")
      apply(rename_tac ya x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac ya x B)(*strict*)
      apply(simp add: liftB_commutes_over_concat)
      apply(clarsimp)
      apply(rename_tac ya x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac ya x w B)(*strict*)
     apply (metis ConsApp liftB.simps(1) liftB.simps(2) maxTermPrefix_drop_tail maxTermPrefix_mixed_string maxTermPrefix_shift maxTermPrefix_term_string rotate_simps)
    apply(rename_tac ya x)(*strict*)
    apply(clarsimp)
    apply(rename_tac ya x w B)(*strict*)
    apply(simp add: get_configuration_def)
    apply(subgoal_tac "y@[a]=w")
     apply(rename_tac ya x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x B)(*strict*)
     apply(simp add: liftB_commutes_over_concat)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac ya x w B)(*strict*)
    apply (metis ConsApp liftB.simps(1) liftB.simps(2) maxTermPrefix_drop_tail maxTermPrefix_mixed_string maxTermPrefix_shift maxTermPrefix_term_string rotate_simps)
   apply(rename_tac ya)(*strict*)
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(rename_tac ya)(*strict*)
  apply(clarsimp)
  done

lemma relnonterms_change_on_pop_final: "
  valid_cfg G'
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e2 \<lparr>cfg_conf = liftB y @ teA B2 # teA A2 # liftA z2'\<rparr>)
  \<Longrightarrow> d (Suc (m + n)) \<noteq> None
  \<Longrightarrow> d (Suc n) = Some (pair (Some \<lparr>prod_lhs = B2, prod_rhs = []\<rparr>) \<lparr>cfg_conf = liftB y @ teA A2 # liftA z2'\<rparr>)
  \<Longrightarrow> \<lparr>prod_lhs = B2, prod_rhs = []\<rparr> \<in> cfg_productions G'
  \<Longrightarrow> relnonterms d n (Suc (m + n)) = A2 # relnonterms d (Suc n) (Suc (m + n))"
  apply(simp add: relnonterms_def)
  apply(clarsimp)
  apply(rename_tac ya)(*strict*)
  apply(subgoal_tac "nat_seq n (Suc (m + n)) = n#(nat_seq (Suc n) (Suc (m + n)))")
   apply(rename_tac ya)(*strict*)
   apply(clarsimp)
   apply(simp add: get_configuration_def)
   apply(rule_tac
      t="THE r. \<exists>w B. liftB y @ teA B2 # teA A2 # liftA z2' = liftB w @ teA B # liftA r"
      and s="A2#z2'"
      in ssubst)
    apply(rename_tac ya)(*strict*)
    apply(rule_tac
      a="A2#z2'"
      in HOL.theI2)
      apply(rename_tac ya)(*strict*)
      apply(rule_tac
      x="y"
      in exI)
      apply(rule_tac
      x="B2"
      in exI)
      apply(clarsimp)
     apply(rename_tac ya x)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x w B)(*strict*)
     apply(subgoal_tac "y=w")
      apply(rename_tac ya x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac ya x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac ya x w B)(*strict*)
     apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
    apply(rename_tac ya x)(*strict*)
    apply(clarsimp)
    apply(rename_tac ya x w B)(*strict*)
    apply(subgoal_tac "y=w")
     apply(rename_tac ya x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac ya x w B)(*strict*)
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
   apply(rename_tac ya)(*strict*)
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(rename_tac ya)(*strict*)
  apply(subgoal_tac "nat_seq (Suc n) (Suc (m + n)) = (Suc n)#(nat_seq (Suc (Suc n)) (Suc (m + n)))")
   apply(rename_tac ya)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="THE r. \<exists>w B. liftB y @ teA A2 # liftA z2' = liftB w @ teA B # liftA r"
      and s="z2'"
      in ssubst)
    apply(rename_tac ya)(*strict*)
    apply(rule HOL.theI2)
      apply(rename_tac ya)(*strict*)
      apply(rule_tac
      x="y"
      in exI)
      apply(rule_tac
      x="A2"
      in exI)
      apply(simp add: get_configuration_def)
     apply(rename_tac ya x)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x w B)(*strict*)
     apply(subgoal_tac "y=w")
      apply(rename_tac ya x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac ya x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac ya x w B)(*strict*)
     apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
    apply(rename_tac ya x)(*strict*)
    apply(clarsimp)
    apply(rename_tac ya x w B)(*strict*)
    apply(subgoal_tac "y=w")
     apply(rename_tac ya x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac ya x w B)(*strict*)
    apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
   apply(rename_tac ya)(*strict*)
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(rename_tac ya)(*strict*)
  apply(subgoal_tac "the (right_quotient_word (A2 # z2') (maximalSuffix ({A2 # z2', z2'} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case d i of None \<Rightarrow> None | Some (pair e b) \<Rightarrow> Some b)) ` set (nat_seq (Suc (Suc n)) (Suc (m + n)))))) = A2 # the (right_quotient_word z2' (maximalSuffix ({z2'} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case d i of None \<Rightarrow> None | Some (pair e b) \<Rightarrow> Some b)) ` set (nat_seq (Suc (Suc n)) (Suc (m + n))))))")
   apply(rename_tac ya)(*strict*)
   apply(force)
  apply(rename_tac ya)(*strict*)
  apply(rule maximalSuffix_remove_nonresult_prime)
  apply(clarsimp)
  done

lemma relnonterms_invariant_on_drop_push: "
  valid_cfg G'
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e1 \<lparr>cfg_conf = liftB y @ teA B1 # liftA z1'\<rparr>)
  \<Longrightarrow> d (Suc (m + n)) \<noteq> None
  \<Longrightarrow> d (Suc n) =
        Some (pair (Some e)
               \<lparr>cfg_conf = liftB y @ teA A1 # liftA z1'\<rparr>)
  \<Longrightarrow> relnonterms d n (Suc (m + n)) = relnonterms d (Suc n) (Suc (m + n))"
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "nat_seq n (Suc (m + n)) = n#(nat_seq (Suc n) (Suc (m + n)))")
   apply(clarsimp)
   apply(rename_tac ya)(*strict*)
   apply(rule_tac
      t="THE r. \<exists>w B. cfg_conf (the (get_configuration (Some (pair e1 \<lparr>cfg_conf = liftB y @ teA B1 # liftA z1'\<rparr>)))) = liftB w @ teA B # liftA r"
      and s="z1'"
      in ssubst)
    apply(rename_tac ya)(*strict*)
    apply(rule HOL.theI2)
      apply(rename_tac ya)(*strict*)
      apply(rule_tac
      x="y"
      in exI)
      apply(rule_tac
      x="B1"
      in exI)
      apply(simp add: get_configuration_def)
     apply(rename_tac ya x)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x w B)(*strict*)
     apply(simp add: get_configuration_def)
     apply(subgoal_tac "y=w")
      apply(rename_tac ya x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac ya x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac ya x w B)(*strict*)
     apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
    apply(rename_tac ya x)(*strict*)
    apply(clarsimp)
    apply(rename_tac ya x w B)(*strict*)
    apply(simp add: get_configuration_def)
    apply(subgoal_tac "y=w")
     apply(rename_tac ya x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac ya x w B)(*strict*)
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split append_injective1 maxTermPrefix_shift)
   apply(rename_tac ya)(*strict*)
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(rename_tac ya)(*strict*)
  apply(subgoal_tac "nat_seq (Suc n) (Suc (m + n)) = (Suc n)#(nat_seq (Suc (Suc n)) (Suc (m + n)))")
   apply(rename_tac ya)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="THE r. \<exists>w B. cfg_conf (the (get_configuration (Some (pair (Some e) \<lparr>cfg_conf = liftB y @ teA A1 # liftA z1'\<rparr>)))) = liftB w @ teA B # liftA r"
      and s="z1'"
      in ssubst)
    apply(rename_tac ya)(*strict*)
    apply(rule HOL.theI2)
      apply(rename_tac ya)(*strict*)
      apply(rule_tac
      x="y"
      in exI)
      apply(rule_tac
      x="A1"
      in exI)
      apply(simp add: get_configuration_def)
     apply(rename_tac ya x)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x w B)(*strict*)
     apply(simp add: get_configuration_def)
     apply(subgoal_tac "y=w")
      apply(rename_tac ya x w B)(*strict*)
      apply(clarsimp)
      apply(rename_tac ya x)(*strict*)
      apply(rule liftA_inj)
      apply(rule sym)
      apply(force)
     apply(rename_tac ya x w B)(*strict*)
     apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
    apply(rename_tac ya x)(*strict*)
    apply(clarsimp)
    apply(rename_tac ya x w B)(*strict*)
    apply(simp add: get_configuration_def)
    apply(subgoal_tac "y=w")
     apply(rename_tac ya x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac ya x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac ya x w B)(*strict*)
    apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
   apply(rename_tac ya)(*strict*)
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(rename_tac ya)(*strict*)
  apply(clarsimp)
  done

lemma l2_push_ignore_no_relnonterms: "
  valid_cfg G'
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e2 \<lparr>cfg_conf = liftB y @ [teA (cons_l2   q1 A1a)]\<rparr>)
  \<Longrightarrow> d (Suc n) =
        Some (pair (Some \<lparr>prod_lhs = cons_l2 q1 A1a, prod_rhs = [teA (cons_l2   q2 A2a)]\<rparr>)
               \<lparr>cfg_conf = liftB y @ [teA (cons_l2   q2 A2a)]\<rparr>)
  \<Longrightarrow> relnonterms d n (Suc (m + n)) = []"
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "nat_seq n (Suc (m + n)) = n#(nat_seq (Suc n) (Suc (m + n)))")
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(clarsimp)
  apply(simp add: get_configuration_def)
  apply(rule_tac
      t="THE r. \<exists>w B. liftB y @ [teA (cons_l2   q1 A1a)] = liftB w @ teA B # liftA r"
      and s="[]"
      in ssubst)
   defer
   apply(subgoal_tac "maximalSuffix ({[]} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case d i of None \<Rightarrow> None | Some (pair e c) \<Rightarrow> Some c)) ` set (nat_seq (Suc n) (Suc (m + n))))=[]")
    apply(clarsimp)
    apply(simp add: right_quotient_word_def)
   apply(subgoal_tac "suffix [] (maximalSuffix ({[]} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case d i of None \<Rightarrow> None | Some (pair e c) \<Rightarrow> Some c)) ` set (nat_seq (Suc n) (Suc (m + n)))))")
    apply(simp add: suffix_def)
   apply(rule maximalSuffix_is_suffix)
   apply(clarsimp)
  apply(rule_tac
      a="[]"
      in HOL.theI2)
    apply(rule_tac
      x="y"
      in exI)
    apply(rule_tac
      x="cons_l2 q1 A1a"
      in exI)
    apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(rename_tac x w B)(*strict*)
   apply(subgoal_tac "y=w")
    apply(rename_tac x w B)(*strict*)
    apply(clarsimp)
    apply(rename_tac x)(*strict*)
    apply(rule liftA_inj)
    apply(rule sym)
    apply(force)
   apply(rename_tac x w B)(*strict*)
   apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
  apply(rename_tac x)(*strict*)
  apply(clarsimp)
  apply(rename_tac x w B)(*strict*)
  apply(subgoal_tac "y=w")
   apply(rename_tac x w B)(*strict*)
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(rule liftA_inj)
   apply(rule sym)
   apply(force)
  apply(rename_tac x w B)(*strict*)
  apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
  done

lemma push_adds_to_relnonterms: "
  valid_cfg G'
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e2 \<lparr>cfg_conf = liftB y @ teA B2 # liftA z2\<rparr>)
  \<Longrightarrow> d (Suc n) =
        Some (pair (Some \<lparr>prod_lhs = B2, prod_rhs = [teA A2, teA a]\<rparr>)
               \<lparr>cfg_conf = liftB y @ teA A2 # teA a # liftA z2\<rparr>)
  \<Longrightarrow> relnonterms d n (Suc (m + n)) = ab # list
  \<Longrightarrow> relnonterms d (Suc n) (Suc (m + n)) = a# relnonterms d n (Suc (m + n))"
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "nat_seq n (Suc (m + n)) = n#(nat_seq (Suc n) (Suc (m + n)))")
   prefer 2
   apply (metis ConsApp add_Suc nat_seq_drop_first add.commute)
  apply(clarsimp)
  apply(subgoal_tac "nat_seq (Suc n) (Suc (m + n)) = Suc n#(nat_seq (Suc (Suc n)) (Suc (m + n)))")
   prefer 2
   apply(rule nat_seq_pullout)
   apply(force)
  apply(simp add: get_configuration_def)
  apply(subgoal_tac "(THE r. \<exists>w B. liftB y @ teA A2 # teA a # liftA z2 = liftB w @ teA B # liftA r) = a#z2")
   prefer 2
   apply(rule_tac
      a="a#z2"
      in HOL.theI2)
     apply(clarsimp)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x w B)(*strict*)
    apply(subgoal_tac "y=w")
     apply(rename_tac x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac x)(*strict*)
     apply(case_tac x)
      apply(rename_tac x)(*strict*)
      apply(clarsimp)
     apply(rename_tac x aa lista)(*strict*)
     apply(clarsimp)
     apply(rename_tac lista)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac x w B)(*strict*)
    apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(rename_tac x w B)(*strict*)
   apply(subgoal_tac "y=w")
    apply(rename_tac x w B)(*strict*)
    apply(clarsimp)
    apply(rename_tac x)(*strict*)
    apply(case_tac x)
     apply(rename_tac x)(*strict*)
     apply(clarsimp)
    apply(rename_tac x aa lista)(*strict*)
    apply(clarsimp)
    apply(rename_tac lista)(*strict*)
    apply(rule liftA_inj)
    apply(rule sym)
    apply(force)
   apply(rename_tac x w B)(*strict*)
   apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
  apply(clarsimp)
  apply(thin_tac "(THE r. \<exists>w B. liftB y @ teA A2 # teA a # liftA z2 = liftB w @ teA B # liftA r) =a# z2")
  apply(subgoal_tac "(THE r. \<exists>w B. liftB y @ teA B2 # liftA z2 = liftB w @ teA B # liftA r)=z2")
   prefer 2
   apply(rule_tac
      a="z2"
      in HOL.theI2)
     apply(clarsimp)
     apply(force)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x w B)(*strict*)
    apply(subgoal_tac "y=w")
     apply(rename_tac x w B)(*strict*)
     apply(clarsimp)
     apply(rename_tac x)(*strict*)
     apply(rule liftA_inj)
     apply(rule sym)
     apply(force)
    apply(rename_tac x w B)(*strict*)
    apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(rename_tac x w B)(*strict*)
   apply(subgoal_tac "y=w")
    apply(rename_tac x w B)(*strict*)
    apply(clarsimp)
    apply(rename_tac x)(*strict*)
    apply(rule liftA_inj)
    apply(rule sym)
    apply(force)
   apply(rename_tac x w B)(*strict*)
   apply (metis maxTermPrefix_drop_tail maxTermPrefix_term_string)
  apply(clarsimp)
  apply(thin_tac "(THE r. \<exists>w B. liftB y @ teA B2 # liftA z2 = liftB w @ teA B # liftA r) = z2")
  apply(subgoal_tac "suffix z2 (maximalSuffix ({z2, a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n)))))")
   prefer 2
   apply(rule_tac
      t="({z2, a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n))))"
      and s="({z2}\<union>({a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n)))))"
      in ssubst)
    apply(force)
   apply(rule maximalSuffix_is_suffix)
   apply(clarsimp)
  apply(simp add: suffix_def)
  apply(clarsimp)
  apply(rename_tac c)(*strict*)
  apply(subgoal_tac "right_quotient_word z2 (maximalSuffix ({z2, a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n)))))=Some c")
   apply(rename_tac c)(*strict*)
   prefer 2
   apply(rule right_quotient_word_Some_by_append)
   apply(force)
  apply(rename_tac c)(*strict*)
  apply(clarsimp)
  apply(rule_tac
      w="maximalSuffix ({z2, a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n))))"
      in right_quotient_hlp1)
    apply(rule_tac
      t="{z2, a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n)))"
      and s="{z2}\<union>({a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n))))"
      in ssubst)
     apply(force)
    apply(rule maximalSuffix_is_suffix)
    apply(clarsimp)
   apply(force)
  apply(subgoal_tac "maximalSuffix ({z2, a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n)))) = maximalSuffix ({a # z2} \<union> (\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (case_option None (case_derivation_configuration (\<lambda>e. Some)) (d i))) ` set (nat_seq (Suc (Suc n)) (Suc (m + n))))")
   apply(force)
  apply(rule maximalSuffix_removal)
  apply(force)
  done

lemma F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_contra: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G \<lparr>prod_lhs = B1, prod_rhs = []\<rparr> = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G \<lparr>prod_lhs = B2, prod_rhs = w\<rparr>
  \<Longrightarrow> \<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> cfg_productions G'
  \<Longrightarrow> \<lparr>prod_lhs = B2, prod_rhs = w\<rparr> \<in> cfg_productions G'
  \<Longrightarrow> w\<noteq>[]
  \<Longrightarrow> Q"
  apply(subgoal_tac "\<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   prefer 2
   apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(clarsimp)
   apply(force)
  apply(subgoal_tac "\<lparr>prod_lhs = B2, prod_rhs = w\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   prefer 2
   apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(clarsimp)
   apply(force)
  apply(clarsimp)
  apply(subgoal_tac "(\<exists>x\<in> epda_delta SSG. edge_event x \<noteq> None \<and> (SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states SSG) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<and> (SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states SSG) \<or> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<or> edge_event x = None \<and> edge_push x = [] \<and> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<and> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<or> edge_event x = None \<and> edge_push x \<noteq> [] \<and> (SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states SSG) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states SSG)) \<and> (SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states SSG) \<or> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states SSG))) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG) (epda_gamma SSG) \<and> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG) (epda_gamma SSG)" for SSG SSe1 SSe2)
   prefer 2
   apply(rule_tac
      ?e1.0="\<lparr>prod_lhs = B1, prod_rhs = []\<rparr>"
      and ?e2.0="\<lparr>prod_lhs = B2, prod_rhs = w\<rparr>"
      in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_equal_then_from_special_sets)
         apply(force)
        apply(force)
       apply(force)
      apply(force)
     apply(force)
    apply(force)
   apply(force)
  apply(thin_tac "F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G \<lparr>prod_lhs = B1, prod_rhs = []\<rparr> = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G \<lparr>prod_lhs = B2, prod_rhs = w\<rparr>")
  apply(thin_tac "\<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> cfg_productions G'")
  apply(thin_tac "\<lparr>prod_lhs = B2, prod_rhs = w\<rparr> \<in> cfg_productions G'")
  apply(thin_tac "\<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<or> \<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l2 G")
  apply(thin_tac "\<lparr>prod_lhs = B2, prod_rhs = w\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<or> \<lparr>prod_lhs = B2, prod_rhs = w\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l2 G")
  apply(erule disjE)
   apply(clarsimp)
   apply(rename_tac x)(*strict*)
   apply(erule disjE)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x y)(*strict*)
    apply(erule_tac
      P="\<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G)"
      in disjE)
     apply(rename_tac x y)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
    apply(rename_tac x y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def)
   apply(rename_tac x)(*strict*)
   apply(erule disjE)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
   apply(rename_tac x)(*strict*)
   apply(clarsimp)
   apply(erule_tac
      P="\<lparr>prod_lhs = B1, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G)"
      in disjE)
    apply(rename_tac x)(*strict*)
    apply(erule disjE)
     apply(rename_tac x)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(rename_tac x)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
    apply(erule disjE)
     apply(rename_tac x)(*strict*)
     apply(clarsimp)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(rename_tac x)(*strict*)
    apply(clarsimp)
    apply(rename_tac x qs)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(rename_tac x)(*strict*)
   apply(erule disjE)
    apply(rename_tac x)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac x qs qt)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(rename_tac x)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  done

lemma last_point_where_same_SDPDA_edges_used_bracketed: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n = Some (pair e1 \<lparr>cfg_conf=(liftB v1) @ teA B1 # (liftA r1)\<rparr>)
  \<Longrightarrow> d2 n = Some (pair e2 \<lparr>cfg_conf=(liftB v2) @ teA B2 # (liftA r2)\<rparr>)
  \<Longrightarrow> n\<le>m
  \<Longrightarrow> d1 m = Some (pair e1' \<lparr>cfg_conf=(liftB v1') @ teA B1' # (liftA r1')\<rparr>)
  \<Longrightarrow> d2 m = Some (pair e2' \<lparr>cfg_conf=(liftB v2') @ teA B2' # (liftA r2')\<rparr>)
  \<Longrightarrow> v1'@x1'=v2'@x2'
  \<Longrightarrow>
  \<forall>k. Suc 0\<le>k\<and>k\<le>m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k)))
  \<and> v1=v2
  \<and> equal_front_states (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m))
  \<and> equal_stacks (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m))"
  apply(induct "m-n" arbitrary: n e1 v1 B1 r1 e2 v2 B2 r2 x1 x2)
   apply(rename_tac n e1 v1 B1 r1 e2 v2 B2 r2)(*strict*)
   apply(clarsimp)
   apply(rename_tac v1 B1 r1 v2 B2 r2 k)(*strict*)
   apply(subgoal_tac "v1=v1'")
    apply(rename_tac v1 B1 r1 v2 B2 r2 k)(*strict*)
    apply(subgoal_tac "v2=v2'")
     apply(rename_tac v1 B1 r1 v2 B2 r2 k)(*strict*)
     apply(clarsimp)
     apply(rename_tac r1 r2 k)(*strict*)
     apply(subgoal_tac "r1=r1'")
      apply(rename_tac r1 r2 k)(*strict*)
      apply(clarsimp)
      apply(rename_tac r2 k)(*strict*)
      apply(subgoal_tac "r2=r2'")
       apply(rename_tac r2 k)(*strict*)
       apply(clarsimp)
       apply(rename_tac k)(*strict*)
       apply(subgoal_tac "(\<forall>k. Suc 0\<le>k\<and>k\<le>m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k)))) \<and> v1'=v2' \<and> equal_stacks (B1'#r1') (B2'#r2') \<and> (\<exists>m. equal_front_states (B1'#(take m r1')) (B2'#(take m r2')) \<and> (case drop m r1' of [] \<Rightarrow> True | A1#w1 \<Rightarrow> (case drop m r2' of [] \<Rightarrow> True | A2#w2 \<Rightarrow> \<not> equal_front_state A1 A2 ) ))")
        apply(rename_tac k)(*strict*)
        prefer 2
        apply(rule_tac
      ?d1.0="d1"
      and ?d2.0="d2"
      and n="m"
      in cfgLM_positions_remain_compatible)
                  apply(rename_tac k)(*strict*)
                  apply(force)
                 apply(rename_tac k)(*strict*)
                 apply(force)
                apply(rename_tac k)(*strict*)
                apply(force)
               apply(rename_tac k)(*strict*)
               apply(force)
              apply(rename_tac k)(*strict*)
              apply(force)
             apply(rename_tac k)(*strict*)
             apply(force)
            apply(rename_tac k)(*strict*)
            apply(force)
           apply(rename_tac k)(*strict*)
           apply(force)
          apply(rename_tac k)(*strict*)
          apply(force)
         apply(rename_tac k)(*strict*)
         apply(force)
        apply(rename_tac k)(*strict*)
        apply(force)
       apply(rename_tac k)(*strict*)
       apply(clarsimp)
       apply(rename_tac k ma)(*strict*)
       apply(rule conjI)
        apply(rename_tac k ma)(*strict*)
        apply(simp add: equal_front_states_def)
        apply(clarsimp)
        apply(rename_tac k ma i)(*strict*)
        apply(case_tac i)
         apply(rename_tac k ma i)(*strict*)
         apply(clarsimp)
         apply(rename_tac k ma)(*strict*)
         apply(erule_tac
      x="0"
      and P="\<lambda>x. x < Suc (min (length r1') ma) \<and> x < Suc (min (length r2') ma) \<longrightarrow> equal_front_state ((B1' # take ma r1') ! x) ((B2' # take ma r2') ! x)"
      in allE)
         apply(rename_tac k ma)(*strict*)
         apply(clarsimp)
        apply(rename_tac k ma i nat)(*strict*)
        apply(clarsimp)
        apply(rename_tac k ma nat)(*strict*)
        apply(subgoal_tac "relnonterms d1 m m = []")
         apply(rename_tac k ma nat)(*strict*)
         apply(clarsimp)
        apply(rename_tac k ma nat)(*strict*)
        apply(rule relnonterms_triv)
          apply(rename_tac k ma nat)(*strict*)
          apply(force)
         apply(rename_tac k ma nat)(*strict*)
         apply(force)
        apply(rename_tac k ma nat)(*strict*)
        apply(force)
       apply(rename_tac k ma)(*strict*)
       apply(simp add: equal_stacks_def)
       apply(clarsimp)
       apply(rename_tac k ma i)(*strict*)
       apply(case_tac i)
        apply(rename_tac k ma i)(*strict*)
        apply(clarsimp)
        apply(rename_tac k ma)(*strict*)
        apply(erule_tac
      x="0"
      and P="\<lambda>x. x < Suc (length r1') \<and> x < Suc (length r2') \<longrightarrow> equal_stack ((B1' # r1') ! x) ((B2' # r2') ! x)"
      in allE)
        apply(rename_tac k ma)(*strict*)
        apply(clarsimp)
       apply(rename_tac k ma i nat)(*strict*)
       apply(clarsimp)
       apply(rename_tac k ma nat)(*strict*)
       apply(subgoal_tac "relnonterms d1 m m = []")
        apply(rename_tac k ma nat)(*strict*)
        apply(clarsimp)
       apply(rename_tac k ma nat)(*strict*)
       apply(rule relnonterms_triv)
         apply(rename_tac k ma nat)(*strict*)
         apply(force)
        apply(rename_tac k ma nat)(*strict*)
        apply(force)
       apply(rename_tac k ma nat)(*strict*)
       apply(force)
      apply(rename_tac r2 k)(*strict*)
      apply(rule liftA_inj)
      apply(force)
     apply(rename_tac r1 r2 k)(*strict*)
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac v1 B1 r1 v2 B2 r2 k)(*strict*)
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split liftB_inj append_injective1)
   apply(rename_tac v1 B1 r1 v2 B2 r2 k)(*strict*)
   apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split liftB_inj append_injective1)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2)(*strict*)
  apply(case_tac m)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2)(*strict*)
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k)(*strict*)
  apply(erule_tac
      x="Suc n"
      in meta_allE)
  apply(clarsimp)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d1 n = Some (pair e1 c1) \<and> d1 (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc nat"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k)(*strict*)
    apply(force)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k)(*strict*)
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d2 n = Some (pair e1 c1) \<and> d2 (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc nat"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r)(*strict*)
    apply(force)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r)(*strict*)
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r e2b c2a)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r e2b c2a la ra)(*strict*)
  apply(erule_tac
      x="Some e2a"
      in meta_allE)
  apply(clarsimp)
  apply(case_tac c2)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a c2 l r e2b c2a la ra cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b c2a la ra)(*strict*)
  apply(case_tac c2a)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b c2a la ra cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
  apply(subgoal_tac "setA (l @ teA (prod_lhs e2a) # r)={} \<or> (\<exists>w1 w2 B. (l @ teA (prod_lhs e2a) # r)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
   prefer 2
   apply(rule LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
       apply(force)
      apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
    apply(force)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
  apply(subgoal_tac "setA (la @ teA (prod_lhs e2b) # ra)={} \<or> (\<exists>w1 w2 B. (la @ teA (prod_lhs e2b) # ra)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
       apply(force)
      apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
    apply(force)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
  apply(erule_tac
      P="setA (l @ teA (prod_lhs e2a) # r) = {}"
      in disjE)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
   apply (metis elemInsetA emptyE)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
  apply(erule disjE)
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
   apply (metis elemInsetA emptyE)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
  apply(subgoal_tac "la=liftB w1a")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
   prefer 2
   apply (metis liftA.simps(2) split_decide1)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
  apply(subgoal_tac "l=liftB w1")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
   prefer 2
   apply (metis liftA.simps(2) split_decide1)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a l r e2b la ra w1 w1a w2 w2a B Ba)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(thin_tac "setA (liftB w1a) = {}")
  apply(thin_tac "setA (liftB w1) = {}")
  apply(case_tac "n=Suc nat")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "n<Suc nat")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "x+n=nat")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 nat k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(subgoal_tac "v1=w1")
   apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split liftB_inj append_injective1)
  apply(rename_tac x n e1 v1 B1 r1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 r1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(subgoal_tac "r1=w2")
   apply(rename_tac x n e1 r1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(clarsimp)
   apply(rename_tac x n e1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(subgoal_tac "v2=w1a")
    apply(rename_tac x n e1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    prefer 2
    apply (metis setA_liftB liftA.simps(2) liftA_vs_filterA setB_liftA liftB_liftA_split liftB_inj append_injective1)
   apply(rename_tac x n e1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(clarsimp)
   apply(rename_tac x n e1 e2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(subgoal_tac "r2=w2a")
    apply(rename_tac x n e1 e2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply(clarsimp)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    defer
    apply(rename_tac x n e1 e2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac x n e1 r1 e2 v2 B2 r2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(subgoal_tac "setA (liftB w1a @ prod_rhs e2b @ liftA w2a)={} \<or> (\<exists>w1 w2 B. (liftB w1a @ prod_rhs e2b @ liftA w2a)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(erule disjE)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(case_tac x)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply (metis liftA.simps(2) elemInsetA emptyE)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(case_tac "d2 (Suc n+Suc 0)=None")
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    prefer 2
    apply(subgoal_tac "Suc 0=0")
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    apply(rule_tac
      n="Suc n"
      and d="d2"
      in cfgLM_no_step_without_nontermsX)
        apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
        apply(force)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(subgoal_tac "False")
    apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(rule_tac
      d="d2"
      and n="Suc(Suc n)"
      and m="Suc (Suc (nat+n))"
      in cfgLM.no_some_beyond_none)
       apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
       apply(force)
      apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
      apply(force)
     apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
     apply(force)
    apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(subgoal_tac "setA (liftB w1 @ prod_rhs e2a @ liftA w2)={} \<or> (\<exists>w1X w2X BX. (liftB w1 @ prod_rhs e2a @ liftA w2)=(liftB w1X)@teA BX#(liftA w2X))")
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   prefer 2
   apply(rule_tac
      d="d1"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(erule disjE)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
   apply(case_tac x)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a w1b w2b B)(*strict*)
    apply (metis liftA.simps(2) elemInsetA emptyE)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(case_tac "d1 (Suc n+Suc 0)=None")
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    prefer 2
    apply(subgoal_tac "Suc 0=0")
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    apply(rule_tac
      n="Suc n"
      and d="d1"
      in cfgLM_no_step_without_nontermsX)
        apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
        apply(force)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a nat)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
   apply(subgoal_tac "False")
    apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
   apply(rule_tac
      d="d1"
      and n="Suc(Suc n)"
      and m="Suc (Suc (nat+n))"
      in cfgLM.no_some_beyond_none)
       apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
       apply(force)
      apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
      apply(force)
     apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
     apply(force)
    apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 k e2a e2b w1 w1a w2 w2a nat w1b w2b B)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w1b w1X w2b w2X B BX)(*strict*)
  apply(erule_tac
      x="w1X"
      in meta_allE)
  apply(erule_tac
      x="BX"
      in meta_allE)
  apply(erule_tac
      x="w2X"
      in meta_allE)
  apply(clarsimp)
  apply(erule_tac
      x="Some e2b"
      in meta_allE)
  apply(erule_tac
      x="w1b"
      in meta_allE)
  apply(erule_tac
      x="B"
      in meta_allE)
  apply(erule_tac
      x="w2b"
      in meta_allE)
  apply(clarsimp)
  apply(subgoal_tac "prefix w1a w1b")
   prefer 2
   apply(rule prefix_of_terminalInitial)
   apply(rule sym)
   apply(force)
  apply(simp add: prefix_def)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w1X w2b w2X B BX c)(*strict*)
  apply(subgoal_tac "prefix w1 w1X")
   prefer 2
   apply(rule prefix_of_terminalInitial)
   apply(rule sym)
   apply(force)
  apply(simp add: prefix_def)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w1X w2b w2X B BX c ca)(*strict*)
  apply(subgoal_tac " \<forall>k. Suc 0 \<le> k \<and> k \<le> Suc (x + n) \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d2 k))) \<and> w1@ca = w1a @ c \<and> equal_front_states (BX # relnonterms d1 (Suc n) (Suc (x + n))) (B # relnonterms d2 (Suc n) (Suc (x + n))) \<and> equal_stacks (BX # relnonterms d1 (Suc n) (Suc (x + n))) (B # relnonterms d2 (Suc n) (Suc (x + n)))")
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w1X w2b w2X B BX c ca)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w1X w2b w2X B BX c ca)(*strict*)
  apply(thin_tac "\<forall>k. Suc 0 \<le> k \<and> k \<le> Suc (x + n) \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d2 k))) \<and> w1X = w1a @ c \<and> equal_front_states (BX # relnonterms d1 (Suc n) (Suc (x + n))) (B # relnonterms d2 (Suc n) (Suc (x + n))) \<and> equal_stacks (BX # relnonterms d1 (Suc n) (Suc (x + n))) (B # relnonterms d2 (Suc n) (Suc (x + n)))")
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
  apply(simp add: liftB_commutes_over_concat)
  apply(subgoal_tac "prefix w1 v1'")
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
   prefer 2
   apply(subgoal_tac "\<exists>v. cfg_conf \<lparr>cfg_conf = liftB v1' @ teA B1' # liftA r1'\<rparr>=liftB w1@v")
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
    prefer 2
    apply(rule_tac
      d="d1"
      and n="n"
      and m="Suc x"
      in CFGLM_terminals_stay_at_front)
        apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
        apply(force)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
     apply(rule_tac
      t="n+Suc x"
      and s="Suc(x+n)"
      in ssubst)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
    apply(clarsimp)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
   apply(clarsimp)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca v)(*strict*)
   apply (metis liftA.simps(1) liftA.simps(2) append_Nil2 prefix_of_terminalInitial)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
  apply(subgoal_tac "prefix w1a v2'")
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
   prefer 2
   apply(subgoal_tac "\<exists>v. cfg_conf \<lparr>cfg_conf = liftB v2' @ teA B2' # liftA r2'\<rparr>=liftB w1a@v")
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
    prefer 2
    apply(rule_tac
      d="d2"
      and n="n"
      and m="Suc x"
      in CFGLM_terminals_stay_at_front)
        apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
        apply(force)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
     apply(rule_tac
      t="n+Suc x"
      and s="Suc(x+n)"
      in ssubst)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
    apply(clarsimp)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
   apply(clarsimp)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca v)(*strict*)
   apply (metis liftA.simps(1) liftA.simps(2) append_Nil2 prefix_of_terminalInitial)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca)(*strict*)
  apply(simp add: prefix_def)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
  apply(subgoal_tac "(\<forall>k. Suc 0 \<le> k \<and> k \<le> SSn \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 SSG (the (get_label (SSd1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 SSG (the (get_label (SSd2 k)))) \<and> SSv1 = SSv2 \<and> equal_stacks (SSB1 # SSr1) (SSB2 # SSr2) \<and> (\<exists>m. equal_front_states (SSB1 # take m SSr1) (SSB2 # take m SSr2) \<and> (case drop m SSr1 of [] \<Rightarrow> True | A1 # w1 \<Rightarrow> (case drop m SSr2 of [] \<Rightarrow> True | A2 # w2 \<Rightarrow> \<not> equal_front_state A1 A2)))" for SSn SSG SSd1 SSd2 SSv1 SSv2 SSB1 SSr1 SSB2 SSr2)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
   prefer 2
   apply(rule_tac
      ?d1.0="d1"
      and ?d2.0="d2"
      and n="n"
      in cfgLM_positions_remain_compatible)
             apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
             apply(force)
            apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
            apply(force)
           apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
           apply(force)
          apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
          apply(force)
         apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
         apply(force)
        apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
        apply(force)
       apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
     apply(clarsimp)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
    apply(clarsimp)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1 w1a w2 w2a w2b w2X B BX c ca cb cc)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
  apply(subgoal_tac "equal_front_state (prod_lhs e2a) (prod_lhs e2b)")
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
   prefer 2
   apply(simp add: equal_front_states_def)
   apply(erule_tac
      x="0"
      and P="\<lambda>x. x < Suc (min (length w2) m) \<and> x < Suc (min (length w2a) m) \<longrightarrow> equal_front_state ((prod_lhs e2a # take m w2) ! x) ((prod_lhs e2b # take m w2a) ! x)"
      in allE)
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
   apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
  apply(thin_tac "equal_front_states (prod_lhs e2a # take m w2) (prod_lhs e2b # take m w2a)")
  apply(thin_tac "case drop m w2 of [] \<Rightarrow> True | A1 # w1 \<Rightarrow> (case drop m w2a of [] \<Rightarrow> True | A2 # w2 \<Rightarrow> \<not> equal_front_state A1 A2)")
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
  apply(erule_tac
      x="Suc n"
      in allE)
  apply(erule impE)
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c ca cb cc m)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
  apply(simp add: get_label_def)
  apply(simp add: liftB_commutes_over_concat)
  apply(subgoal_tac "state_adjacency_and_no_l2_before_l3 (prod_lhs e2a#w2)")
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   prefer 2
   apply(rule_tac
      d="d1"
      and n="n"
      in cfgLM_reachable_have_state_adjacency_and_no_l2_before_l3)
       apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
  apply(subgoal_tac "state_adjacency_and_no_l2_before_l3 (prod_lhs e2b#w2a)")
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      and n="n"
      in cfgLM_reachable_have_state_adjacency_and_no_l2_before_l3)
       apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
       apply(force)
      apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
     apply(force)
    apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
    apply(force)
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
  apply(subgoal_tac "e2a \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   prefer 2
   apply(rule_tac
      A="cfg_productions G'"
      in set_mp)
    apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
  apply(subgoal_tac "e2b \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   prefer 2
   apply(rule_tac
      A="cfg_productions G'"
      in set_mp)
    apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
    apply(simp add: F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_def)
    apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
   apply(force)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc)(*strict*)
  apply(clarsimp)
  apply(case_tac e2a)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc prod_lhsa prod_rhsa)(*strict*)
  apply(case_tac e2b)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc prod_lhsa prod_rhsa prod_lhsaa prod_rhsaa)(*strict*)
  apply(rename_tac B1 z1 B2 z2)
  apply(rename_tac x n e1 e2 k e2a e2b w1a w2 w2a w2b w2X B BX c cb cc B1 z1 B2 z2)(*strict*)
  apply(clarsimp)
  apply(rename_tac x n e1 e2 k w1a w2 w2a w2b w2X B BX c cb cc B1 z1 B2 z2)(*strict*)
  apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)
  apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
  apply(subgoal_tac "prefix y' y1")
   apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
   prefer 2
   apply(subgoal_tac "\<exists>v. cfg_conf \<lparr>cfg_conf = liftB y @ liftB y1 @ teA B1' # liftA r1'\<rparr>=liftB (y@y')@v")
    apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
    prefer 2
    apply(rule_tac
      d="d1"
      and n="Suc n"
      and m="m"
      in CFGLM_terminals_stay_at_front)
        apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
        apply(force)
       apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
     apply(rule_tac
      t="Suc n+m"
      and s="Suc(m+n)"
      in ssubst)
      apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
     apply(clarsimp)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
    apply(clarsimp)
    apply(simp add: liftB_commutes_over_concat)
   apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2 v)(*strict*)
   apply(simp add: liftB_commutes_over_concat)
   apply (metis liftA.simps(1) liftA.simps(2) append_Nil2 prefix_of_terminalInitial)
  apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
  apply(subgoal_tac "prefix y' y2")
   apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
   prefer 2
   apply(subgoal_tac "\<exists>v. cfg_conf \<lparr>cfg_conf = liftB y @ liftB y2 @ teA B2' # liftA r2'\<rparr>=liftB (y@y')@v")
    apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
    prefer 2
    apply(rule_tac
      d="d2"
      and n="Suc n"
      and m="m"
      in CFGLM_terminals_stay_at_front)
        apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
        apply(force)
       apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
     apply(rule_tac
      t="Suc n+m"
      and s="Suc(m+n)"
      in ssubst)
      apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
     apply(clarsimp)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
    apply(clarsimp)
    apply(simp add: liftB_commutes_over_concat)
   apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2 v)(*strict*)
   apply(simp add: liftB_commutes_over_concat)
   apply (metis liftA.simps(1) liftA.simps(2) append_Nil2 prefix_of_terminalInitial)
  apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' y1 y2 B1 w1 B2 w2)(*strict*)
  apply(simp add: prefix_def)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 w2b w2X B BX y' B1 w1 B2 w2 c ca)(*strict*)
  apply(simp add: liftB_commutes_over_concat)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "prefix (relnonterms d1 n (Suc (m + n))) z1")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   prefer 2
   apply(rule_tac
      t="Suc (m+n)"
      and s="Suc m+n"
      in ssubst)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(rule_tac
      y'="y @ y' @ y1"
      in relnonterms_prefix)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(clarsimp)
   apply(simp add: liftB_commutes_over_concat)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "prefix (relnonterms d2 n (Suc (m + n))) z2")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   prefer 2
   apply(rule_tac
      t="Suc (m+n)"
      and s="Suc m+n"
      in ssubst)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(rule_tac
      y'="y @ y' @ y2"
      in relnonterms_prefix)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(clarsimp)
   apply(simp add: liftB_commutes_over_concat)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(rule conjI)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   prefer 2
   apply(rule equal_stacks_prefix)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "prefix (relnonterms d1 (Suc n) (Suc (m + n))) z1'")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   prefer 2
   apply(rule_tac
      t="Suc (m+n)"
      and s="m+Suc n"
      in ssubst)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(rule_tac
      y="y@y'"
      and y'="y @ y' @ y1"
      in relnonterms_prefix)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(clarsimp)
    apply(simp add: liftB_commutes_over_concat)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(clarsimp)
   apply(simp add: liftB_commutes_over_concat)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "prefix (relnonterms d2 (Suc n) (Suc (m + n))) z2'")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   prefer 2
   apply(rule_tac
      t="Suc (m+n)"
      and s="m+Suc n"
      in ssubst)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(rule_tac
      y="y@y'"
      and y'="y @ y' @ y2"
      in relnonterms_prefix)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
    apply(clarsimp)
    apply(simp add: liftB_commutes_over_concat)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(clarsimp)
   apply(simp add: liftB_commutes_over_concat)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "equal_front_states (relnonterms d1 n (Suc (m + n))) (relnonterms d2 n (Suc (m + n)))")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   apply(simp add: equal_front_states_def)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 i)(*strict*)
   apply(case_tac i)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 i)(*strict*)
    apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 i nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(case_tac "y'")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
   prefer 2
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
   apply(subgoal_tac "LR1ProdFormSimp G'")
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
    prefer 2
    apply(rule LR1ProdForm_implies_LR1ProdFormSimp)
    apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
   apply(subgoal_tac "list=[]")
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
    prefer 2
    apply(simp add: LR1ProdFormSimp_def)
    apply(erule_tac
      x="\<lparr>prod_lhs = B1, prod_rhs = w1\<rparr>"
      in ballE)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
     prefer 2
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list)(*strict*)
    apply(erule_tac
      P="w1 = []"
      in disjE)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
     apply(case_tac z1)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list aa lista)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B)(*strict*)
    apply(erule_tac
      P="B1 = A \<and> w1 = [teB b, teA B]"
      in disjE)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B)(*strict*)
     apply(clarsimp)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B2 w2 y1 y2 a list A B)(*strict*)
     apply(case_tac list)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B2 w2 y1 y2 a list A B)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B2 w2 y1 y2 a list A B aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B)(*strict*)
    apply(erule_tac
      P="B1 = A \<and> w1 = [teA B]"
      in disjE)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B)(*strict*)
     apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B)(*strict*)
    apply(case_tac list)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list b A B aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2 a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a)(*strict*)
   apply(case_tac w1)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a)(*strict*)
    apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a)(*strict*)
    apply(case_tac z1)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a)(*strict*)
     apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a aa list)(*strict*)
    apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a aa list)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
   apply(case_tac w2)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list)(*strict*)
    apply(case_tac z2)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list aa lista)(*strict*)
    apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list aa lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
   apply(subgoal_tac "LR1ProdFormSimp G'")
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
    prefer 2
    apply(rule LR1ProdForm_implies_LR1ProdFormSimp)
    apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
   apply(subgoal_tac "\<exists>B1. list=[teA B1]")
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
    prefer 2
  apply(simp add: LR1ProdFormSimp_def)
  apply(erule_tac
    x="\<lparr>prod_lhs = B1, prod_rhs = teB a # list\<rparr>"
    in ballE)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
  apply(subgoal_tac "\<exists>B2. lista=[teA B2]")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
  prefer 2
  apply(simp add: LR1ProdFormSimp_def)
  apply(erule_tac
    x="\<lparr>prod_lhs = B2, prod_rhs = teB a # lista\<rparr>"
    in ballE)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(subgoal_tac "z1=z1'")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  prefer 2
  apply(rule liftA_inj)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(subgoal_tac "z2=z2'")
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  prefer 2
  apply(rule liftA_inj)
  apply(force)
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(rule_tac
    t="relnonterms d1 n (Suc (m + n))"
    and s="relnonterms d1 (Suc n) (Suc (m + n))"
    in ssubst)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  prefer 2
  apply(rule_tac
    t="relnonterms d2 n (Suc (m + n))"
    and s="relnonterms d2 (Suc n) (Suc (m + n))"
    in ssubst)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
   prefer 2
   apply(simp add: equal_front_states_def)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a i)(*strict*)
   apply(erule_tac
    x="Suc i"
    in allE)+
   apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(rule relnonterms_invariant_on_read)
      apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(rule relnonterms_invariant_on_read)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 y' B1 w1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "w1=[] \<or> (\<exists>C1 D1. w1=[teA C1,teA D1]) \<or> (\<exists>C. w1=[teA C])")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  prefer 2
  apply(subgoal_tac "LR1ProdFormSimp G'")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  prefer 2
  apply(rule LR1ProdForm_implies_LR1ProdFormSimp)
  apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(simp add: LR1ProdFormSimp_def)
  apply(erule_tac
    x="\<lparr>prod_lhs = B1, prod_rhs = w1\<rparr>"
    in ballE)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  prefer 2
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 b A B)(*strict*)
  apply(case_tac w1)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 b A B)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 b A B a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "w2=[] \<or> (\<exists>C2 D2. w2=[teA C2,teA D2]) \<or> (\<exists>C. w2=[teA C])")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  prefer 2
  apply(subgoal_tac "LR1ProdFormSimp G'")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  prefer 2
  apply(rule LR1ProdForm_implies_LR1ProdFormSimp)
  apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(simp add: LR1ProdFormSimp_def)
  apply(erule_tac
    x="\<lparr>prod_lhs = B2, prod_rhs = w2\<rparr>"
    in ballE)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  prefer 2
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 b A B)(*strict*)
  apply(case_tac w2)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 b A B)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 b A B a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(subgoal_tac "w1=[] \<longleftrightarrow> w2=[]")
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(erule_tac
    P="w1 = []"
    in disjE)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
  apply(case_tac z1)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 list)(*strict*)
  apply(subgoal_tac "list=z1'")
   apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
  apply(case_tac z2)
   apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 z2' z1' A2 A1 B1 B2 y1 y2 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 list)(*strict*)
  apply(subgoal_tac "list=z2'")
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
  apply(rule_tac
    t="relnonterms d1 n (Suc (m + n))"
    and s="A1 # relnonterms d1 (Suc n) (Suc (m + n))"
    in ssubst)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   prefer 2
   apply(rule_tac
    t="relnonterms d2 n (Suc (m + n))"
    and s="A2 # relnonterms d2 (Suc n) (Suc (m + n))"
    in ssubst)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(rule relnonterms_change_on_pop_final)
        apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
        apply(force)
       apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
       apply(force)
      apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
  apply(rule relnonterms_change_on_pop_final)
       apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
       apply(force)
      apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(case_tac w2)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 list)(*strict*)
  apply(case_tac w1)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 list)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 list a lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 list lista)(*strict*)
  apply(case_tac list)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 list lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
  apply(subgoal_tac "z2=z2'")
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
  apply(case_tac "lista=[]")
   apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(subgoal_tac "z1=z1'")
    apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(clarsimp)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(rule_tac
    t="relnonterms d1 n (Suc (m + n))"
    and s="relnonterms d1 (Suc n) (Suc (m + n))"
    in ssubst)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    prefer 2
    apply(rule_tac
    t="relnonterms d2 n (Suc (m + n))"
    and s="relnonterms d2 (Suc n) (Suc (m + n))"
    in ssubst)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
     prefer 2
     apply(simp add: equal_front_states_def)
     apply(clarsimp)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2 i)(*strict*)
     apply(erule_tac
    x="Suc i"
    in allE)+
     apply(clarsimp)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    apply(rule relnonterms_invariant_on_drop_push)
        apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
        apply(force)
       apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
       apply(force)
      apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(rule relnonterms_invariant_on_drop_push)
       apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
       apply(force)
      apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2' z1' A2 A1 B1 B2 y1 y2)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
  apply(case_tac "lista")
   apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 lista)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 lista a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 D1)(*strict*)
  apply(case_tac z1')
   apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 D1)(*strict*)
   apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2' z1' A2 A1 B1 B2 y1 y2 D1 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a list)(*strict*)
  apply(subgoal_tac "list=z1")
   apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(rule sym)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a list)(*strict*)
  apply(clarify)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(subgoal_tac "LR1ProdForm G'")
   apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a)(*strict*)
   prefer 2
   apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(simp add: LR1ProdForm_def)
  apply(erule_tac
    x="\<lparr>prod_lhs = B2, prod_rhs = [teA A2]\<rparr>"
    in ballE)
   apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2' A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(subgoal_tac "z2'=[]")
   apply(rename_tac m n e1 e2 k y z1 z2' A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
   prefer 2
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
   apply(case_tac z2')
    apply(rename_tac m n e1 e2 k y z1 z2' A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2' A1 B1 y1 y2 a q1 q2 A1a A2a aa list)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2' A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(subgoal_tac "relnonterms d2 n (Suc (m + n)) = []")
   apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
   apply(simp add: equal_front_states_def)
  apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(rule l2_push_ignore_no_relnonterms)
     apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 A1 B1 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 list lista a listb)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 lista D2)(*strict*)
  apply(case_tac z2')
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 lista D2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 y1 y2 lista D2 a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 lista a list)(*strict*)
  apply(subgoal_tac "list=z2")
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 lista a list)(*strict*)
  prefer 2
  apply(rule sym)
  apply(rule liftA_inj)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 lista a list)(*strict*)
  apply(clarify)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 lista a)(*strict*)
  apply(case_tac lista)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 lista a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(subgoal_tac "z1=z1'")
   apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(subgoal_tac "LR1ProdForm G'")
   apply(rename_tac m n e1 e2 k y z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
   prefer 2
   apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(simp add: LR1ProdForm_def)
  apply(erule_tac
    x="\<lparr>prod_lhs = B1, prod_rhs = [teA A1]\<rparr>"
    in ballE)
   apply(rename_tac m n e1 e2 k y z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac m n e1 e2 k y z2 z1' A2 A1 B1 B2 y1 y2 a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 z1' A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(subgoal_tac "z1'=[]")
   apply(rename_tac m n e1 e2 k y z2 z1' A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
   prefer 2
   apply(simp add: state_adjacency_and_no_l2_before_l3_def)
   apply(erule_tac
    x="[]"
    in allE)+
   apply(clarsimp)
   apply(case_tac z1')
    apply(rename_tac m n e1 e2 k y z2 z1' A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2 z1' A2 B2 y1 y2 a q1 q2 A1a A2a aa list)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2 z1' A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(subgoal_tac "relnonterms d1 n (Suc (m + n)) = []")
   apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
   apply(simp add: equal_front_states_def)
  apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(rule l2_push_ignore_no_relnonterms)
     apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z2 A2 B2 y1 y2 a q1 q2 A1a A2a)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 lista a aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 a D1)(*strict*)
  apply(case_tac z1')
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 a D1)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z1' A2 A1 B1 B2 y1 y2 a D1 aa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa list)(*strict*)
  apply(subgoal_tac "list=z1")
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa list)(*strict*)
  prefer 2
  apply(rule sym)
  apply(rule liftA_inj)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa list)(*strict*)
  apply(clarify)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa)(*strict*)
  apply(case_tac "relnonterms d2 n (Suc (m + n))")
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa)(*strict*)
  apply(clarsimp)
  apply(simp add: equal_front_states_def)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
  apply(subgoal_tac "relnonterms d2 (Suc n) (Suc (m + n)) = a# relnonterms d2 n (Suc (m + n))")
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
  prefer 2
  apply(rule push_adds_to_relnonterms)
      apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
  apply(case_tac "relnonterms d1 n (Suc (m + n))")
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list)(*strict*)
  apply(clarsimp)
  apply(simp add: equal_front_states_def)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
  apply(subgoal_tac "relnonterms d1 (Suc n) (Suc (m + n)) = aa# relnonterms d1 n (Suc (m + n))")
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
  prefer 2
  apply(rule push_adds_to_relnonterms)
      apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista)(*strict*)
  apply(clarsimp)
  apply(simp add: equal_front_states_def)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 A2 A1 B1 B2 y1 y2 a aa ab list ac lista i)(*strict*)
  apply(erule_tac
    x="Suc(Suc i)"
    in allE)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(rule order_antisym)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2)(*strict*)
  apply(case_tac w2)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
  apply(rule_tac
    ?B1.0="B1"
    and ?B2.0="B2"
    in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_contra)
        apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
        apply(force)
       apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
       apply(force)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 B2 w2 y1 y2 a list)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 w2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2)(*strict*)
  apply(case_tac w1)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2)(*strict*)
  apply(clarsimp)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
  apply(rule_tac
    ?B1.0="B2"
    and ?B2.0="B1"
    in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_contra)
       apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
       apply(force)
      apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
      apply(force)
     apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
     apply(force)
    apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
    apply(force)
   apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
   apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
  apply(force)
  apply(rename_tac m n e1 e2 k y z1 z2 z2' z1' A2 A1 B1 w1 B2 y1 y2 a list)(*strict*)
  apply(force)
  done

lemma last_point_where_same_SDPDA_edges_used: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n = Some (pair e1 \<lparr>cfg_conf=(liftB v1) @ teA B1 # (liftA r1)\<rparr>)
  \<Longrightarrow> d2 n = Some (pair e2 \<lparr>cfg_conf=(liftB v2) @ teA B2 # (liftA r2)\<rparr>)
  \<Longrightarrow> n\<le>m
  \<Longrightarrow> d1 m = Some (pair e1' \<lparr>cfg_conf=(liftB v1') @ teA B1' # (liftA r1')\<rparr>)
  \<Longrightarrow> d2 m = Some (pair e2' \<lparr>cfg_conf=(liftB v2') @ teA B2' # (liftA r2')\<rparr>)
  \<Longrightarrow> v1'@x1'=v2'@x2'
  \<Longrightarrow>
  (\<forall>k. Suc 0\<le>k\<and>k\<le>m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k))))
  \<and> v1=v2
  \<and> equal_front_states (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m))
  \<and> equal_stacks (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m))"
  apply(case_tac m)
   apply(clarsimp)
   apply(subgoal_tac "relnonterms d2 0 0 = []")
    prefer 2
    apply(rule relnonterms_triv)
      apply(force)
     apply(force)
    apply(force)
   apply(subgoal_tac "relnonterms d1 0 0 = []")
    prefer 2
    apply(rule relnonterms_triv)
      apply(force)
     apply(force)
    apply(force)
   apply(simp add: cfgLM.derivation_initial_def)
   apply(clarsimp)
   apply(simp add: cfg_initial_configurations_def)
   apply(clarsimp)
   apply(case_tac v2)
    prefer 2
    apply(rename_tac a list)(*strict*)
    apply(clarsimp)
   apply(clarsimp)
   apply(case_tac r2)
    prefer 2
    apply(rename_tac a list)(*strict*)
    apply(clarsimp)
   apply(clarsimp)
   apply(case_tac v1)
    prefer 2
    apply(rename_tac a list)(*strict*)
    apply(clarsimp)
   apply(clarsimp)
   apply(case_tac r1)
    prefer 2
    apply(rename_tac a list)(*strict*)
    apply(clarsimp)
   apply(clarsimp)
   apply(simp add: equal_front_states_def equal_stacks_def Let_def equal_front_state_def equal_stack_def)
  apply(rename_tac nat)(*strict*)
  apply(subgoal_tac " \<forall>k. Suc 0\<le>k\<and>k\<le>m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k))) \<and> v1=v2 \<and> equal_front_states (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m)) \<and> equal_stacks (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m))")
   apply(rename_tac nat)(*strict*)
   apply(clarsimp)
   apply(erule_tac
      x="Suc nat"
      in allE)
   apply(clarsimp)
  apply(rename_tac nat)(*strict*)
  apply(rule last_point_where_same_SDPDA_edges_used_bracketed)
               apply(rename_tac nat)(*strict*)
               apply(force)+
  done

lemma last_point_where_same_SDPDA_edges_used_prime: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n = Some (pair e1 \<lparr>cfg_conf=(liftB v1) @ teA B1 # (liftA r1)\<rparr>)
  \<Longrightarrow> d2 n = Some (pair e2 \<lparr>cfg_conf=(liftB v2) @ teA B2 # (liftA r2)\<rparr>)
  \<Longrightarrow> n\<le>m
  \<Longrightarrow> d1 m = Some (pair e1' \<lparr>cfg_conf=(liftB v1') @ [teA B1']\<rparr>)
  \<Longrightarrow> d2 m = Some (pair e2' \<lparr>cfg_conf=(liftB v2') @ [teA B2']\<rparr>)
  \<Longrightarrow> v1'@x1'=v2'@x2'
  \<Longrightarrow>
  (\<forall>k. Suc 0\<le>k\<and>k\<le>m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k))))
  \<and> v1=v2
  \<and> equal_front_states (B1#r1) (B2#r2)
  \<and> equal_stacks (B1#r1) (B2#r2)"
  apply(subgoal_tac "(\<forall>k. Suc 0\<le>k\<and>k\<le>m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k)))) \<and> v1=v2 \<and> equal_front_states (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m)) \<and> equal_stacks (B1#(relnonterms d1 n m)) (B2#(relnonterms d2 n m))")
   prefer 2
   apply(rule_tac
      r1'="[]"
      and r2'="[]"
      and n="n"
      and m="m"
      and ?d1.0="d1"
      and ?d2.0="d2"
      in last_point_where_same_SDPDA_edges_used)
                apply(force)
               apply(force)
              apply(force)
             apply(force)
            apply(force)
           apply(force)
          apply(force)
         apply(force)
        apply(force)
       apply(force)
      apply(force)
     apply(force)
    apply(force)
   apply(force)
  apply(clarsimp)
  apply(subgoal_tac "relnonterms d1 n m=r1")
   apply(subgoal_tac "relnonterms d2 n m=r2")
    apply(clarsimp)
   apply(thin_tac "\<forall>k. Suc 0 \<le> k \<and> k \<le> m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d2 k)))")
   apply(thin_tac "equal_front_states (B1 # relnonterms d1 n m) (B2 # relnonterms d2 n m)")
   apply(thin_tac "equal_stacks (B1 # relnonterms d1 n m) (B2 # relnonterms d2 n m)")
   apply(thin_tac "relnonterms d1 n m = r1")
   apply(case_tac "n=m")
    apply(clarsimp)
    apply(subgoal_tac "v2'=v2")
     prefer 2
     apply(rule liftB_inj)
     apply(rule_tac v="B2#r2" in split_decide1)
      apply (simp add: setA_liftB)
     apply(force)
    apply(clarsimp)
    apply(case_tac r2)
     prefer 2
     apply(rename_tac a list)(*strict*)
     apply(force)
    apply(clarsimp)
    apply(rule_tac
      ?r1.0="[]"
      in relnonterms_triv)
      apply(force)
     apply(force)
    apply(force)
   apply(simp add: relnonterms_def)
   apply(subgoal_tac "\<exists>k. n+Suc k=m")
    prefer 2
    apply(rule_tac
      x="m-n-Suc 0"
      in exI)
    apply(force)
   apply(clarsimp)
   apply(rename_tac k)(*strict*)
   apply(rename_tac ka)
   apply(rename_tac ka)(*strict*)
   apply(subgoal_tac "maximalSuffix ((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d2 i))) ` set (nat_seq n (Suc (n + ka)))) = []")
    apply(rename_tac ka)(*strict*)
    prefer 2
    apply(rule_tac
      t="((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d2 i))) ` set (nat_seq n (Suc (n + ka))))"
      and s="{[]}\<union>(((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d2 i))) ` set (nat_seq n ((n + ka)))))"
      in ssubst)
     apply(rename_tac ka)(*strict*)
     prefer 2
     apply(rule maximalSuffix_with_empty)
    apply(rename_tac ka)(*strict*)
    apply(rule_tac
      t="nat_seq n (Suc (n + ka))"
      and s="nat_seq n ((n + ka))@[Suc(n+ka)]"
      in ssubst)
     apply(rename_tac ka)(*strict*)
     apply(rule nat_seq_drop_last)
    apply(rename_tac ka)(*strict*)
    apply(rule_tac
      t="{[]}"
      and s="(\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d2 i))) ` {Suc(n+ka)}"
      in ssubst)
     apply(rename_tac ka)(*strict*)
     apply(clarsimp)
     apply(simp add: get_configuration_def)
     apply(rule sym)
     apply(rule_tac
      t="liftB v2' @ [teA B2']"
      and s="liftB v2' @ teA B2' # liftA []"
      in ssubst)
      apply(rename_tac ka)(*strict*)
      apply(force)
     apply(rename_tac ka)(*strict*)
     apply (metis SPLIT_tail)
    apply(rename_tac ka)(*strict*)
    apply(force)
   apply(rename_tac ka)(*strict*)
   apply(clarsimp)
   apply(simp add: get_configuration_def)
   apply(simp add: right_quotient_word_def)
   apply(rule_tac
      t="nat_seq n (Suc (n + ka))"
      and s="n#nat_seq (Suc n) (Suc (n + ka))"
      in ssubst)
    apply(rename_tac ka)(*strict*)
    apply (metis le_SucI le_add1 nat_seq_pullout)
   apply(rename_tac ka)(*strict*)
   apply(clarsimp)
   apply (metis SPLIT_tail)
  apply(thin_tac "\<forall>k. Suc 0 \<le> k \<and> k \<le> m \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the (get_label (d2 k)))")
  apply(thin_tac "equal_front_states (B1 # relnonterms d1 n m) (B2 # relnonterms d2 n m)")
  apply(thin_tac "equal_stacks (B1 # relnonterms d1 n m) (B2 # relnonterms d2 n m)")
  apply(case_tac "n=m")
   apply(clarsimp)
   apply(subgoal_tac "v1'=v2")
    prefer 2
    apply(rule liftB_inj)
    apply(rule_tac v="B1#r1" and r="[]" in split_decide1)
     apply (simp add: setA_liftB)
    apply(force)
   apply(clarsimp)
   apply(case_tac r1)
    prefer 2
    apply(rename_tac a list)(*strict*)
    apply(force)
   apply(clarsimp)
   apply(rule_tac
      ?r1.0="[]"
      in relnonterms_triv)
     apply(force)
    apply(force)
   apply(force)
  apply(simp add: relnonterms_def)
  apply(subgoal_tac "\<exists>k. n+Suc k=m")
   prefer 2
   apply(rule_tac
      x="m-n-Suc 0"
      in exI)
   apply(force)
  apply(clarsimp)
  apply(rename_tac k)(*strict*)
  apply(rename_tac ka)
  apply(rename_tac ka)(*strict*)
  apply(subgoal_tac "maximalSuffix ((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d1 i))) ` set (nat_seq n (Suc (n + ka)))) = []")
   apply(rename_tac ka)(*strict*)
   prefer 2
   apply(rule_tac
      t="((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d1 i))) ` set (nat_seq n (Suc (n + ka))))"
      and s="{[]}\<union>(((\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d1 i))) ` set (nat_seq n ((n + ka)))))"
      in ssubst)
    apply(rename_tac ka)(*strict*)
    prefer 2
    apply(rule maximalSuffix_with_empty)
   apply(rename_tac ka)(*strict*)
   apply(rule_tac
      t="nat_seq n (Suc (n + ka))"
      and s="nat_seq n ((n + ka))@[Suc(n+ka)]"
      in ssubst)
    apply(rename_tac ka)(*strict*)
    apply(rule nat_seq_drop_last)
   apply(rename_tac ka)(*strict*)
   apply(rule_tac
      t="{[]}"
      and s="(\<lambda>c. THE r. \<exists>w B. cfg_conf c = liftB w @ teA B # liftA r) ` (\<lambda>i. the (get_configuration (d1 i))) ` {Suc(n+ka)}"
      in ssubst)
    apply(rename_tac ka)(*strict*)
    apply(clarsimp)
    apply(simp add: get_configuration_def)
    apply(rule sym)
    apply(rule_tac
      t="liftB v1' @ [teA B1']"
      and s="liftB v1' @ teA B1' # liftA []"
      in ssubst)
     apply(rename_tac ka)(*strict*)
     apply(force)
    apply(rename_tac ka)(*strict*)
    apply (metis SPLIT_tail)
   apply(rename_tac ka)(*strict*)
   apply(force)
  apply(rename_tac ka)(*strict*)
  apply(clarsimp)
  apply(simp add: get_configuration_def)
  apply(simp add: right_quotient_word_def)
  apply(rule_tac
      t="nat_seq n (Suc (n + ka))"
      and s="n#nat_seq (Suc n) (Suc (n + ka))"
      in ssubst)
   apply(rename_tac ka)(*strict*)
   apply (metis le_SucI le_add1 nat_seq_pullout)
  apply(rename_tac ka)(*strict*)
  apply(clarsimp)
  apply (metis SPLIT_tail)
  done

lemma pre_final_conf_has_nonterminal_at_ending: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> \<not> duplicate_markingH G
  \<Longrightarrow> cfgLM.derivation_initial G' d
  \<Longrightarrow> d n = Some (pair e c)
  \<Longrightarrow> d (Suc n) = Some (pair e' c')
  \<Longrightarrow> setA (cfg_conf c')={}
  \<Longrightarrow> \<exists>q A. cfg_conf c=(cfg_conf c')@[teA (cons_l2   q A)] \<and> q \<in> epda_marking G"
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d n = Some (pair e1 c1) \<and> d (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   prefer 2
   apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(force)
   apply(force)
  apply(clarsimp)
  apply(rename_tac e2)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac e2 l r)(*strict*)
  apply(case_tac c)
  apply(rename_tac e2 l r cfg_confa)(*strict*)
  apply(case_tac c')
  apply(rename_tac e2 l r cfg_confa cfg_confaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac e2 l r)(*strict*)
  apply(subgoal_tac "setA (l @ teA (prod_lhs e2) # r)={} \<or> (\<exists>w1 w2 B. (l @ teA (prod_lhs e2) # r)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac e2 l r)(*strict*)
   prefer 2
   apply(rule_tac
      d="d"
      and G="F_SDPDA_TO_CFG_STD G"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac e2 l r)(*strict*)
       apply(rule F_SDPDA_TO_CFG_STD__makes_CFG)
       apply(force)
      apply(rename_tac e2 l r)(*strict*)
      apply(rule_tac
      G="G"
      in sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(simp add: cfg_sub_def)
     apply(rename_tac e2 l r)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac e2 l r)(*strict*)
    apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
      apply(rename_tac e2 l r)(*strict*)
      apply(force)
     apply(rename_tac e2 l r)(*strict*)
     apply(force)
    apply(rename_tac e2 l r)(*strict*)
    apply(force)
   apply(rename_tac e2 l r)(*strict*)
   apply(force)
  apply(rename_tac e2 l r)(*strict*)
  apply(erule disjE)
   apply(rename_tac e2 l r)(*strict*)
   apply (metis elemInsetA equals0D)
  apply(rename_tac e2 l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac e2 l r w1 w2 B)(*strict*)
  apply(subgoal_tac "\<exists>l'. liftB l'=l")
   apply(rename_tac e2 l r w1 w2 B)(*strict*)
   prefer 2
   apply(rule_tac
      x="filterB l"
      in exI)
   apply (rule liftBDeConv2)
   apply(force)
  apply(rename_tac e2 l r w1 w2 B)(*strict*)
  apply(clarsimp)
  apply(rename_tac e2 r w1 w2 B l')(*strict*)
  apply(subgoal_tac "liftB l'=liftB w1")
   apply(rename_tac e2 r w1 w2 B l')(*strict*)
   prefer 2
   apply(rule_tac
      v="B#w2"
      and A="prod_lhs e2"
      and r="r"
      in split_decide1)
    apply(rename_tac e2 r w1 w2 B l')(*strict*)
    apply(force)
   apply(rename_tac e2 r w1 w2 B l')(*strict*)
   apply(simp add: liftA_commutes_over_concat)
  apply(rename_tac e2 r w1 w2 B l')(*strict*)
  apply(clarsimp)
  apply(rename_tac e2 w1 w2 l')(*strict*)
  apply(subgoal_tac "l'=w1")
   apply(rename_tac e2 w1 w2 l')(*strict*)
   prefer 2
   apply(rule liftB_inj)
   apply(force)
  apply(rename_tac e2 w1 w2 l')(*strict*)
  apply(clarsimp)
  apply(rename_tac e2 w1 w2)(*strict*)
  apply(case_tac w2)
   apply(rename_tac e2 w1 w2)(*strict*)
   prefer 2
   apply(rename_tac e2 w1 w2 a list)(*strict*)
   apply(subgoal_tac "False")
    apply(rename_tac e2 w1 w2 a list)(*strict*)
    apply(force)
   apply(rename_tac e2 w1 w2 a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac e2 w1 a list)(*strict*)
   apply(subgoal_tac "a \<in> setA (liftB w1 @ prod_rhs e2 @ teA a # liftA list)")
    apply(rename_tac e2 w1 a list)(*strict*)
    apply(force)
   apply(rename_tac e2 w1 a list)(*strict*)
   apply(simp add: setAConcat)
  apply(rename_tac e2 w1 w2)(*strict*)
  apply(clarsimp)
  apply(rename_tac e2 w1)(*strict*)
  apply(subgoal_tac "l3_l2_separation_ALT [prod_lhs e2]")
   apply(rename_tac e2 w1)(*strict*)
   prefer 2
   apply(rule_tac
      n="n"
      and d="d"
      in cfgLM_reachable_conf_isl3_l2_separation_ALT_stack)
        apply(rename_tac e2 w1)(*strict*)
        apply(force)
       apply(rename_tac e2 w1)(*strict*)
       apply(force)
      apply(rename_tac e2 w1)(*strict*)
      apply(force)
     apply(rename_tac e2 w1)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac e2 w1)(*strict*)
       apply(force)
      apply(rename_tac e2 w1)(*strict*)
      apply(force)
     apply(rename_tac e2 w1)(*strict*)
     apply(force)
    apply(rename_tac e2 w1)(*strict*)
    apply(force)
   apply(rename_tac e2 w1)(*strict*)
   apply(clarsimp)
   apply(force)
  apply(rename_tac e2 w1)(*strict*)
  apply(simp add: l3_l2_separation_ALT_def)
  apply(case_tac e2)
  apply(rename_tac e2 w1 prod_lhsa prod_rhsa)(*strict*)
  apply(rename_tac A w)
  apply(rename_tac e2 w1 A w)(*strict*)
  apply(clarsimp)
  apply(rename_tac w1 A w)(*strict*)
  apply(case_tac A)
   apply(rename_tac w1 A w q b)(*strict*)
   prefer 2
   apply(rename_tac w1 A w q1 b q2)(*strict*)
   apply(force)
  apply(rename_tac w1 A w q b)(*strict*)
  apply(clarsimp)
  apply(rename_tac w1 w q b)(*strict*)
  apply(simp add: setAConcat)
  apply(thin_tac "setA (liftB w1) = {}")
  apply(subgoal_tac "LR1ProdForm G'")
   apply(rename_tac w1 w q b)(*strict*)
   prefer 2
   apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
   apply(force)
  apply(rename_tac w1 w q b)(*strict*)
  apply(simp add: LR1ProdForm_def)
  apply(erule_tac
      x="\<lparr>prod_lhs = cons_l2 q b, prod_rhs = w\<rparr>"
      in ballE)
   apply(rename_tac w1 w q b)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac w1 w q b)(*strict*)
  apply(clarsimp)
  apply(case_tac w)
   apply(rename_tac w1 w q b)(*strict*)
   apply(clarsimp)
   apply(rename_tac w1 q b)(*strict*)
   prefer 2
   apply(rename_tac w1 w q b a list)(*strict*)
   apply(erule disjE)
    apply(rename_tac w1 w q b a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac w1 w q b a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac w1 q b a list ba q1 q2 q3 A1)(*strict*)
   apply(erule disjE)
    apply(rename_tac w1 q b a list ba q1 q2 q3 A1)(*strict*)
    apply(clarsimp)
   apply(rename_tac w1 q b a list ba q1 q2 q3 A1)(*strict*)
   apply(clarsimp)
   apply(rename_tac w1 q b a list q1 q2 q3 A1 A2)(*strict*)
   apply(erule disjE)
    apply(rename_tac w1 q b a list q1 q2 q3 A1 A2)(*strict*)
    apply(clarsimp)
   apply(rename_tac w1 q b a list q1 q2 q3 A1 A2)(*strict*)
   apply(clarsimp)
  apply(rename_tac w1 q b)(*strict*)
  apply(subgoal_tac "\<lparr>prod_lhs = cons_l2 q b, prod_rhs = []\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3 G \<union> F_SDPDA_TO_CFG_STD__edges_l2 G")
   apply(rename_tac w1 q b)(*strict*)
   prefer 2
   apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(clarsimp)
   apply(force)
  apply(rename_tac w1 q b)(*strict*)
  apply(clarsimp)
  apply(erule disjE)
   apply(rename_tac w1 q b)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(erule disjE)
    apply(rename_tac w1 q b)(*strict*)
    apply(clarsimp)
    apply(rename_tac w1 q b x)(*strict*)
    apply(case_tac "edge_event x")
     apply(rename_tac w1 q b x)(*strict*)
     apply(clarsimp)
    apply(rename_tac w1 q b x a)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(rename_tac w1 q b)(*strict*)
   apply(erule disjE)
    apply(rename_tac w1 q b)(*strict*)
    apply(clarsimp)
    apply(rename_tac w1 q b x)(*strict*)
    apply(case_tac "edge_push x")
     apply(rename_tac w1 q b x)(*strict*)
     apply(clarsimp)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(rename_tac w1 q b x a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac w1 q b)(*strict*)
   apply(clarsimp)
   apply(rename_tac w1 q b x)(*strict*)
   apply(case_tac "edge_push x")
    apply(rename_tac w1 q b x)(*strict*)
    apply(clarsimp)
   apply(rename_tac w1 q b x a list)(*strict*)
   apply(clarsimp)
   apply(case_tac "edge_event x")
    apply(rename_tac w1 q b x a list)(*strict*)
    apply(clarsimp)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_def F_SDPDA_TO_CFG_STD__edges_l3_read_def F_SDPDA_TO_CFG_STD__edges_l3_pop_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
   apply(rename_tac w1 q b x a list aa)(*strict*)
   apply(clarsimp)
  apply(rename_tac w1 q b)(*strict*)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(erule disjE)
   apply(rename_tac w1 q b)(*strict*)
   apply(clarsimp)
   apply(rename_tac w1 q b x)(*strict*)
   apply(case_tac "edge_event x")
    apply(rename_tac w1 q b x)(*strict*)
    apply(clarsimp)
   apply(rename_tac w1 q b x a)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(rename_tac w1 q b)(*strict*)
  apply(erule disjE)
   apply(rename_tac w1 q b)(*strict*)
   apply(clarsimp)
  apply(rename_tac w1 q b)(*strict*)
  apply(clarsimp)
  apply(rename_tac w1 q b x)(*strict*)
  apply(case_tac "edge_push x")
   apply(rename_tac w1 q b x)(*strict*)
   apply(clarsimp)
  apply(rename_tac w1 q b x a list)(*strict*)
  apply(clarsimp)
  apply(case_tac "edge_event x")
   apply(rename_tac w1 q b x a list)(*strict*)
   apply(clarsimp)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_def F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l2_final_def F_SDPDA_TO_CFG_STD__edges_l2_push_def)
  apply(rename_tac w1 q b x a list aa)(*strict*)
  apply(clarsimp)
  done

lemma cfgLM_derivation_coincide_8: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n1 = Some (pair e1 \<lparr>cfg_conf=liftB v\<rparr>)
  \<Longrightarrow> d2 n2 = Some (pair e2 \<lparr>cfg_conf=liftB v\<rparr>)
  \<Longrightarrow> n1\<le>n2
  \<Longrightarrow> n1=n2"
  apply(case_tac n1)
   apply(simp add: cfgLM.derivation_initial_def)
   apply(clarsimp)
   apply(simp add: cfg_initial_configurations_def)
   apply(clarsimp)
   apply(case_tac v)
    apply(clarsimp)
   apply(rename_tac a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac nat)(*strict*)
  apply(clarsimp)
  apply(case_tac n2)
   apply(rename_tac nat)(*strict*)
   apply(clarsimp)
  apply(rename_tac nat nata)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2)
  apply(rename_tac n1 n2)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d1 n1 = Some (pair e1 c1) \<and> SSd (Suc SSn) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2" for SSd SSn)
   apply(rename_tac n1 n2)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n1"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n1 n2)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n1 n2)(*strict*)
    apply(force)
   apply(rename_tac n1 n2)(*strict*)
   apply(force)
  apply(rename_tac n1 n2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e2a c1)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e2a c1 l r)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d2 n2 = Some (pair e1 c1) \<and> SSd (Suc SSn) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2" for SSd SSn)
   apply(rename_tac n1 n2 e1 e2a c1 l r)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n2"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n1 n2 e1 e2a c1 l r)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n1 n2 e1 e2a c1 l r)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e2a c1 l r)(*strict*)
   apply(force)
  apply(rename_tac n1 n2 e1 e2a c1 l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
  apply(subgoal_tac "\<exists>q A. cfg_conf c1=(cfg_conf \<lparr>cfg_conf = la @ prod_rhs e2a @ ra\<rparr>)@[teA (cons_l2   q A)] \<and> q \<in> epda_marking G")
   apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
   prefer 2
   apply(rule_tac
      d="d1"
      in pre_final_conf_has_nonterminal_at_ending)
           apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
           apply(force)
          apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
          apply(force)
         apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
         apply(force)
        apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
        apply(force)
       apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
       apply(rule duplicate_marking_to_duplicate_markingH)
        apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="la @ prod_rhs e2a @ ra"
      and s="liftB v"
      in ssubst)
    apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
   apply (metis setA_liftB)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
  apply(subgoal_tac "\<exists>q A. cfg_conf c1a=(cfg_conf \<lparr>cfg_conf = l @ prod_rhs e2 @ r\<rparr>)@[teA (cons_l2   q A)] \<and> q \<in> epda_marking G")
   apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      in pre_final_conf_has_nonterminal_at_ending)
           apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
           apply(force)
          apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
          apply(force)
         apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
         apply(force)
        apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
        apply(force)
       apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
       apply(rule duplicate_marking_to_duplicate_markingH)
        apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="l @ prod_rhs e2 @ r"
      and s="liftB v"
      in ssubst)
    apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
   apply (metis setA_liftB)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa)(*strict*)
  apply(case_tac e2)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa prod_lhsa prod_rhsa)(*strict*)
  apply(case_tac e2a)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa prod_lhsa prod_rhsa prod_lhsaa prod_rhsaa)(*strict*)
  apply(rename_tac C1 r1 C2 r2)
  apply(rename_tac n1 n2 e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
  apply(case_tac r2)
   apply(rename_tac n1 n2 e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
   prefer 2
   apply(rename_tac n1 n2 e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2 a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac n1 n2 e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(case_tac c1a)
  apply(rename_tac n1 n2 e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 c1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(case_tac c1)
  apply(rename_tac n1 n2 e1 c1 l r e1a la ra q A qa Aa C1 r1 C2 cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(case_tac r1)
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
   prefer 2
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 r1 C2 a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
   apply(case_tac r)
    apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list aa lista)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. r=w'@[x']")
    apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list aa lista)(*strict*)
    prefer 2
    apply(rule_tac NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list aa lista)(*strict*)
   apply(thin_tac "r=aa#lista")
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 l e1a la ra q A qa Aa C1 C2 a list w')(*strict*)
   apply(case_tac ra)
    apply(rename_tac n1 n2 e1 l e1a la ra q A qa Aa C1 C2 a list w')(*strict*)
    apply(clarsimp)
    apply(rename_tac n1 n2 e1 l e1a q A qa Aa C1 a list w')(*strict*)
    apply (metis setA_liftB elemInsetA ex_in_conv)
   apply(rename_tac n1 n2 e1 l e1a la ra q A qa Aa C1 C2 a list w' aa lista)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. ra=w'@[x']")
    apply(rename_tac n1 n2 e1 l e1a la ra q A qa Aa C1 C2 a list w' aa lista)(*strict*)
    prefer 2
    apply(rule_tac
      n="length lista"
      in NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n1 n2 e1 l e1a la ra q A qa Aa C1 C2 a list w' aa lista)(*strict*)
   apply(thin_tac "ra=aa#lista")
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 l e1a la qa Aa C1 C2 a list w' w'a)(*strict*)
   apply (metis setA_liftB elemInsetA ex_in_conv)
  apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2)(*strict*)
  apply(case_tac r)
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2)(*strict*)
   prefer 2
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. r=w'@[x']")
    apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
    prefer 2
    apply(rule_tac NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
   apply(thin_tac "r=a#list")
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 l e1a la ra q A qa Aa C1 C2 w')(*strict*)
   apply (metis setA_liftB elemInsetA ex_in_conv)
  apply(rename_tac n1 n2 e1 l r e1a la ra q A qa Aa C1 C2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a la ra q A qa Aa C2)(*strict*)
  apply(case_tac ra)
   apply(rename_tac n1 n2 e1 e1a la ra q A qa Aa C2)(*strict*)
   prefer 2
   apply(rename_tac n1 n2 e1 e1a la ra q A qa Aa C2 a list)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. ra=w'@[x']")
    apply(rename_tac n1 n2 e1 e1a la ra q A qa Aa C2 a list)(*strict*)
    prefer 2
    apply(rule_tac NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a la ra q A qa Aa C2 a list)(*strict*)
   apply(thin_tac "ra=a#list")
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 e1a la q A qa Aa C2 w')(*strict*)
   apply (metis setA_liftB elemInsetA ex_in_conv)
  apply(rename_tac n1 n2 e1 e1a la ra q A qa Aa C2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
  apply(thin_tac "setA (liftB v) = {}")
  apply(thin_tac "\<lparr>prod_lhs = cons_l2 q A, prod_rhs = []\<rparr> \<in> cfg_productions G'")
  apply(thin_tac "\<lparr>prod_lhs = cons_l2 qa Aa, prod_rhs = []\<rparr> \<in> cfg_productions G'")
  apply(subgoal_tac "\<exists>dL. epdaH.derivation_initial SSG1 dL \<and> (\<forall>k\<le>SSn. \<exists>eL cL eR cR. (dL k = Some (pair eL cL) \<and> SSdR k = Some (pair eR cR)) \<and> (case eR of None \<Rightarrow> True | Some eR' \<Rightarrow> eR' \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG1) (epda_gamma SSG1) \<longrightarrow> (case eL of None \<Rightarrow> False | Some eL' \<Rightarrow> eL' \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 SSG1 eR')) \<and> (setA (cfg_conf cR) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma SSG1 \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL cR w)))" for SSn SSdR SSG1)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
   prefer 2
   apply(rule_tac ?G1.0="G" and ?G2.0="F_SDPDA_TO_CFG_STD G" and dR="d1" and n="n1" in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_back_hlp_prime_prime)
       apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
   apply(clarsimp)
   apply(simp add: setAConcat)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
  apply(subgoal_tac "\<exists>dL. epdaH.derivation_initial SSG1 dL \<and> (\<forall>k\<le>SSn. \<exists>eL cL eR cR. (dL k = Some (pair eL cL) \<and> SSdR k = Some (pair eR cR)) \<and> (case eR of None \<Rightarrow> True | Some eR' \<Rightarrow> eR' \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG1) (epda_gamma SSG1) \<longrightarrow> (case eL of None \<Rightarrow> False | Some eL' \<Rightarrow> eL' \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 SSG1 eR')) \<and> (setA (cfg_conf cR) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma SSG1 \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL cR w)))" for  SSn SSdR SSG1)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
   prefer 2
   apply(rule_tac ?G1.0="G" and ?G2.0="F_SDPDA_TO_CFG_STD G" and dR="d2" and n="n2" in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_back_hlp_prime_prime)
       apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
     apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
       apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL)(*strict*)
   apply(simp add: setAConcat)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa)(*strict*)
  apply(erule exE)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL)(*strict*)
  apply(rename_tac dL1)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1)(*strict*)
  apply(erule exE)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL)(*strict*)
  apply(rename_tac dL2)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2)(*strict*)
  apply(clarsimp)
  apply(erule_tac
      x="n1"
      and P="\<lambda>k. k\<le>n1 \<longrightarrow> (\<exists>eL cL. dL1 k = Some (pair eL cL) \<and> (\<exists>eR cR. d1 k = Some (pair eR cR) \<and> (case eR of None \<Rightarrow> True | Some eR' \<Rightarrow> eR' \<notin> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking G) (epda_gamma G) \<longrightarrow> (case eL of None \<Rightarrow> False | Some eL' \<Rightarrow> eL' \<in> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G eR')) \<and> (setA (cfg_conf cR) \<noteq> {} \<longrightarrow> (\<exists>w. set w \<subseteq> epda_gamma G \<and> cL = F_SDPDA_TO_CFG_STD__configuration_basic_RL cR w))))"
      in allE)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL cL)(*strict*)
  apply(erule_tac
      x="n2"
      in allE)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL cL eLa cLa)(*strict*)
  apply(erule_tac
      P="setA (liftB v @ [teA (cons_l2   q A)]) \<noteq> {}"
      in impE)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL cL eLa cLa)(*strict*)
   apply(simp add: setAConcat)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL cL eLa cLa)(*strict*)
  apply(erule impE)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL cL eLa cLa)(*strict*)
   apply(simp add: setAConcat)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL cL eLa cLa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(subgoal_tac "n1=n2 \<and> (\<forall>i\<le>n1. dL1 i = dL2 i)")
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(force)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(rule EDPDA_derivations_coincide4)
            apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
            apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
            apply(force)
           apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
           apply(simp add: valid_simple_dpda_def valid_dpda_def)
          apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
          apply(rule duplicate_marking_to_duplicate_markingH)
           apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
           apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
          apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
          apply(force)
         apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
         apply(force)
        apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
        apply(force)
       apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
      defer
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     defer
     apply(simp add: F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
     apply(rule_tac
      t="(THE w. \<exists>va. liftB v @ [teA (cons_l2   q A)] = liftB w @ liftA va)"
      and s="v"
      in ssubst)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
      apply(rule_tac
      t="liftB v @ [teA (cons_l2   q A)]"
      and s="liftB v @ teA (cons_l2   q A) # (liftA [])"
      in ssubst)
       apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
       apply(force)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
      apply (metis liftA.simps(1) split2)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply(rule sym)
     apply(rule_tac
      t="liftB v @ [teA (cons_l2   qa Aa)]"
      and s="liftB v @ teA (cons_l2   qa Aa) # (liftA [])"
      in ssubst)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply (metis liftA.simps(1) split2)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(simp add: epdaH_marking_configurations_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
   apply(rule_tac
      t="liftB v @ [teA (cons_l2   q A)]"
      and s="liftB v @ teA (cons_l2   q A) # (liftA [])"
      in ssubst)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(rule_tac
      t="(THE va. \<exists>w. liftB v @ teA (cons_l2   q A) # liftA [] = liftB w @ liftA va)"
      and s="cons_l2 q A#[]"
      in ssubst)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply (metis liftA.simps(1) split1)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(rule_tac
      t="(THE w. \<exists>va. liftB v @ teA (cons_l2   q A) # liftA [] = liftB w @ liftA va)"
      and s="v"
      in ssubst)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply (metis liftA.simps(1) split2)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(clarsimp)
   apply(thin_tac "cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'")
   apply(subgoal_tac "\<lparr>cfg_conf = liftB v @ [teA (cons_l2   q A)]\<rparr> \<in> cfg_configurations G'")
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    prefer 2
    apply(rule_tac
      d="d1"
      in cfgLM.belongs_configurations)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply(rule cfgLM.derivation_initial_belongs)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
      apply(force)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(simp add: cfg_configurations_def)
   apply(clarsimp)
   apply(simp add: setAConcat)
   apply(simp add: setBConcat)
   apply(simp add: epdaH_configurations_def)
   apply(clarsimp)
   apply(subgoal_tac "setB (liftB v) = set v")
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    prefer 2
    apply(rule sym)
    apply (rule set_setBliftB)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(rule conjI)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(rule conjI)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(subgoal_tac "cons_l2 q A \<in> {cons_l2 q A| q A. q \<in> epda_states G \<and> A \<in> epda_gamma G} \<union>{cons_l3 q1 A q2| q1 A q2. q1 \<in> epda_states G \<and> q2 \<in> epda_states G \<and> A \<in> epda_gamma G}")
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     prefer 2
     apply(rule_tac
      A="cfg_nonterminals G'"
      in set_mp)
      apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
      apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(clarsimp)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
   apply(clarsimp)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa x)(*strict*)
   apply(force)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(simp add: epdaH_marking_configurations_def F_SDPDA_TO_CFG_STD__configuration_basic_RL_def Let_def)
  apply(rule_tac
      t="liftB v @ [teA (cons_l2   qa Aa)]"
      and s="liftB v @ teA (cons_l2   qa Aa) # (liftA [])"
      in ssubst)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(force)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(rule_tac
      t="(THE va. \<exists>w. liftB v @ teA (cons_l2   qa Aa) # liftA [] = liftB w @ liftA va)"
      and s="cons_l2 qa Aa#[]"
      in ssubst)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply (metis liftA.simps(1) split1)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(rule_tac
      t="(THE w. \<exists>va. liftB v @ teA (cons_l2   qa Aa) # liftA [] = liftB w @ liftA va)"
      and s="v"
      in ssubst)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply (metis liftA.simps(1) split2)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(clarsimp)
  apply(thin_tac "cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'")
  apply(subgoal_tac "\<lparr>cfg_conf = liftB v @ [teA (cons_l2   qa Aa)]\<rparr> \<in> cfg_configurations G'")
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      in cfgLM.belongs_configurations)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(rule cfgLM.derivation_initial_belongs)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply(force)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(force)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(simp add: cfg_configurations_def)
  apply(clarsimp)
  apply(simp add: setAConcat)
  apply(simp add: setBConcat)
  apply(simp add: epdaH_configurations_def)
  apply(clarsimp)
  apply(subgoal_tac "setB (liftB v) = set v")
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   prefer 2
   apply(rule sym)
   apply (rule set_setBliftB)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(rule conjI)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def valid_epda_def)
   apply(force)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(rule conjI)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(subgoal_tac "cons_l2 qa Aa \<in> {cons_l2 q A| q A. q \<in> epda_states G \<and> A \<in> epda_gamma G} \<union>{cons_l3 q1 A q2| q1 A q2. q1 \<in> epda_states G \<and> q2 \<in> epda_states G \<and> A \<in> epda_gamma G}")
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    prefer 2
    apply(rule_tac
      A="cfg_nonterminals G'"
      in set_mp)
     apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
    apply(force)
   apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
   apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa)(*strict*)
  apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
  apply(clarsimp)
  apply(rename_tac n1 n2 e1 e1a q A qa Aa dL1 dL2 eL eLa w wa x)(*strict*)
  apply(force)
  done

lemma cfgLM_derivation_coincide_6: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 (Suc n) = Some (pair (Some \<lparr>prod_lhs = cons_l2 q A, prod_rhs = []\<rparr>) \<lparr>cfg_conf = liftB v\<rparr>)
  \<Longrightarrow> d2 (Suc n) = Some (pair (Some \<lparr>prod_lhs = cons_l2 qa Aa, prod_rhs = []\<rparr>) \<lparr>cfg_conf = liftB v\<rparr>)
  \<Longrightarrow> i \<le> n
  \<Longrightarrow> d1 n = Some (pair e1 \<lparr>cfg_conf = liftB v @ [teA (cons_l2   q A)]\<rparr>)
  \<Longrightarrow> d2 n = Some (pair e1a \<lparr>cfg_conf = liftB v @ [teA (cons_l2   qa Aa)]\<rparr>)
  \<Longrightarrow> cfg_conf(the(get_configuration(d1 (n - i)))) = cfg_conf(the(get_configuration(d2 (n - i))))"
  apply(induct i)
   apply(clarsimp)
   apply(simp add: get_configuration_def)
   apply(subgoal_tac "(\<forall>k. Suc 0\<le>k\<and>k\<le>n \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k)))) \<and> v=v \<and> equal_front_states ((cons_l2 q A)#[]) (cons_l2 qa Aa#[]) \<and> equal_stacks ((cons_l2 q A)#[]) (cons_l2 qa Aa#[])")
    prefer 2
    apply(rule_tac
      n="n"
      and ?d1.0="d1"
      and ?d2.0="d2"
      and m="n"
      in last_point_where_same_SDPDA_edges_used_prime)
                 apply(force)
                apply(force)
               apply(force)
              apply(force)
             apply(force)
            apply(force)
           apply(force)
          apply(force)
         apply(force)
        apply(force)
       apply(force)
      apply(force)
     apply(force)
    apply(force)
   apply(clarsimp)
   apply(simp add: equal_front_states_def equal_stacks_def Let_def equal_front_state_def equal_stack_def)
  apply(rename_tac i)(*strict*)
  apply(clarsimp)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d1 (n-Suc i) = Some (pair e1 c1) \<and> SSd (Suc SSn) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2" for SSd SSn)
   apply(rename_tac i)(*strict*)
   prefer 2
   apply(rule_tac
      m="n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac i)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac i)(*strict*)
    apply(force)
   apply(rename_tac i)(*strict*)
   apply(force)
  apply(rename_tac i)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c1 c2)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c1 c2 l r)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d2 (n-Suc i) = Some (pair e1 c1) \<and> SSd (Suc SSn) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2" for SSd SSn)
   apply(rename_tac i e1b e2 c1 c2 l r)(*strict*)
   prefer 2
   apply(rule_tac
      m="n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac i e1b e2 c1 c2 l r)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac i e1b e2 c1 c2 l r)(*strict*)
    apply(force)
   apply(rename_tac i e1b e2 c1 c2 l r)(*strict*)
   apply(force)
  apply(rename_tac i e1b e2 c1 c2 l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a c1a c2a)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a c1a c2a la ra)(*strict*)
  apply(case_tac c2a)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a c1a c2a la ra cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a c1a la ra)(*strict*)
  apply(case_tac c1a)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a c1a la ra cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a la ra)(*strict*)
  apply(case_tac c1)
  apply(rename_tac i e1b e2 c1 c2 l r e1aa e2a la ra cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 c2 l r e1aa e2a la ra)(*strict*)
  apply(case_tac c2)
  apply(rename_tac i e1b e2 c2 l r e1aa e2a la ra cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 l r e1aa e2a la ra)(*strict*)
  apply(simp add: get_configuration_def)
  apply(subgoal_tac "Suc (n - Suc i) = n-i")
   apply(rename_tac i e1b e2 l r e1aa e2a la ra)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac i e1b e2 l r e1aa e2a la ra)(*strict*)
  apply(clarsimp)
  apply(thin_tac "Suc (n - Suc i) = n - i")
  apply(subgoal_tac "\<exists>la'. liftB la' = la")
   apply(rename_tac i e1b e2 l r e1aa e2a la ra)(*strict*)
   prefer 2
   apply(rule_tac
      x="filterB la"
      in exI)
   apply (metis liftBDeConv2)
  apply(rename_tac i e1b e2 l r e1aa e2a la ra)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 l r e1aa e2a ra la')(*strict*)
  apply(thin_tac "setA (liftB la') = {}")
  apply(subgoal_tac "\<exists>l'. liftB l' = l")
   apply(rename_tac i e1b e2 l r e1aa e2a ra la')(*strict*)
   prefer 2
   apply(rule_tac
      x="filterB l"
      in exI)
   apply (metis liftBDeConv2)
  apply(rename_tac i e1b e2 l r e1aa e2a ra la')(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e2 r e1aa e2a ra la' l')(*strict*)
  apply(thin_tac "setA (liftB l') = {}")
  apply(case_tac e2)
  apply(rename_tac i e1b e2 r e1aa e2a ra la' l' prod_lhsa prod_rhsa)(*strict*)
  apply(case_tac e2a)
  apply(rename_tac i e1b e2 r e1aa e2a ra la' l' prod_lhsa prod_rhsa prod_lhsaa prod_rhsaa)(*strict*)
  apply(rename_tac C1 w1 C2 w2)
  apply(rename_tac i e1b e2 r e1aa e2a ra la' l' C1 w1 C2 w2)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
  apply(subgoal_tac "setA (liftB l' @ teA C1 # r)={} \<or> (\<exists>w1 w2 B. (liftB l' @ teA C1 # r)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
   prefer 2
   apply(rule_tac
      d="d1"
      and n="n-Suc i"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
       apply(force)
      apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
    apply(force)
   apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
   apply(force)
  apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
  apply(erule disjE)
   apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
   apply (metis elemInsetA emptyE)
  apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2 w1a w2a B)(*strict*)
  apply(subgoal_tac "l'=w1a")
   apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2 w1a w2a B)(*strict*)
   prefer 2
   apply(rule liftB_inj)
   apply(rule_tac
      v="B#w2a"
      in split_decide1)
    apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2 w1a w2a B)(*strict*)
    apply(metis setA_liftB)
   apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2 w1a w2a B)(*strict*)
   apply(force)
  apply(rename_tac i e1b r e1aa ra la' l' C1 w1 C2 w2 w1a w2a B)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
  apply(subgoal_tac "setA (liftB la' @ teA C2 # ra)={} \<or> (\<exists>w1 w2 B. (liftB la' @ teA C2 # ra)=(liftB w1)@teA B#(liftA w2))")
   apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      and n="n-Suc i"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
       apply(force)
      apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
    apply(force)
   apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
  apply(erule disjE)
   apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
   apply (metis elemInsetA emptyE)
  apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B w1b w2b Ba)(*strict*)
  apply(subgoal_tac "la'=w1b")
   apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B w1b w2b Ba)(*strict*)
   prefer 2
   apply(rule liftB_inj)
   apply(rule_tac
      v="Ba#w2b"
      in split_decide1)
    apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B w1b w2b Ba)(*strict*)
    apply(metis setA_liftB)
   apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B w1b w2b Ba)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa ra la' w1 C2 w2 w1a w2a B w1b w2b Ba)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
  apply(subgoal_tac "setA (liftB w1b @ w2 @ liftA w2b)={} \<or> (\<exists>w1X w2X BX. (liftB w1b @ w2 @ liftA w2b)=(liftB w1X)@teA BX#(liftA w2X))")
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      and n="n-i"
      in LR1_cfgLM_derivations_reachable_conf_form)
       apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
       apply(force)
      apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
      apply(rule sub_of_F_SDPDA_TO_CFG_STD__implies_LR1ProdForm)
      apply(force)
     apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
     apply(simp add: cfg_sub_def F_SDPDA_TO_CFG_STD_def)
    apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
    apply(force)
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
  apply(erule disjE)
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
   apply(case_tac i)
    apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
    prefer 2
    apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
    apply(clarsimp)
    apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
    apply(subgoal_tac "False")
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
     apply(force)
    apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
    apply(subgoal_tac "\<exists>e c. d1 (n-Suc nat+Suc 0) = Some (pair e c)")
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
     apply(subgoal_tac "d1 (n-Suc nat+Suc 0)=None")
      apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
      apply(force)
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
     apply(rule_tac
      t="n-Suc nat+Suc 0"
      and s="n-nat"
      in ssubst)
      apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
      apply(force)
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
     apply(case_tac "n-nat")
      apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
      apply(force)
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata)(*strict*)
     apply(clarsimp)
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
     apply(rule cfgLM_no_step_without_nonterms)
        apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
        apply(force)
       apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
       apply(subgoal_tac "n=Suc nata+nat")
        apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
        prefer 2
        apply(force)
       apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
       apply(clarsimp)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
      apply(subgoal_tac "n=Suc nata+nat")
       apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
       prefer 2
       apply(force)
      apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
      apply(clarsimp)
      apply(force)
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat nata e c)(*strict*)
     apply(force)
    apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
    apply(rule_tac
      m="n"
      in cfgLM.pre_some_position_is_some_position)
      apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
      apply(rule cfgLM.derivation_initial_is_derivation)
      apply(force)
     apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
     apply(force)
    apply(rename_tac e1b e1aa w1 w2 w1a w2a B w1b w2b Ba nat)(*strict*)
    apply(force)
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
   apply(clarsimp)
   apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
   apply(case_tac w2b)
    apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
    prefer 2
    apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b w2b Ba a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b Ba a list)(*strict*)
    apply (metis setA_setmp_concat_2 liftA.simps(2) elemInsetA emptyE empty_subsetI)
   apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
   apply(clarsimp)
   apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b Ba)(*strict*)
   apply(case_tac w2)
    apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b Ba)(*strict*)
    prefer 2
    apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b Ba a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba a list)(*strict*)
    apply (metis elemInsetA emptyE)
   apply(rename_tac e1 e1a w1 w2 w1a w2a B w1b Ba)(*strict*)
   apply(clarsimp)
   apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba)(*strict*)
   apply(case_tac w1b)
    apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba)(*strict*)
    prefer 2
    apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba a list)(*strict*)
    apply(subgoal_tac "\<exists>w' x'. w1b=w'@[x']")
     apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba a list)(*strict*)
     prefer 2
     apply(rule_tac NonEmptyListHasTailElem)
     apply(force)
    apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba a list)(*strict*)
    apply(thin_tac "w1b=a#list")
    apply(clarsimp)
    apply(rename_tac e1 e1a w1 w1a w2a B Ba w' x')(*strict*)
    apply(simp add: liftB_commutes_over_concat)
   apply(rename_tac e1 e1a w1 w1a w2a B w1b Ba)(*strict*)
   apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w1X w2X BX)(*strict*)
  apply(subgoal_tac "prefix w1b w1X")
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w1X w2X BX)(*strict*)
   prefer 2
   apply (metis liftA.simps(2) prefix_of_terminalInitial)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w1X w2X BX)(*strict*)
  apply(simp add: prefix_def)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c)(*strict*)
  apply(simp add: liftB_commutes_over_concat)
  apply(subgoal_tac "suffix (BX#w2X) w2b")
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c)(*strict*)
   prefer 2
   apply(rule suffix_tail)
   apply(force)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c)(*strict*)
  apply(simp add: suffix_def)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca)(*strict*)
  apply(subgoal_tac "suffix (BX#w2X) w2a")
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca)(*strict*)
   prefer 2
   apply(rule_tac
      c="w1b@c"
      and ?w2.0="liftB w1a @ w1"
      in suffix_tail)
   apply(simp add: liftB_commutes_over_concat)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca)(*strict*)
  apply(simp add: suffix_def)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(subgoal_tac "(\<forall>k. Suc 0\<le>k\<and>k\<le>n \<longrightarrow> F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d1 k))) = F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1 G (the(get_label(d2 k)))) \<and> w1a=w1b \<and> equal_front_states (B#w2a) (Ba#w2b) \<and> equal_stacks (B#w2a) (Ba#w2b)")
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   prefer 2
   apply(rule_tac
      n="n-Suc i"
      and ?d1.0="d1"
      and ?d2.0="d2"
      and m="n"
      in last_point_where_same_SDPDA_edges_used_prime)
                apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
                apply(force)
               apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
               apply(force)
              apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
              apply(force)
             apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
             apply(force)
            apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
            apply(force)
           apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
           apply(force)
          apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
          apply(force)
         apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
         apply(force)
        apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
        apply(force)
       apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
       apply(force)
      apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
      apply(force)
     apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
     apply(force)
    apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
    apply(force)
   apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa w1 w2 w1a w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(erule_tac
      x="n-i"
      in allE)
  apply(erule impE)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(clarsimp)
  apply(simp add: get_label_def)
  apply(subgoal_tac "B=Ba\<and>w2a=w2b")
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(subgoal_tac "(\<exists>x\<in> epda_delta G. edge_event x \<noteq> None \<and> (SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states SSG) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<and> (SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states SSG) \<or> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_read x) \<or> edge_event x = None \<and> edge_push x = [] \<and> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<and> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_pop x \<or> edge_event x = None \<and> edge_push x \<noteq> [] \<and> (SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states SSG) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states SSG)) \<and> (SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states SSG) \<or> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_push x (epda_states SSG))) \<or> SSe1 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG) (epda_gamma SSG) \<and> SSe2 \<in> F_SDPDA_TO_CFG_STD__edges_l2_final (epda_marking SSG) (epda_gamma SSG)" for SSe1 SSG SSe2)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   prefer 2
   apply(rule_tac
      ?e1.0="\<lparr>prod_lhs = B, prod_rhs = w1\<rparr>"
      and ?e2.0="\<lparr>prod_lhs = Ba, prod_rhs = w2\<rparr>"
      in F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_equal_then_from_special_sets)
         apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
         apply(force)
        apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
        apply(force)
       apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
       apply(force)
      apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
      apply(force)
     apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
     apply(force)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
    apply(force)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD_def cfg_sub_def)
   apply(force)
  apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(erule disjE)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
   apply(clarsimp)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(erule disjE)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
    apply(erule_tac
      P="\<lparr>prod_lhs = B, prod_rhs = w1\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3_read x (epda_states G)"
      in disjE)
     apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
     apply(erule disjE)
      apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
      apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_read_def)
      apply(clarsimp)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt qta)(*strict*)
      apply(case_tac c)
       apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt qta)(*strict*)
       apply(clarsimp)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt qta a list)(*strict*)
      apply(clarsimp)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt qta a list)(*strict*)
      apply(case_tac list)
       apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt qta a list)(*strict*)
       prefer 2
       apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt qta a list aa lista)(*strict*)
       apply(clarsimp)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt qta a list)(*strict*)
      apply(clarsimp)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qta a)(*strict*)
      apply(rule liftA_inj)
      apply(rule_tac
      t="liftA w2b"
      and s="liftA w2X"
      in ssubst)
       apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qta a)(*strict*)
       apply(force)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qta a)(*strict*)
      apply(force)
     apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt)(*strict*)
     apply(case_tac c)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list)(*strict*)
     apply(case_tac list)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list)(*strict*)
      prefer 2
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list aa lista)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
    apply(erule disjE)
     apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def F_SDPDA_TO_CFG_STD__edges_l3_read_def)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt)(*strict*)
     apply(case_tac c)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y qt a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list)(*strict*)
     apply(case_tac list)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list)(*strict*)
      prefer 2
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list aa lista)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x qt a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x y)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_read_def)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y)(*strict*)
    apply(case_tac c)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x y a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list)(*strict*)
    apply(case_tac list)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list)(*strict*)
     prefer 2
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x a)(*strict*)
    apply(rule liftA_inj)
    apply(rule_tac
      t="liftA w2b"
      and s="liftA w2X"
      in ssubst)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x a)(*strict*)
     apply(force)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x a)(*strict*)
    apply(force)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(erule disjE)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_pop_def)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x)(*strict*)
    apply(case_tac c)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x)(*strict*)
     prefer 2
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list)(*strict*)
     apply(case_tac w2a)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list aa lista)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x)(*strict*)
    apply(case_tac w2a)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb x a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w1b w2b w2X BX ca cb x list)(*strict*)
    apply(subgoal_tac "list=w2X")
     apply(rename_tac i e1b e1aa w1b w2b w2X BX ca cb x list)(*strict*)
     prefer 2
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac i e1b e1aa w1b w2b w2X BX ca cb x list)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w1b w2b w2X BX ca x)(*strict*)
    apply(case_tac w2b)
     apply(rename_tac i e1b e1aa w1b w2b w2X BX ca x)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w1b w2b w2X BX ca x a list)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w1b w2X BX ca x list)(*strict*)
    apply(rule liftA_inj)
    apply(rule sym)
    apply(force)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(clarsimp)
   apply(erule_tac
      P="\<lparr>prod_lhs = B, prod_rhs = w1\<rparr> \<in> F_SDPDA_TO_CFG_STD__edges_l3_push x (epda_states G)"
      in disjE)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(erule disjE)
     apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
     apply(simp add: F_SDPDA_TO_CFG_STD__edges_l3_push_def)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa qt qta)(*strict*)
     apply(case_tac c)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa qt qta)(*strict*)
      prefer 2
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa qt qta a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa qt qta)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt qta)(*strict*)
     apply(case_tac w2X)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt qta)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt qta a list)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b ca cb x qs qt list)(*strict*)
     apply(subgoal_tac "w2b=list")
      apply(rename_tac i e1b e1aa w2a w1b w2b ca cb x qs qt list)(*strict*)
      prefer 2
      apply(rule liftA_inj)
      apply(force)
     apply(rename_tac i e1b e1aa w2a w1b w2b ca cb x qs qt list)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b ca cb x qs qt list)(*strict*)
     apply(rule liftA_inj)
     apply(force)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X BX c ca cb x qs qt)(*strict*)
    apply(case_tac c)
     apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X BX c ca cb x qs qt)(*strict*)
     prefer 2
     apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X BX c ca cb x qs qt a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X BX c ca cb x qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X ca cb x qs qt)(*strict*)
    apply(erule disjE)
     apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X ca cb x qs qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2 w2a w1b w2b Ba w2X ca cb x qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt)(*strict*)
    apply(case_tac w2X)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(erule disjE)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def F_SDPDA_TO_CFG_STD__edges_l3_push_def)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X BX c ca cb x qs qt)(*strict*)
    apply(case_tac c)
     apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X BX c ca cb x qs qt)(*strict*)
     prefer 2
     apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X BX c ca cb x qs qt a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X BX c ca cb x qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X ca cb x qs qt)(*strict*)
    apply(erule disjE)
     apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X ca cb x qs qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2a B w1b w2b w2X ca cb x qs qt)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt)(*strict*)
    apply(case_tac w2X)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs qt a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_push_def)
   apply(erule_tac
      P="B = cons_l2 (edge_src x) (edge_pop x ! 0) \<and> w1 = [teA (cons_l2   (edge_trg x) (edge_push x ! 0))]"
      in disjE)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(erule disjE)
     apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x)(*strict*)
     apply(case_tac c)
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x)(*strict*)
      prefer 2
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x a list)(*strict*)
      apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x)(*strict*)
     apply(subgoal_tac "w2a=w2X")
      apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x)(*strict*)
      prefer 2
      apply(rule liftA_inj)
      apply(force)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x)(*strict*)
     apply(clarsimp)
     apply(rename_tac i e1b e1aa w1b w2b w2X ca x)(*strict*)
     apply(subgoal_tac "w2b=w2X")
      apply(rename_tac i e1b e1aa w1b w2b w2X ca x)(*strict*)
      prefer 2
      apply(rule liftA_inj)
      apply(force)
     apply(rename_tac i e1b e1aa w1b w2b w2X ca x)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs)(*strict*)
    apply(case_tac c)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs)(*strict*)
     prefer 2
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(erule disjE)
    apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
    apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs)(*strict*)
    apply(case_tac c)
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs)(*strict*)
     prefer 2
     apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs a list)(*strict*)
     apply(clarsimp)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb x)(*strict*)
   apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa)(*strict*)
   apply(case_tac c)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa)(*strict*)
    prefer 2
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb x qs qsa)(*strict*)
   apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs)(*strict*)
   apply(case_tac w2X)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X ca cb x qs a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b ca cb x qs list)(*strict*)
   apply(subgoal_tac "w2b=list")
    apply(rename_tac i e1b e1aa w2a w1b w2b ca cb x qs list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac i e1b e1aa w2a w1b w2b ca cb x qs list)(*strict*)
   apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b ca cb x qs list)(*strict*)
   apply(subgoal_tac "w2a=list")
    apply(rename_tac i e1b e1aa w2a w1b ca cb x qs list)(*strict*)
    prefer 2
    apply(rule liftA_inj)
    apply(force)
   apply(rename_tac i e1b e1aa w2a w1b ca cb x qs list)(*strict*)
   apply(clarsimp)
  apply(rename_tac i e1b e1aa w1 w2 w2a B w1b w2b Ba w2X BX c ca cb)(*strict*)
  apply(clarsimp)
  apply(simp add: F_SDPDA_TO_CFG_STD__edges_l2_final_def)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb ia ib Ab Aaa)(*strict*)
  apply(case_tac c)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb ia ib Ab Aaa)(*strict*)
   prefer 2
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb ia ib Ab Aaa a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb ia ib Ab Aaa a list)(*strict*)
   apply(case_tac w2a)
    apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb ia ib Ab Aaa a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb ia ib Ab Aaa a list aa lista)(*strict*)
   apply(clarsimp)
  apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX c ca cb ia ib Ab Aaa)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb ia ib Ab Aaa)(*strict*)
  apply(case_tac w2a)
   apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb ia ib Ab Aaa)(*strict*)
   apply(clarsimp)
  apply(rename_tac i e1b e1aa w2a w1b w2b w2X BX ca cb ia ib Ab Aaa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1b w2b w2X BX ca cb ia ib Ab Aaa list)(*strict*)
  apply(subgoal_tac "list=w2X")
   apply(rename_tac i e1b e1aa w1b w2b w2X BX ca cb ia ib Ab Aaa list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac i e1b e1aa w1b w2b w2X BX ca cb ia ib Ab Aaa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1b w2b w2X BX ca ia ib Ab Aaa)(*strict*)
  apply(case_tac w2b)
   apply(rename_tac i e1b e1aa w1b w2b w2X BX ca ia ib Ab Aaa)(*strict*)
   apply(clarsimp)
  apply(rename_tac i e1b e1aa w1b w2b w2X BX ca ia ib Ab Aaa a list)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1b w2X BX ca ia ib Ab Aaa list)(*strict*)
  apply(subgoal_tac "list=w2X")
   apply(rename_tac i e1b e1aa w1b w2X BX ca ia ib Ab Aaa list)(*strict*)
   prefer 2
   apply(rule liftA_inj)
   apply(force)
  apply(rename_tac i e1b e1aa w1b w2X BX ca ia ib Ab Aaa list)(*strict*)
  apply(clarsimp)
  apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
  apply(subgoal_tac "l3_l2_separation_ALT (cons_l2 ia Ab#BX#w2X)")
   apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
   apply(simp add: l3_l2_separation_ALT_def)
  apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
  apply(rule_tac
      d="d1"
      and n="n-Suc i"
      in cfgLM_reachable_conf_isl3_l2_separation_ALT_stack)
       apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
       apply(force)
      apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
      apply(force)
     apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
     apply(force)
    apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
    apply(rule cfg_sub_preserves_cfgLM_derivation_initial)
      apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
      apply(force)
     apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
     apply(force)
    apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
    apply(force)
   apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
   apply(force)
  apply(rename_tac i e1b e1aa w1b w2X BX ia ib Ab Aaa)(*strict*)
  apply(force)
  done

lemma cfgLM_derivation_coincide_7: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n = Some (pair e1 \<lparr>cfg_conf=liftB v\<rparr>)
  \<Longrightarrow> d2 n = Some (pair e2 \<lparr>cfg_conf=liftB v\<rparr>)
  \<Longrightarrow> i\<le>n
  \<Longrightarrow> d1 i = d2 i"
  apply(case_tac n)
   apply(simp add: cfgLM.derivation_initial_def)
  apply(rename_tac nat)(*strict*)
  apply(clarsimp)
  apply(rename_tac n)
  apply(rename_tac n)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d1 n = Some (pair e1 c1) \<and> d1 (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   apply(rename_tac n)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n)(*strict*)
    apply(force)
   apply(rename_tac n)(*strict*)
   apply(force)
  apply(rename_tac n)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 e2a c1)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac n e1 e2a c1 l r)(*strict*)
  apply(subgoal_tac "\<exists>e1 e2 c1 c2. d2 n = Some (pair e1 c1) \<and> d2 (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
   apply(rename_tac n e1 e2a c1 l r)(*strict*)
   prefer 2
   apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
     apply(rename_tac n e1 e2a c1 l r)(*strict*)
     apply(rule cfgLM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac n e1 e2a c1 l r)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2a c1 l r)(*strict*)
   apply(force)
  apply(rename_tac n e1 e2a c1 l r)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a)(*strict*)
  apply(simp add: cfgLM_step_relation_def)
  apply(clarsimp)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
  apply(subgoal_tac "\<exists>q A. cfg_conf c1=(cfg_conf \<lparr>cfg_conf = la @ prod_rhs e2a @ ra\<rparr>)@[teA (cons_l2   q A)] \<and> q \<in> epda_marking G")
   apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
   prefer 2
   apply(rule_tac
      d="d1"
      in pre_final_conf_has_nonterminal_at_ending)
           apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
           apply(force)
          apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
          apply(force)
         apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
         apply(force)
        apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
        apply(force)
       apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
       apply(rule duplicate_marking_to_duplicate_markingH)
        apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
       apply(force)
      apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
      apply(force)
     apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
     apply(force)
    apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="la @ prod_rhs e2a @ ra"
      and s="liftB v"
      in ssubst)
    apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
   apply (metis setA_liftB)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
  apply(subgoal_tac "\<exists>q A. cfg_conf c1a=(cfg_conf \<lparr>cfg_conf = l @ prod_rhs e2 @ r\<rparr>)@[teA (cons_l2   q A)] \<and> q \<in> epda_marking G")
   apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
   prefer 2
   apply(rule_tac
      d="d2"
      in pre_final_conf_has_nonterminal_at_ending)
           apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
           apply(force)
          apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
          apply(force)
         apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
         apply(force)
        apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
        apply(force)
       apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
       apply(rule duplicate_marking_to_duplicate_markingH)
        apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
        apply(simp add: valid_simple_dpda_def valid_dpda_def valid_pda_def)
       apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
       apply(force)
      apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
      apply(force)
     apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
     apply(force)
    apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
   apply(clarsimp)
   apply(rule_tac
      t="l @ prod_rhs e2 @ r"
      and s="liftB v"
      in ssubst)
    apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
    apply(force)
   apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
   apply (metis setA_liftB)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa)(*strict*)
  apply(case_tac e2)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa prod_lhsa prod_rhsa)(*strict*)
  apply(case_tac e2a)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa prod_lhsa prod_rhsa prod_lhsaa prod_rhsaa)(*strict*)
  apply(rename_tac C1 r1 C2 r2)
  apply(rename_tac n e1 e2 c1 l r e1a e2a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
  apply(case_tac r2)
   apply(rename_tac n e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
   prefer 2
   apply(rename_tac n e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2 a list)(*strict*)
   apply(clarsimp)
  apply(rename_tac n e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 r2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(case_tac c1a)
  apply(rename_tac n e1 c1 l r e1a c1a la ra q A qa Aa C1 r1 C2 cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 c1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(case_tac c1)
  apply(rename_tac n e1 c1 l r e1a la ra q A qa Aa C1 r1 C2 cfg_confa)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(case_tac r1)
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
   prefer 2
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 r1 C2 a list)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
   apply(case_tac r)
    apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
    apply(clarsimp)
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list aa lista)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. r=w'@[x']")
    apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list aa lista)(*strict*)
    prefer 2
    apply(rule_tac NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list aa lista)(*strict*)
   apply(thin_tac "r=aa#lista")
   apply(clarsimp)
   apply(rename_tac n e1 l e1a la ra q A qa Aa C1 C2 a list w')(*strict*)
   apply(case_tac ra)
    apply(rename_tac n e1 l e1a la ra q A qa Aa C1 C2 a list w')(*strict*)
    apply(clarsimp)
    apply(rename_tac n e1 l e1a q A qa Aa C1 a list w')(*strict*)
    apply (metis setA_liftB elemInsetA ex_in_conv)
   apply(rename_tac n e1 l e1a la ra q A qa Aa C1 C2 a list w' aa lista)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. ra=w'@[x']")
    apply(rename_tac n e1 l e1a la ra q A qa Aa C1 C2 a list w' aa lista)(*strict*)
    prefer 2
    apply(rule_tac
      n="length lista"
      in NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n e1 l e1a la ra q A qa Aa C1 C2 a list w' aa lista)(*strict*)
   apply(thin_tac "ra=aa#lista")
   apply(clarsimp)
   apply(rename_tac n e1 l e1a la qa Aa C1 C2 a list w' w'a)(*strict*)
   apply (metis setA_liftB elemInsetA ex_in_conv)
  apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 r1 C2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2)(*strict*)
  apply(case_tac r)
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2)(*strict*)
   prefer 2
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. r=w'@[x']")
    apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
    prefer 2
    apply(rule_tac NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2 a list)(*strict*)
   apply(thin_tac "r=a#list")
   apply(clarsimp)
   apply(rename_tac n e1 l e1a la ra q A qa Aa C1 C2 w')(*strict*)
   apply (metis setA_liftB elemInsetA ex_in_conv)
  apply(rename_tac n e1 l r e1a la ra q A qa Aa C1 C2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 e1a la ra q A qa Aa C2)(*strict*)
  apply(case_tac ra)
   apply(rename_tac n e1 e1a la ra q A qa Aa C2)(*strict*)
   prefer 2
   apply(rename_tac n e1 e1a la ra q A qa Aa C2 a list)(*strict*)
   apply(subgoal_tac "\<exists>w' x'. ra=w'@[x']")
    apply(rename_tac n e1 e1a la ra q A qa Aa C2 a list)(*strict*)
    prefer 2
    apply(rule_tac NonEmptyListHasTailElem)
    apply(force)
   apply(rename_tac n e1 e1a la ra q A qa Aa C2 a list)(*strict*)
   apply(thin_tac "ra=a#list")
   apply(clarsimp)
   apply(rename_tac n e1 e1a la q A qa Aa C2 w')(*strict*)
   apply (metis setA_liftB elemInsetA ex_in_conv)
  apply(rename_tac n e1 e1a la ra q A qa Aa C2)(*strict*)
  apply(clarsimp)
  apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
  apply(thin_tac "setA (liftB v) = {}")
  apply(thin_tac "q \<in> epda_marking G")
  apply(thin_tac "qa \<in> epda_marking G")
  apply(thin_tac "\<lparr>prod_lhs = cons_l2 q A, prod_rhs = []\<rparr> \<in> cfg_productions G'")
  apply(thin_tac "\<lparr>prod_lhs = cons_l2 qa Aa, prod_rhs = []\<rparr> \<in> cfg_productions G'")
  apply(rule_tac
      G="G'"
      and n="Suc n"
      in cfgLM_edges_unique_wrt_conf_sequence)
        apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
        apply(force)
       apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
       apply(force)
      apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
      apply(force)
     apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
     apply(force)
    apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
    apply(force)
   apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
   prefer 2
   apply(force)
  apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
  apply(rule allI)
  apply(rename_tac n e1 e1a q A qa Aa ia)(*strict*)
  apply(rule impI)
  apply(case_tac ia)
   apply(rename_tac n e1 e1a q A qa Aa ia)(*strict*)
   apply(clarsimp)
   apply(rename_tac n e1 e1a q A qa Aa)(*strict*)
   apply(simp add: get_configuration_def)
  apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
  apply(rule_tac
      t="Suc n-ia"
      and s="n-nat"
      in ssubst)
   apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
   apply(force)
  apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
  apply(rule_tac
      ?d1.0="d1"
      and ?d2.0="d2"
      and n="n"
      in cfgLM_derivation_coincide_6)
              apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
              apply(force)
             apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
             apply(force)
            apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
            apply(force)
           apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
           apply(force)
          apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
          apply(force)
         apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
         apply(force)
        apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
        apply(force)
       apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
       apply(force)
      apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
      apply(force)
     apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
     apply(force)
    apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
    apply(force)
   apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
   apply(force)
  apply(rename_tac n e1 e1a q A qa Aa ia nat)(*strict*)
  apply(force)
  done

lemma cfgLM_derivation_coincide_9: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgLM.derivation_initial G' d1
  \<Longrightarrow> cfgLM.derivation_initial G' d2
  \<Longrightarrow> d1 n1 = Some (pair e1 \<lparr>cfg_conf=liftB v\<rparr>)
  \<Longrightarrow> d2 n2 = Some (pair e2 \<lparr>cfg_conf=liftB v\<rparr>)
  \<Longrightarrow> n1=n2 \<and> (\<forall>i\<le>n1. d1 i = d2 i)"
  apply(rule context_conjI)
   apply(case_tac "n1\<le>n2")
    apply(rule_tac
      ?d1.0="d1"
      and ?d2.0="d2"
      in cfgLM_derivation_coincide_8)
              apply(force)
             apply(force)
            apply(force)
           apply(force)
          apply(force)
         apply(force)
        apply(force)
       apply(force)
      apply(force)
     apply(force)
    apply(force)
   apply(rule sym)
   apply(rule_tac
      ?d1.0="d2"
      and ?d2.0="d1"
      in cfgLM_derivation_coincide_8)
             apply(force)
            apply(force)
           apply(force)
          apply(force)
         apply(force)
        apply(force)
       apply(force)
      apply(force)
     apply(force)
    apply(force)
   apply(force)
  apply(rule allI)
  apply(rename_tac i)(*strict*)
  apply(rule impI)
  apply(rule_tac
      ?d1.0="d1"
      and ?d2.0="d2"
      in cfgLM_derivation_coincide_7)
            apply(rename_tac i)(*strict*)
            apply(force)+
  done

lemma F_SDPDA_TO_CFG_STD__produces_CFGlm_unambiguous: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> CFGlm_unambiguous G'"
  apply(simp add: CFGlm_unambiguous_def)
  apply(clarsimp)
  apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
  apply(subgoal_tac "n1=n2 \<and> (\<forall>i\<le>n1. d1 i = d2 i)")
   apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
   prefer 2
   apply(rule cfgLM_derivation_coincide_9)
            apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
            apply(force)
           apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
           apply(force)
          apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
          apply(force)
         apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
         apply(force)
        apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
        apply(force)
       apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
       apply(force)
      apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
      apply(force)
     apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
     apply(force)
    apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
    apply(force)
   apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
   apply(force)
  apply(rename_tac d1 d2 n1 n2 e1 e2 w)(*strict*)
  apply(rule ext)
  apply(rename_tac d1 d2 n1 n2 e1 e2 w x)(*strict*)
  apply(case_tac "x\<le>n1")
   apply(rename_tac d1 d2 n1 n2 e1 e2 w x)(*strict*)
   apply(force)
  apply(rename_tac d1 d2 n1 n2 e1 e2 w x)(*strict*)
  apply(clarsimp)
  apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
  apply(subgoal_tac "d1 x = None")
   apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
   prefer 2
   apply(rule cfgLM_no_step_from_no_nonterminal)
        apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
        apply(force)
       apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
      apply(rule cfgLM.derivation_initial_belongs)
       apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
       apply(force)
      apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
      apply(force)
     apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
     apply(force)
    apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
    apply(clarsimp)
    apply (metis setA_liftB)
   apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
   apply(force)
  apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
  apply(subgoal_tac "d2 x = None")
   apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
   prefer 2
   apply(rule cfgLM_no_step_from_no_nonterminal)
        apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
        apply(force)
       apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
       apply(rule cfgLM.derivation_initial_is_derivation)
       apply(force)
      apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
      apply(rule cfgLM.derivation_initial_belongs)
       apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
       apply(force)
      apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
      apply(force)
     apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
     apply(force)
    apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
    apply(clarsimp)
    apply (metis setA_liftB)
   apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
   apply(force)
  apply(rename_tac d1 d2 n2 e1 w x)(*strict*)
  apply(force)
  done

theorem F_SDPDA_TO_CFG_STD__enforces_cfg_LRk_1: "
  valid_simple_dpda G
  \<Longrightarrow> valid_cfg G'
  \<Longrightarrow> valid_cfg (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_sub G' (F_SDPDA_TO_CFG_STD G)
  \<Longrightarrow> cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'
  \<Longrightarrow> \<not> duplicate_marking G
  \<Longrightarrow> cfgRM.derivation_initial G' d1
  \<Longrightarrow> d1 n1 = Some (pair e1 \<lparr>cfg_conf = \<delta>1 @ [teA A1]\<rparr>)
  \<Longrightarrow> d1 (Suc n1) = Some (pair (Some e1') \<lparr>cfg_conf = \<delta>2 @ \<omega>2\<rparr>)
  \<Longrightarrow> cfgRM.derivation_initial G' d2
  \<Longrightarrow> d2 n2 = Some (pair e2 \<lparr>cfg_conf = \<delta>2 @ [teA A2]\<rparr>)
  \<Longrightarrow> d2 (Suc n2) = Some (pair (Some e2') \<lparr>cfg_conf = \<delta>2 @ \<omega>2\<rparr>)
  \<Longrightarrow> \<delta>1 @ \<omega>1 = \<delta>2 @ \<omega>2
  \<Longrightarrow> \<delta>1 = \<delta>2 \<and> A1 = A2 \<and> \<omega>1 = \<omega>2"
  apply(subgoal_tac "\<exists>d n e v. cfgRM.derivation G' d \<and> d 0 = Some (pair None \<lparr>cfg_conf=\<delta>1@\<omega>1\<rparr>) \<and> d n = Some (pair e \<lparr>cfg_conf=liftB v\<rparr>)")
   prefer 2
   apply(subgoal_tac "\<exists>d n e v. cfgLM.derivation G' d \<and> d 0 = Some (pair None \<lparr>cfg_conf=\<delta>1@\<omega>1\<rparr>) \<and> d n = Some (pair e \<lparr>cfg_conf=liftB v\<rparr>)")
    prefer 2
    apply(rule construct_elimininating_derivation)
      apply(force)
     apply(force)
    apply(subgoal_tac "\<lparr>cfg_conf = \<delta>1 @ \<omega>1\<rparr> \<in> cfg_configurations G'")
     apply(thin_tac "cfg_nonterminals G' = cfgLM_accessible_nonterminals G' \<inter> cfgSTD_Nonblockingness_nonterminals G'")
     apply(simp add: cfg_configurations_def)
    apply(rule_tac
      d="d1"
      and i="Suc n1"
      in cfgRM.belongs_configurations)
     apply(rule cfgRM.derivation_initial_belongs)
      apply(force)
     apply(force)
    apply(force)
   apply(erule exE)+
   apply(rename_tac d n e v)(*strict*)
   apply(subgoal_tac "\<exists>d' e. cfgRM.derivation SSG d' \<and> maximum_of_domain d' SSn \<and> d' 0 = Some (pair None \<lparr>cfg_conf = SSw1\<rparr>) \<and> d' SSn = Some (pair e \<lparr>cfg_conf = SSw2\<rparr>)" for SSG SSw1 SSn SSw2)
    apply(rename_tac d n e v)(*strict*)
    prefer 2
    apply(rule_tac
      d="d"
      and n="n"
      in cfg_derivation_can_be_translated_to_cfgRM_derivation)
         apply(rename_tac d n e v)(*strict*)
         apply(force)
        apply(rename_tac d n e v)(*strict*)
        apply(rule cfgLM_derivations_are_cfg_derivations)
        apply(force)
       apply(rename_tac d n e v)(*strict*)
       apply(simp add: maximum_of_domain_def)
       apply(case_tac "d(Suc n)")
        apply(rename_tac d n e v)(*strict*)
        apply(force)
       apply(rename_tac d n e v a)(*strict*)
       apply(subgoal_tac "\<exists>e1 e2 c1 c2. d n = Some (pair e1 c1) \<and> d (Suc n) = Some (pair (Some e2) c2) \<and> cfgLM_step_relation G' c1 e2 c2")
        apply(rename_tac d n e v a)(*strict*)
        prefer 2
        apply(rule_tac
      m="Suc n"
      in cfgLM.step_detail_before_some_position)
          apply(rename_tac d n e v a)(*strict*)
          apply(force)
         apply(rename_tac d n e v a)(*strict*)
         apply(force)
        apply(rename_tac d n e v a)(*strict*)
        apply(force)
       apply(rename_tac d n e v a)(*strict*)
       apply(clarsimp)
       apply(rename_tac d n e v e2a c2)(*strict*)
       apply(simp add: cfgLM_step_relation_def)
       apply(clarsimp)
       apply(rename_tac d n e v e2a c2 l r)(*strict*)
       apply (metis setA_liftB all_not_in_conv elemInsetA)
      apply(rename_tac d n e v)(*strict*)
      apply(force)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply (metis setA_liftB)
   apply(rename_tac d n e v)(*strict*)
   apply(erule exE)+
   apply(rename_tac d n e v d' ea)(*strict*)
   apply(rule_tac
      x="d'"
      in exI)
   apply(rule_tac
      x="n"
      in exI)
   apply(rule_tac
      x="ea"
      in exI)
   apply(rule_tac
      x="v"
      in exI)
   apply(force)
  apply(clarsimp)
  apply(rename_tac d n e v)(*strict*)
  apply(subgoal_tac "cfgRM.derivation G' (derivation_append d1 d (Suc n1))")
   apply(rename_tac d n e v)(*strict*)
   prefer 2
   apply(rule cfgRM.derivation_append_preserves_derivation)
     apply(rename_tac d n e v)(*strict*)
     apply(rule cfgRM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(subgoal_tac "cfgRM.derivation G' (derivation_append d2 d (Suc n2))")
   apply(rename_tac d n e v)(*strict*)
   prefer 2
   apply(rule cfgRM.derivation_append_preserves_derivation)
     apply(rename_tac d n e v)(*strict*)
     apply(rule cfgRM.derivation_initial_is_derivation)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(subgoal_tac "cfgRM.belongs G' (derivation_append d1 d (Suc n1))")
   apply(rename_tac d n e v)(*strict*)
   prefer 2
   apply(rule cfgRM.derivation_append_preserves_belongs)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(rule cfgRM.derivation_initial_belongs)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(subgoal_tac "cfgRM.belongs G' (derivation_append d2 d (Suc n2))")
   apply(rename_tac d n e v)(*strict*)
   prefer 2
   apply(rule cfgRM.derivation_append_preserves_belongs)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(rule cfgRM.derivation_initial_belongs)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(subgoal_tac "derivation_append d1 d (Suc n1) = derivation_append d2 d (Suc n2)")
   apply(rename_tac d n e v)(*strict*)
   apply(subgoal_tac "Suc n1+n=Suc n2+n")
    apply(rename_tac d n e v)(*strict*)
    prefer 2
    apply(rule_tac
      ?e2.0="if n=0 then Some e2' else e"
      and ?c2.0="\<lparr>cfg_conf = liftB v\<rparr>"
      and ?e1.0="if n=0 then Some e1' else e"
      and ?c1.0="\<lparr>cfg_conf = liftB v\<rparr>"
      and ?d1.0="derivation_append d1 d (Suc n1)"
      and ?d2.0="derivation_append d2 d (Suc n2)"
      in cfgRM_equal_terminating_derivations_smae_length)
             apply(rename_tac d n e v)(*strict*)
             apply(force)
            apply(rename_tac d n e v)(*strict*)
            apply(force)
           apply(rename_tac d n e v)(*strict*)
           apply(force)
          apply(rename_tac d n e v)(*strict*)
          apply(force)
         apply(rename_tac d n e v)(*strict*)
         apply(force)
        apply(rename_tac d n e v)(*strict*)
        apply(thin_tac "derivation_append d1 d (Suc n1) = derivation_append d2 d (Suc n2)")
        apply(rename_tac d n e v)(*strict*)
        apply(simp add: derivation_append_def)
        apply(clarsimp)
       apply(rename_tac d n e v)(*strict*)
       apply(thin_tac "derivation_append d1 d (Suc n1) = derivation_append d2 d (Suc n2)")
       apply(rename_tac d n e v)(*strict*)
       apply(simp add: derivation_append_def)
       apply(clarsimp)
      apply(rename_tac d n e v)(*strict*)
      apply(clarsimp)
      apply (metis setA_liftB)
     apply(rename_tac d n e v)(*strict*)
     apply(clarsimp)
     apply (metis setA_liftB)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(clarsimp)
   apply(subgoal_tac "derivation_append d1 d (Suc n2) (Suc n2)= derivation_append d2 d (Suc n2) (Suc n2)")
    apply(rename_tac d n e v)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(subgoal_tac "derivation_append d1 d (Suc n2) n2= derivation_append d2 d (Suc n2) n2")
    apply(rename_tac d n e v)(*strict*)
    prefer 2
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(thin_tac "derivation_append d1 d (Suc n2) = derivation_append d2 d (Suc n2)")
   apply(rename_tac d n e v)(*strict*)
   apply(simp add: derivation_append_def)
  apply(rename_tac d n e v)(*strict*)
  apply(subgoal_tac "CFGrm_unambiguous G'")
   apply(rename_tac d n e v)(*strict*)
   prefer 2
   apply(rule lemma_4_12_2)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(rule F_SDPDA_TO_CFG_STD__produces_CFGlm_unambiguous)
        apply(rename_tac d n e v)(*strict*)
        apply(force)
       apply(rename_tac d n e v)(*strict*)
       apply(force)
      apply(rename_tac d n e v)(*strict*)
      apply(force)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(simp add: CFGrm_unambiguous_def)
  apply(erule_tac
      x="derivation_append d1 d (Suc n1)"
      in allE)
  apply(erule impE)
   apply(rename_tac d n e v)(*strict*)
   apply(rule cfgRM.derivation_append_preserves_derivation_initial)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(erule_tac
      x="derivation_append d2 d (Suc n2)"
      in allE)
  apply(erule impE)
   apply(rename_tac d n e v)(*strict*)
   apply(rule cfgRM.derivation_append_preserves_derivation_initial)
     apply(rename_tac d n e v)(*strict*)
     apply(force)
    apply(rename_tac d n e v)(*strict*)
    apply(force)
   apply(rename_tac d n e v)(*strict*)
   apply(force)
  apply(rename_tac d n e v)(*strict*)
  apply(erule_tac
      x="Suc n1+n"
      in allE)
  apply(erule_tac
      x="Suc n2+n"
      in allE)
  apply(erule_tac
      x="if n=0 then Some e1' else e"
      in allE)
  apply(erule_tac
      x="if n=0 then Some e2' else e"
      in allE)
  apply(erule_tac
      x="v"
      in allE)
  apply(erule impE)
   apply(rename_tac d n e v)(*strict*)
   apply(simp add: derivation_append_def)
   apply(clarsimp)
  apply(rename_tac d n e v)(*strict*)
  apply(erule impE)
   apply(rename_tac d n e v)(*strict*)
   apply(simp add: derivation_append_def)
   apply(clarsimp)
  apply(rename_tac d n e v)(*strict*)
  apply(force)
  done

hide_fact cfgLM_derivation_coincide_6
hide_fact cfgLM_derivation_coincide_7
hide_fact cfgLM_derivation_coincide_8
hide_fact commonsuffix_remove_nonresult
hide_fact commonSuffix_to_suffix
hide_fact commonSuffix_triv
hide_fact commonSuffix_with_empty
hide_fact equal_stacks_prefix
hide_fact F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_back_hlp
hide_fact F_SDPDA_TO_CFG_STD__edges_l2_final_single_source
hide_fact l2_push_ignore_no_relnonterms
hide_fact last_point_where_same_SDPDA_edges_used
hide_fact last_point_where_same_SDPDA_edges_used_bracketed
hide_fact last_point_where_same_SDPDA_edges_used_prime
hide_fact maximalSuffix_is_suffix
hide_fact maximalSuffix_is_suffix_prime
hide_fact maximalSuffix_removal
hide_fact maximalSuffix_removal_hlp2
hide_fact maximalSuffix_remove_nonresult
hide_fact maximalSuffix_remove_nonresult_prime
hide_fact maximalSuffix_triv
hide_fact maximalSuffix_with_empty
hide_fact maxLength_in_A
hide_fact no_maximalSuffix_is_suffix
hide_fact pre_final_conf_has_nonterminal_at_ending
hide_fact push_adds_to_relnonterms
hide_fact relnonterms_change_on_pop_final
hide_fact relnonterms_invariant_on_drop_push
hide_fact relnonterms_invariant_on_read
hide_fact relnonterms_prefix
hide_fact relnonterms_triv
  (* important cfgLM_derivation_coincide_9 *)
  (* important cfgLM_positions_remain_compatible *)
  (* important equal_stacks_append *)
  (* important equal_stacks_Cons *)
  (* important F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_contra *)
  (* important F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD_1_equal_then_from_special_sets *)
  (* important F_DPDA_DRE__revert_F_SDPDA_TO_CFG_STD__SOUND_pt1 *)
  (* important F_SDPDA_TO_CFG_STD__edges_l2_push_single_source *)
  (* important F_SDPDA_TO_CFG_STD__edges_l2_read_single_source *)
  (* important F_SDPDA_TO_CFG_STD__edges_l3_pop_single_source *)
  (* important F_SDPDA_TO_CFG_STD__edges_l3_push_single_source *)
  (* important F_SDPDA_TO_CFG_STD__edges_l3_read_single_source *)
  (* important F_SDPDA_TO_CFG_STD__enforces_cfg_LRk_1 *)
  (* important F_SDPDA_TO_CFG_STD__produces_CFGlm_unambiguous *)

end