have split: "UNIV = (Init' ` UNIV) ∪ (Noninit' ` UNIV) ∪ (Isolated' ` (UNIV :: (('ctr_loc * 'label) set)))" unfolding Init'_def Noninit'_def proof (rule; rule; rule; rule) fix x :: "('ctr_loc, 'noninit, 'label) state" assume"x ∈ UNIV" moreover assume"x ∉ range Isolated'" moreover assume"x ∉ range Noninit" ultimately show"x ∈ range Init" by (metis Isolated'_def prod.simps(2) range_eqI state.exhaust) qed
have"finite (Init' ` (UNIV:: 'ctr_loc set))" using assms by auto moreover have"finite (Noninit' ` (UNIV:: 'noninit set))" using assms by auto moreover have"finite (UNIV :: (('ctr_loc * 'label) set))" using assms by (simp add: finite_Prod_UNIV) thenhave"finite (Isolated' ` (UNIV :: (('ctr_loc * 'label) set)))" by auto ultimately show"finite (UNIV :: ('ctr_loc, 'noninit, 'label) state set)" unfolding split by auto qed
instantiation state :: (finite, finite, finite) finite begin
instanceby standard (simp add: finitely_many_states)
lemma no_infinite: assumes"∧ts ts' :: ('c ::finite, 'l::finite) transition set. rule ts ts' ==> card ts' = Suc (card ts)" assumes"∀i :: nat. rule (tts i) (tts (Suc i))" shows"False" proof -
define f where"f i = card (tts i)"for i have f_Suc: "∀i. f i < f (Suc i)" using assms f_def lessI by metis have"∀i. ∃j. f j > i" proof fix i show"∃j. i < f j" proof(induction i) case0 thenshow ?case by (metis f_Suc neq0_conv) next case (Suc i) thenshow ?case by (metis Suc_lessI f_Suc) qed qed thenhave"∃j. f j > card (UNIV :: ('c, 'l) transition set)" by auto thenshow False by (metis card_seteq f_def finite_UNIV le_eq_less_or_eq nat_neq_iff subset_UNIV) qed
lemma pre_star1_mono: "mono pre_star1" unfolding pre_star1_def by (auto simp: mono_def LTS.trans_star_code[symmetric] elim!: bexI[rotated]
LTS_trans_star_mono[THEN monoD, THEN subsetD])
lemma pre_star_rule_pre_star1: assumes"X ⊆ pre_star1 ts" shows"pre_star_rule** ts (ts ∪ X)" proof - have"finite X" by simp from this assms show ?thesis proof (induct X arbitrary: ts rule: finite_induct) case (insert x F) thenobtain p γ p' w q where *: "(p, γ) ↪ (p', w)" "(Init p', lbl w, q) ∈ LTS.trans_star ts"and x: "x = (Init p, γ, q)" by (auto simp: pre_star1_def is_rule_def LTS.trans_star_code) with insert show ?case proof (cases "(Init p, γ, q) ∈ ts") case False with insert(1,2,4) x show ?thesis by (intro converse_rtranclp_into_rtranclp[of pre_star_rule, OF add_trans[OF * False]])
(auto intro!: insert(3)[of "insert x ts", simplified x Un_insert_left]
intro: pre_star1_mono[THEN monoD, THEN set_mp, of ts]) qed (simp add: insert_absorb) qed simp qed
lemma pre_star_rule_pre_star1s: "pre_star_rule** ts (((λs. s ∪ pre_star1 s) ^^ k) ts)" by (induct k) (auto elim!: rtranclp_trans intro: pre_star_rule_pre_star1)
definition"pre_star_loop = while_option (λs. s ∪ pre_star1 s ≠ s) (λs. s ∪ pre_star1 s)" definition"pre_star_exec = the o pre_star_loop" definition"pre_star_exec_check A = (if inits ⊆ LTS.srcs A then pre_star_loop A else None)"
definition"accept_pre_star_exec_check A c = (if inits ⊆ LTS.srcs A then Some (accepts (pre_star_exec A) c) else None)"
lemma while_option_finite_subset_Some: fixes C :: "'a set" assumes"mono f"and"!!X. X ⊆ C ==> f X ⊆ C"and"finite C"and X: "X ⊆ C""X ⊆ f X" shows"∃P. while_option (λA. f A ≠ A) f X = Some P" proof(rule measure_while_option_Some[where
f= "%A::'a set. card C - card A"and P= "%A. A ⊆ C ∧ A ⊆ f A"and s= X]) fix A assume A: "A ⊆ C ∧ A ⊆ f A""f A ≠ A" show"(f A ⊆ C ∧ f A ⊆ f (f A)) ∧ card C - card (f A) < card C - card A"
(is"?L ∧ ?R") proof show ?L by(metis A(1) assms(2) monoD[OF ‹mono f›]) show ?R by (metis A assms(2,3) card_seteq diff_less_mono2 equalityI linorder_le_less_linear
rev_finite_subset) qed qed (simp add: X)
lemma pre_star_exec_terminates: "∃t. pre_star_loop s = Some t" unfolding pre_star_loop_def by (rule while_option_finite_subset_Some[where C=UNIV])
(auto simp: mono_def dest: pre_star1_mono[THEN monoD])
lemma pre_star_exec_code[code]: "pre_star_exec s = (let s' = pre_star1 s in if s' ⊆ s then s else pre_star_exec (s ∪ s'))" unfolding pre_star_exec_def pre_star_loop_def o_apply by (subst while_option_unfold)(auto simp: Let_def)
lemma saturation_pre_star_exec: "saturation pre_star_rule ts (pre_star_exec ts)" proof - from pre_star_exec_terminates obtain t where t: "pre_star_loop ts = Some t" by blast obtain k where k: "t = ((λs. s ∪ pre_star1 s) ^^ k) ts"and le: "pre_star1 t ⊆ t" using while_option_stop2[OF t[unfolded pre_star_loop_def]] by auto have"(∪{us. pre_star_rule t us}) - t ⊆ pre_star1 t" by (auto simp: pre_star1_def LTS.trans_star_code[symmetric] prod.splits is_rule_def
pre_star_rule.simps) from subset_trans[OF this le] show ?thesis unfolding saturation_def saturated_def pre_star_exec_def o_apply k t by (auto 90 simp: pre_star_rule_pre_star1s subset_eq pre_star_rule.simps) qed
lemma pre_star_rule_mono: "pre_star_rule ts ts' ==> ts ⊂ ts'" unfolding pre_star_rule.simps by auto
lemma post_star_rules_mono: "post_star_rules ts ts' ==> ts ⊂ ts'" proof(induction rule: post_star_rules.induct) case (add_trans_pop p γ p' q ts) thenshow ?caseby auto next case (add_trans_swap p γ p' γ' q ts) thenshow ?caseby auto next case (add_trans_push_1 p γ p' γ' γ'' q ts) thenshow ?caseby auto next case (add_trans_push_2 p γ p' γ' γ'' q ts) thenshow ?caseby auto qed
lemma pre_star_rule_card_Suc: "pre_star_rule ts ts' ==> card ts' = Suc (card ts)" unfolding pre_star_rule.simps by auto
lemma post_star_rules_card_Suc: "post_star_rules ts ts' ==> card ts' = Suc (card ts)" proof(induction rule: post_star_rules.induct) case (add_trans_pop p γ p' q ts) thenshow ?caseby auto next case (add_trans_swap p γ p' γ' q ts) thenshow ?caseby auto next case (add_trans_push_1 p γ p' γ' γ'' q ts) thenshow ?caseby auto next case (add_trans_push_2 p γ p' γ' γ'' q ts) thenshow ?caseby auto qed
lemma pre_star_saturation_termination: "¬(∃tts. (∀i :: nat. pre_star_rule (tts i) (tts (Suc i))))" using no_infinite pre_star_rule_card_Suc by blast
lemma post_star_saturation_termination: "¬(∃tts. (∀i :: nat. post_star_rules (tts i) (tts (Suc i))))" using no_infinite post_star_rules_card_Suc by blast
lemma pre_star_saturation_exi: shows"∃ts'. saturation pre_star_rule ts ts'" using pre_star_rule_card_Suc saturation_exi by blast
lemma post_star_saturation_exi: shows"∃ts'. saturation post_star_rules ts ts'" using post_star_rules_card_Suc saturation_exi by blast
lemma pre_star_rule_incr: "pre_star_rule A B ==> A ⊆ B" proof(induction rule: pre_star_rule.inducts) case (add_trans p γ p' w q rel) thenshow ?case by auto qed
lemma post_star_rules_incr: "post_star_rules A B ==> A ⊆ B" proof(induction rule: post_star_rules.inducts) case (add_trans_pop p γ p' q ts) thenshow ?case by auto next case (add_trans_swap p γ p' γ' q ts) thenshow ?case by auto next case (add_trans_push_1 p γ p' γ' γ'' q ts) thenshow ?case by auto next case (add_trans_push_2 p γ p' γ' γ'' q ts) thenshow ?case by auto qed
lemma saturation_rtranclp_pre_star_rule_incr: "pre_star_rule** A B ==> A ⊆ B" proof (induction rule: rtranclp_induct) case base thenshow ?caseby auto next case (step y z) thenshow ?case using pre_star_rule_incr by auto qed
lemma saturation_rtranclp_post_star_rule_incr: "post_star_rules** A B ==> A ⊆ B" proof (induction rule: rtranclp_induct) case base thenshow ?caseby auto next case (step y z) thenshow ?case using post_star_rules_incr by auto qed
lemma pre_star'_incr_trans_star: "pre_star_rule** A A' ==> LTS.trans_star A ⊆ LTS.trans_star A'" using mono_def LTS_trans_star_mono saturation_rtranclp_pre_star_rule_incr by metis
lemma post_star'_incr_trans_star: "post_star_rules** A A' ==> LTS.trans_star A ⊆ LTS.trans_star A'" using mono_def LTS_trans_star_mono saturation_rtranclp_post_star_rule_incr by metis
lemma post_star'_incr_trans_star_ε: "post_star_rules** A A' ==> LTS_ε.trans_star_ε A ⊆ LTS_ε.trans_star_ε A'" using mono_def LTS_ε_trans_star_ε_mono saturation_rtranclp_post_star_rule_incr by metis
lemma pre_star_lim'_incr_trans_star: "saturation pre_star_rule A A' ==> LTS.trans_star A ⊆ LTS.trans_star A'" by (simp add: pre_star'_incr_trans_star saturation_def)
lemma post_star_lim'_incr_trans_star: "saturation post_star_rules A A' ==> LTS.trans_star A ⊆ LTS.trans_star A'" by (simp add: post_star'_incr_trans_star saturation_def)
lemma post_star_lim'_incr_trans_star_ε: "saturation post_star_rules A A' ==> LTS_ε.trans_star_ε A ⊆ LTS_ε.trans_star_ε A'" by (simp add: post_star'_incr_trans_star_ε saturation_def)
lemma lemma_3_1: assumes"p'w ==>* pv" assumes"pv ∈ lang A" assumes"saturation pre_star_rule A A'" shows"accepts A' p'w" using assms proof (induct rule: converse_rtranclp_induct) case base
define p where"p = fst pv"
define v where"v = snd pv" from base have"∃q ∈ finals. (Init p, v, q) ∈ LTS.trans_star A'" unfolding lang_def p_def v_def using pre_star_lim'_incr_trans_star accepts_def by fastforce thenshow ?case unfolding accepts_def p_def v_def by auto next case (step p'w p''u)
define p' where"p' = fst p'w"
define w where"w = snd p'w"
define p'' where"p'' = fst p''u"
define u where"u = snd p''u" have p'w_def: "p'w = (p', w)" using p'_def w_def by auto have p''u_def: "p''u = (p'', u)" using p''_def u_def by auto
thenhave"accepts A' (p'', u)" using step by auto thenobtain q where q_p: "q ∈ finals ∧ (Init p'', u, q) ∈ LTS.trans_star A'" unfolding accepts_def by auto have"∃γ w1 u1. w=γ#w1 ∧ u=lbl u1@w1 ∧ (p', γ) ↪ (p'', u1)" using p''u_def p'w_def step.hyps(1) step_relp_def2 by auto thenobtain γ w1 u1 where γ_w1_u1_p: "w=γ#w1 ∧ u=lbl u1@w1 ∧ (p', γ) ↪ (p'', u1)" by blast
thenhave"∃q1. (Init p'', lbl u1, q1) ∈ LTS.trans_star A' ∧ (q1, w1, q) ∈ LTS.trans_star A'" using q_p LTS.trans_star_split by auto
thenobtain q1 where q1_p: "(Init p'', lbl u1, q1) ∈ LTS.trans_star A' ∧ (q1, w1, q) ∈ LTS.trans_star A'" by auto
thenhave in_A': "(Init p', γ, q1) ∈ A'" using γ_w1_u1_p add_trans[of p' γ p'' u1 q1 A'] saturated_def saturation_def step.prems by metis
thenhave"(Init p', γ#w1, q) ∈ LTS.trans_star A'" using LTS.trans_star.trans_star_step q1_p by meson thenhave t_in_A': "(Init p', w, q) ∈ LTS.trans_star A'" using γ_w1_u1_p by blast
from q_p t_in_A' have"q ∈ finals ∧ (Init p', w, q) ∈ LTS.trans_star A'" by auto thenshow ?case unfolding accepts_def p'w_def by auto qed
lemma word_into_init_empty_states: fixes A :: "(('ctr_loc, 'noninit, 'label) state, 'label) transition set" assumes"(p, w, ss, Init q) ∈ LTS.trans_star_states A" assumes"inits ⊆ LTS.srcs A" shows"w = [] ∧ p = Init q ∧ ss=[p]" proof -
define q1 :: "('ctr_loc, 'noninit, 'label) state"where "q1 = Init q" have q1_path: "(p, w, ss, q1) ∈ LTS.trans_star_states A" by (simp add: assms(1) q1_def) moreover have"q1 ∈ inits" by (simp add: inits_def q1_def) ultimately have"w = [] ∧ p = q1 ∧ ss=[p]" proof(induction rule: LTS.trans_star_states.induct[OF q1_path]) case (1 p) thenshow ?caseby auto next case (2 p γ q' w ss q) have"∄q γ q'. (q, γ, Init q') ∈ A" using assms(2) unfolding inits_def LTS.srcs_def by (simp add: Collect_mono_iff) thenshow ?case using2 assms(2) by (metis inits_def is_Init_def mem_Collect_eq) qed thenshow ?thesis using q1_def by fastforce qed
(* This corresponds to and slightly generalizes Schwoon's lemma 3.2(b) *) lemma word_into_init_empty: fixes A :: "(('ctr_loc, 'noninit, 'label) state, 'label) transition set" assumes"(p, w, Init q) ∈ LTS.trans_star A" assumes"inits ⊆ LTS.srcs A" shows"w = [] ∧ p = Init q" using assms word_into_init_empty_states LTS.trans_star_trans_star_states by metis
lemma step_relp_append_aux: assumes"pu ==>* p1y" shows"(fst pu, snd pu @ v) ==>* (fst p1y, snd p1y @ v)" using assms proof (induction rule: rtranclp_induct) case base thenshow ?caseby auto next case (step p'w p1y)
define p where"p = fst pu"
define u where"u = snd pu"
define p' where"p' = fst p'w"
define w where"w = snd p'w"
define p1 where"p1 = fst p1y"
define y where"y = snd p1y" have step_1: "(p,u) ==>* (p',w)" by (simp add: p'_def p_def step.hyps(1) u_def w_def) have step_2: "(p',w) ==> (p1,y)" by (simp add: p'_def p1_def step.hyps(2) w_def y_def) have step_3: "(p, u @ v) ==>* (p', w @ v)" by (simp add: p'_def p_def step.IH u_def w_def)
note step' = step_1 step_2 step_3
from step'(2) have"∃γ w' wa. w = γ # w' ∧ y = lbl wa @ w' ∧ (p', γ) ↪ (p1, wa)" using step_relp_def2[of p' w p1 y] by auto thenobtain γ w' wa where γ_w'_wa_p: " w = γ # w' ∧ y = lbl wa @ w' ∧ (p', γ) ↪ (p1, wa)" by metis thenhave"(p, u @ v) ==>* (p1, y @ v)" by (metis (no_types, lifting) PDS.step_relp_def2 append.assoc append_Cons rtranclp.simps step_3) thenshow ?case by (simp add: p1_def p_def u_def y_def) qed
lemma step_relp_append: assumes"(p, u) ==>* (p1, y)" shows"(p, u @ v) ==>* (p1, y @ v)" using assms step_relp_append_aux by auto
lemma step_relp_append_empty: assumes"(p, u) ==>* (p1, [])" shows"(p, u @ v) ==>* (p1, v)" using step_relp_append[OF assms] by auto
lemma lemma_3_2_a': assumes"inits ⊆ LTS.srcs A" assumes"pre_star_rule** A A'" assumes"(Init p, w, q) ∈ LTS.trans_star A'" shows"∃p' w'. (Init p', w', q) ∈ LTS.trans_star A ∧ (p, w) ==>* (p', w')" using assms(2) assms(3) proof (induction arbitrary: p q w rule: rtranclp_induct) case base thenhave"(Init p, w, q) ∈ LTS.trans_star A ∧ (p, w) ==>* (p, w)" by auto thenshow ?case by auto next case (step Aiminus1 Ai)
from j_def ss_p show ?case proof (induction j arbitrary: p q w ss) case0 thenhave"(Init p, w, q) ∈ LTS.trans_star Aiminus1" using count_zero_remove_trans_star_states_trans_star p1_γ_p2_w2_q'_p(1) t_def by metis thenshow ?case using step.IH by metis next case (Suc j') have"∃u v u_ss v_ss. ss = u_ss@v_ss ∧ w = u@[γ]@v ∧ (Init p,u,u_ss, Init p1) ∈ LTS.trans_star_states Aiminus1 ∧ (Init p1,[γ],q') ∈ LTS.trans_star Ai ∧ (q',v,v_ss,q) ∈ LTS.trans_star_states Ai ∧ (Init p, w, ss, q) = ((Init p, u, u_ss, Init p1), γ) @@\<gamma> (q', v, v_ss, q)" using split_at_first_t[of "Init p" w ss q Ai j' "Init p1" γ q' Aiminus1] using Suc(2,3) t_def p1_γ_p2_w2_q'_p(1,4) t_def by auto thenobtain u v u_ss v_ss where u_v_u_ss_v_ss_p: "ss = u_ss@v_ss ∧ w = u@[γ]@v" "(Init p,u,u_ss, Init p1) ∈ LTS.trans_star_states Aiminus1" "(Init p1,[γ],q') ∈ LTS.trans_star Ai" "(q',v,v_ss,q) ∈ LTS.trans_star_states Ai" "(Init p, w, ss, q) = ((Init p, u, u_ss, Init p1), γ) @@\<gamma> (q', v, v_ss, q)" by blast from this(2) have"∃p'' w''. (Init p'', w'', Init p1) ∈ LTS.trans_star A ∧ (p, u) ==>* (p'', w'')" using Suc(1)[of p u _ "Init p1"] step.IH step.prems(1) by (meson LTS.trans_star_states_trans_star LTS.trans_star_trans_star_states) from this this(1) have VIII: "(p, u) ==>* (p1, [])" using word_into_init_empty assms(1) by blast
note IX = p1_γ_p2_w2_q'_p(2) note III = p1_γ_p2_w2_q'_p(3) from III have III_2: "∃w2_ss. (Init p2, lbl w2, w2_ss, q') ∈ LTS.trans_star_states Aiminus1" using LTS.trans_star_trans_star_states[of "Init p2""lbl w2" q' Aiminus1] by auto thenobtain w2_ss where III_2: "(Init p2, lbl w2, w2_ss, q') ∈ LTS.trans_star_states Aiminus1" by blast
from III have V: "(Init p2, lbl w2, w2_ss, q') ∈ LTS.trans_star_states Aiminus1" "(q', v, v_ss, q) ∈ LTS.trans_star_states Ai" using III_2 ‹(q', v, v_ss, q) ∈ LTS.trans_star_states Ai›by auto
have"countts (Init p, w, ss, q) = Suc j' " using Suc.prems(1) countts_def by force moreover have"countts (Init p, u, u_ss, Init p1) = 0" using LTS.avoid_count_zero countts_def p1_γ_p2_w2_q'_p(4) t_def u_v_u_ss_v_ss_p(2) by fastforce moreover from u_v_u_ss_v_ss_p(5) have"countts (Init p, w, ss, q) = countts (Init p, u, u_ss, Init p1) + 1 + countts (q', v, v_ss, q)" using count_combine_trans_star_states countts_def t_def u_v_u_ss_v_ss_p(2)
u_v_u_ss_v_ss_p(4) by fastforce ultimately have"Suc j' = 0 + 1 + countts (q', v, v_ss, q)" by auto thenhave"j' = countts (q', v, v_ss, q)" by auto moreover have"countts (Init p2, lbl w2, w2_ss, q') = 0" using III_2 LTS.avoid_count_zero countts_def p1_γ_p2_w2_q'_p(4) t_def by fastforce moreover have"(Init p2, w2v, w2v_ss, q) = (Init p2, lbl w2, w2_ss, q') @@🍋 (q', v, v_ss, q)" using w2v_def w2v_ss_def by auto thenhave"countts (Init p2, w2v, w2v_ss, q) = countts (Init p2, lbl w2, w2_ss, q') + countts (q', v, v_ss, q)" using‹(Init p2, lbl w2, w2_ss, q') ∈ LTS.trans_star_states Ai›
count_append_trans_star_states countts_def t_def u_v_u_ss_v_ss_p(4) by fastforce ultimately show ?thesis by (simp add: countts_def) qed
have"∃p' w'. (Init p', w', q) ∈ LTS.trans_star A ∧ (p2, w2v) ==>* (p', w')" using Suc(1) using j'_count V_merged by auto thenobtain p' w' where p'_w'_p: "(Init p', w', q) ∈ LTS.trans_star A""(p2, w2v) ==>*(p', w')" by blast
note X = p'_w'_p(2)
have"(p,w) = (p,u@[γ]@v)" using‹ss = u_ss @ v_ss ∧ w = u @ [γ] @ v›by blast
have"(p,u@[γ]@v) ==>* (p1,γ#v)" using VIII step_relp_append_empty by auto
from X have"(p1,γ#v) ==> (p2, w2v)" by (metis IX LTS.step_relp_def transition_rel.intros w2v_def)
from X have "(p2, w2v) ==>* (p', w')" by simp
have"(p, w) ==>* (p', w')" using X ‹(p, u @ [γ] @ v) ==>* (p1, γ # v)›‹(p, w) = (p, u @ [γ] @ v)›‹(p1, γ # v) ==> (p2, w2v)›by auto
thenhave"(Init p', w', q) ∈ LTS.trans_star A ∧ (p, w) ==>* (p', w')" using p'_w'_p(1) by auto thenshow ?case by metis qed qed
lemma lemma_3_2_a: assumes"inits ⊆ LTS.srcs A" assumes"saturation pre_star_rule A A'" assumes"(Init p, w, q) ∈ LTS.trans_star A'" shows"∃p' w'. (Init p', w', q) ∈ LTS.trans_star A ∧ (p, w) ==>* (p', w')" using assms lemma_3_2_a' saturation_def by metis
― ‹Corresponds to one direction of Schwoon's theorem 3.2› theorem pre_star_rule_subset_pre_star_lang: assumes"inits ⊆ LTS.srcs A" assumes"pre_star_rule** A A'" shows"{c. accepts A' c} ⊆ pre_star (lang A)" proof fix c :: "'ctr_loc × 'label list" assume c_a: "c ∈ {w. accepts A' w}"
define p where"p = fst c"
define w where"w = snd c" from p_def w_def c_a have"accepts A' (p,w)" by auto thenhave"∃q ∈ finals. (Init p, w, q) ∈ LTS.trans_star A'" unfolding accepts_def by auto thenobtain q where q_p: "q ∈ finals""(Init p, w, q) ∈ LTS.trans_star A'" by auto thenhave"∃p' w'. (p,w) ==>* (p',w') ∧ (Init p', w', q) ∈ LTS.trans_star A" using lemma_3_2_a' assms(1) assms(2) by metis thenobtain p' w' where p'_w'_p: "(p,w) ==>* (p',w')""(Init p', w', q) ∈ LTS.trans_star A" by auto thenhave"(p', w') ∈ lang A" unfolding lang_def unfolding accepts_def using q_p(1) by auto thenhave"(p,w) ∈ pre_star (lang A)" unfolding pre_star_def using p'_w'_p(1) by auto thenshow"c ∈ pre_star (lang A)" unfolding p_def w_def by auto qed
― ‹Corresponds to Schwoon's theorem 3.2› theorem pre_star_rule_accepts_correct: assumes"inits ⊆ LTS.srcs A" assumes"saturation pre_star_rule A A'" shows"{c. accepts A' c} = pre_star (lang A)" proof (rule; rule) fix c :: "'ctr_loc × 'label list"
define p where"p = fst c"
define w where"w = snd c" assume"c ∈ pre_star (lang A)" thenhave"(p,w) ∈ pre_star (lang A)" unfolding p_def w_def by auto thenhave"∃p' w'. (p',w') ∈ lang A ∧ (p,w) ==>* (p',w')" unfolding pre_star_def by force thenobtain p' w' where"(p',w') ∈ lang A ∧ (p,w) ==>* (p',w')" by auto thenhave"∃q ∈ finals. (Init p, w, q) ∈ LTS.trans_star A'" using lemma_3_1 assms(2) unfolding accepts_def by force thenhave"accepts A' (p,w)" unfolding accepts_def by auto thenshow"c ∈ {c. accepts A' c}" using p_def w_def by auto next fix c :: "'ctr_loc × 'label list" assume"c ∈ {w. accepts A' w}" thenshow"c ∈ pre_star (lang A)" using pre_star_rule_subset_pre_star_lang assms unfolding saturation_def by auto qed
― ‹Corresponds to Schwoon's theorem 3.2› theorem pre_star_rule_correct: assumes"inits ⊆ LTS.srcs A" assumes"saturation pre_star_rule A A'" shows"lang A' = pre_star (lang A)" using assms(1) assms(2) lang_def pre_star_rule_accepts_correct by auto
theorem pre_star_exec_accepts_correct: assumes"inits ⊆ LTS.srcs A" shows"{c. accepts (pre_star_exec A) c} = pre_star (lang A)" using pre_star_rule_accepts_correct[of A "pre_star_exec A"] saturation_pre_star_exec[of A]
assms by auto
theorem pre_star_exec_lang_correct: assumes"inits ⊆ LTS.srcs A" shows"lang (pre_star_exec A) = pre_star (lang A)" using pre_star_rule_correct[of A "pre_star_exec A"] saturation_pre_star_exec[of A] assms by auto
theorem pre_star_exec_check_accepts_correct: assumes"pre_star_exec_check A ≠ None" shows"{c. accepts (the (pre_star_exec_check A)) c} = pre_star (lang A)" using pre_star_exec_accepts_correct assms unfolding pre_star_exec_check_def pre_star_exec_def by (auto split: if_splits)
theorem pre_star_exec_check_correct: assumes"pre_star_exec_check A ≠ None" shows"lang (the (pre_star_exec_check A)) = pre_star (lang A)" using pre_star_exec_check_accepts_correct assms unfolding lang_def by auto
theorem accept_pre_star_exec_correct_True: assumes"inits ⊆ LTS.srcs A" assumes"accepts (pre_star_exec A) c" shows"c ∈ pre_star (lang A)" using pre_star_exec_accepts_correct assms(1) assms(2) by blast
theorem accept_pre_star_exec_correct_False: assumes"inits ⊆ LTS.srcs A" assumes"¬accepts (pre_star_exec A) c" shows"c ∉ pre_star (lang A)" using pre_star_exec_accepts_correct assms(1) assms(2) by blast
theorem accept_pre_star_exec_correct_Some_True: assumes"accept_pre_star_exec_check A c = Some True" shows"c ∈ pre_star (lang A)" proof - have"inits ⊆ LTS.srcs A" using assms unfolding accept_pre_star_exec_check_def by (auto split: if_splits) moreover have"accepts (pre_star_exec A) c" using assms using accept_pre_star_exec_check_def calculation by auto ultimately show"c ∈ pre_star (lang A)" using accept_pre_star_exec_correct_True by auto qed
theorem accept_pre_star_exec_correct_Some_False: assumes"accept_pre_star_exec_check A c = Some False" shows"c ∉ pre_star (lang A)" proof - have"inits ⊆ LTS.srcs A" using assms unfolding accept_pre_star_exec_check_def by (auto split: if_splits) moreover have"¬accepts (pre_star_exec A) c" using assms using accept_pre_star_exec_check_def calculation by auto ultimately show"c ∉ pre_star (lang A)" using accept_pre_star_exec_correct_False by auto qed
theorem accept_pre_star_exec_correct_None: assumes"accept_pre_star_exec_check A c = None" shows"¬inits ⊆ LTS.srcs A" using assms unfolding accept_pre_star_exec_check_def by auto
subsection‹Post* lemmas›
lemma lemma_3_3': assumes"pv ==>* p'w" and"(fst pv, snd pv) ∈ lang_ε A" and"saturation post_star_rules A A'" shows"accepts_ε A' (fst p'w, snd p'w)" using assms proof (induct arbitrary: pv rule: rtranclp_induct) case base show ?case using assms post_star_lim'_incr_trans_star_ε by (auto simp: lang_ε_def accepts_ε_def) next case (step p''u p'w)
define p' where"p' = fst p'w"
define w where"w = snd p'w"
define p'' where"p'' = fst p''u"
define u where"u = snd p''u" have p'w_def: "p'w = (p', w)" using p'_def w_def by auto have p''u_def: "p''u = (p'', u)" using p''_def u_def by auto
thenhave"accepts_ε A' (p'', u)" using assms(2) p''_def step.hyps(3) step.prems(2) u_def by metis thenhave"∃q. q ∈ finals ∧ (Init p'', u, q) ∈ LTS_ε.trans_star_ε A'" by (auto simp: accepts_ε_def) thenobtain q where q_p: "q ∈ finals ∧ (Init p'', u, q) ∈ LTS_ε.trans_star_ε A'" by metis thenhave"∃u_ε. q ∈ finals ∧ LTS_ε.ε_exp u_ε u ∧ (Init p'', u_ε, q) ∈ LTS.trans_star A'" using LTS_ε.trans_star_ε_iff_ε_exp_trans_star[of "Init p''" u q A'] by auto thenobtain u_ε where II: "q ∈ finals""LTS_ε.ε_exp u_ε u""(Init p'', u_ε, q) ∈ LTS.trans_star A'" by blast have"∃γ u1 w1. u=γ#u1 ∧ w=lbl w1@u1 ∧ (p'', γ) ↪ (p', w1)" using p''u_def p'w_def step.hyps(2) step_relp_def2 by auto thenobtain γ u1 w1 where III: "u=γ#u1""w=lbl w1@u1""(p'', γ) ↪ (p', w1)" by blast
have p'_inits: "Init p' ∈ inits" unfolding inits_def by auto have p''_inits: "Init p'' ∈ inits" unfolding inits_def by auto
have"∃γ_ε u1_ε. LTS_ε.ε_exp γ_ε [γ] ∧ LTS_ε.ε_exp u1_ε u1 ∧ (Init p'', γ_ε@u1_ε, q) ∈ LTS.trans_star A'" proof - have"∃γ_ε u1_ε. LTS_ε.ε_exp γ_ε [γ] ∧ LTS_ε.ε_exp u1_ε u1 ∧ u_ε = γ_ε @ u1_ε" using LTS_ε.ε_exp_split'[of u_ε γ u1] II(2) III(1) by auto thenobtain γ_ε u1_ε where"LTS_ε.ε_exp γ_ε [γ] ∧ LTS_ε.ε_exp u1_ε u1 ∧ u_ε = γ_ε @ u1_ε" by auto thenhave"(Init p'', γ_ε@u1_ε , q) ∈ LTS.trans_star A'" using II(3) by auto thenshow ?thesis using‹LTS_ε.ε_exp γ_ε [γ] ∧ LTS_ε.ε_exp u1_ε u1 ∧ u_ε = γ_ε @ u1_ε›by blast qed thenobtain γ_ε u1_ε where
iii: "LTS_ε.ε_exp γ_ε [γ]"and
iv: "LTS_ε.ε_exp u1_ε u1""(Init p'', γ_ε@u1_ε, q) ∈ LTS.trans_star A'" by blast thenhave VI: "∃q1. (Init p'', γ_ε, q1) ∈ LTS.trans_star A' ∧ (q1, u1_ε, q) ∈ LTS.trans_star A'" by (simp add: LTS.trans_star_split) thenobtain q1 where VI: "(Init p'', γ_ε, q1) ∈ LTS.trans_star A'""(q1, u1_ε, q) ∈ LTS.trans_star A'" by blast
thenhave VI_2: "(Init p'', [γ], q1) ∈ LTS_ε.trans_star_ε A'""(q1, u1, q) ∈ LTS_ε.trans_star_ε A'" by (meson LTS_ε.trans_star_ε_iff_ε_exp_trans_star iii VI(2) iv(1))+
show ?case proof (cases w1) case pop thenhave r: "(p'', γ) ↪ (p', pop)" using III(3) by blast thenhave"(Init p', ε, q1) ∈ A'" using VI_2(1) add_trans_pop assms saturated_def saturation_def p'_inits by metis thenhave"(Init p', w, q) ∈ LTS_ε.trans_star_ε A'" using III(2) VI_2(2) pop LTS_ε.trans_star_ε.trans_star_ε_step_ε by fastforce thenhave"accepts_ε A' (p', w)" unfolding accepts_ε_defusing II(1) by blast thenshow ?thesis using p'_def w_def by force next case (swap γ') thenhave r: "(p'', γ) ↪ (p', swap γ')" using III(3) by blast thenhave"(Init p', Some γ', q1) ∈ A'" by (metis VI_2(1) add_trans_swap assms(3) saturated_def saturation_def) have"(Init p', w, q) ∈ LTS_ε.trans_star_ε A'" using III(2) LTS_ε.trans_star_ε.trans_star_ε_step_γ VI_2(2) append_Cons append_self_conv2
lbl.simps(3) swap ‹(Init p', Some γ', q1) ∈ A'›by fastforce thenhave"accepts_ε A' (p', w)" unfolding accepts_ε_def using II(1) by blast thenshow ?thesis using p'_def w_def by force next case (push γ' γ'') thenhave r: "(p'', γ) ↪ (p', push γ' γ'')" using III(3) by blast from this VI_2 iii post_star_rules.intros(3)[OF this, of q1 A', OF VI_2(1)] have"(Init p', Some γ', Isolated p' γ') ∈ A'" using assms(3) by (meson saturated_def saturation_def) from this r VI_2 iii post_star_rules.intros(4)[OF r, of q1 A', OF VI_2(1)] have"(Isolated p' γ', Some γ'', q1) ∈ A'" using assms(3) using saturated_def saturation_def by metis have"(Init p', [γ'], Isolated p' γ') ∈ LTS_ε.trans_star_ε A' ∧ (Isolated p' γ', [γ''], q1) ∈ LTS_ε.trans_star_ε A' ∧ (q1, u1, q) ∈ LTS_ε.trans_star_ε A'" by (metis LTS_ε.trans_star_ε.simps VI_2(2) ‹(Init p', Some γ', Isolated p' γ') ∈ A'› ‹(Isolated p' γ', Some γ'', q1) ∈ A'›) have"(Init p', w, q) ∈ LTS_ε.trans_star_ε A'" using III(2) VI_2(2) ‹(Init p', Some γ', Isolated p' γ') ∈ A'› ‹(Isolated p' γ', Some γ'', q1) ∈ A'› push LTS_ε.append_edge_edge_trans_star_ε by auto thenhave"accepts_ε A' (p', w)" unfolding accepts_ε_def using II(1) by blast thenshow ?thesis using p'_def w_def by force
qed qed
lemma lemma_3_3: assumes"(p,v) ==>* (p',w)" and"(p, v) ∈ lang_ε A" and"saturation post_star_rules A A'" shows"accepts_ε A' (p', w)" using assms lemma_3_3' by force
lemma init_only_hd: assumes"(ss, w) ∈ LTS.path_with_word A" assumes"inits ⊆ LTS.srcs A" assumes"count (transitions_of (ss, w)) t > 0" assumes"t = (Init p1, γ, q1)" shows"hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" using assms LTS.source_only_hd by (metis LTS.srcs_def2 inits_srcs_iff_Ctr_Loc_srcs)
lemma no_edge_to_Ctr_Loc_post_star_rules': assumes"post_star_rules** A Ai" assumes"∄q γ q'. (q, γ, Init q') ∈ A" shows"∄q γ q'. (q, γ, Init q') ∈ Ai" using assms proof (induction rule: rtranclp_induct) case base thenshow ?caseby auto next case (step Aiminus1 Ai) thenhave ind: "∄q γ q'. (q, γ, Init q') ∈ Aiminus1" by auto from step(2) show ?case proof (cases rule: post_star_rules.cases) case (add_trans_pop p γ p' q) have"q ∉ inits" using ind no_edge_to_Ctr_Loc_avoid_Ctr_Loc_ε inits_srcs_iff_Ctr_Loc_srcs by (metis local.add_trans_pop(3)) thenhave"∄qq. q = Init qq" by (simp add: inits_def is_Init_def) thenshow ?thesis using ind local.add_trans_pop(1) by auto next case (add_trans_swap p γ p' γ' q) have"q ∉ inits" using add_trans_swap ind no_edge_to_Ctr_Loc_avoid_Ctr_Loc_ε inits_srcs_iff_Ctr_Loc_srcs by metis thenhave"∄qq. q = Init qq" by (simp add: inits_def is_Init_def) thenshow ?thesis using ind local.add_trans_swap(1) by auto next case (add_trans_push_1 p γ p' γ' γ'' q) have"q ∉ inits" using add_trans_push_1 ind no_edge_to_Ctr_Loc_avoid_Ctr_Loc_ε inits_srcs_iff_Ctr_Loc_srcs by metis thenhave"∄qq. q = Init qq" by (simp add: inits_def is_Init_def) thenshow ?thesis using ind local.add_trans_push_1(1) by auto next case (add_trans_push_2 p γ p' γ' γ'' q) have"q ∉ inits" using add_trans_push_2 ind no_edge_to_Ctr_Loc_avoid_Ctr_Loc_ε inits_srcs_iff_Ctr_Loc_srcs by metis thenhave"∄qq. q = Init qq" by (simp add: inits_def is_Init_def) thenshow ?thesis using ind local.add_trans_push_2(1) by auto qed qed
lemma no_edge_to_Ctr_Loc_post_star_rules: assumes"post_star_rules** A Ai" assumes"inits ⊆ LTS.srcs A" shows"inits ⊆ LTS.srcs Ai" using assms no_edge_to_Ctr_Loc_post_star_rules' inits_srcs_iff_Ctr_Loc_srcs by metis
lemma source_and_sink_isolated: assumes"N ⊆ LTS.srcs A" assumes"N ⊆ LTS.sinks A" shows"∀p γ q. (p, γ, q) ∈ A ⟶ p ∉ N ∧ q ∉ N" by (metis LTS.srcs_def2 LTS.sinks_def2 assms(1) assms(2) in_mono)
lemma post_star_rules_Isolated_source_invariant': assumes"post_star_rules** A A'" assumes"isols ⊆ LTS.isolated A" assumes"(Init p', Some γ', Isolated p' γ') ∉ A'" shows"∄p γ. (p, γ, Isolated p' γ') ∈ A'" using assms proof (induction rule: rtranclp_induct) case base thenshow ?case unfolding isols_def is_Isolated_def using LTS.isolated_no_edges by fastforce next case (step Aiminus1 Ai) from step(2) show ?case proof (cases rule: post_star_rules.cases) case (add_trans_pop p''' γ'' p'' q) thenhave"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenhave nin: "∄p γ. (p, γ, Isolated p' γ') ∈ Aiminus1" usinglocal.add_trans_pop(1) step.IH step.prems(1,2) by fastforce thenhave"Isolated p' γ' ≠ q" using add_trans_pop(4) LTS_ε.trans_star_not_to_source_ε LTS.srcs_def2 by (metis local.add_trans_pop(3) state.distinct(3)) thenhave"∄p γ. (p, γ, Isolated p' γ') = (Init p'', ε, q)" by auto thenshow ?thesis using nin add_trans_pop(1) by auto next case (add_trans_swap p'''' γ'' p'' γ''' q) thenhave"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenhave nin: "∄p γ. (p, γ, Isolated p' γ') ∈ Aiminus1" usinglocal.add_trans_swap(1) step.IH step.prems(1,2) by fastforce thenhave"Isolated p' γ' ≠ q" using LTS.srcs_def2 by (metis state.distinct(4) LTS_ε.trans_star_not_to_source_ε local.add_trans_swap(3)) thenhave"∄p γ. (p, γ, Isolated p' γ') = (Init p'', Some γ''', q)" by auto thenshow ?thesis using nin add_trans_swap(1) by auto next case (add_trans_push_1 p'''' γ'' p'' γ''' γ''''' q) thenhave"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenshow ?thesis using add_trans_push_1(1) Un_iff state.inject(2) prod.inject singleton_iff step.IH
step.prems(1,2) by blast next case (add_trans_push_2 p'''' γ'' p'' γ''' γ'''' q) have"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) . thenhave nin: "∄p γ. (p, γ, Isolated p' γ') ∈ Aiminus1" usinglocal.add_trans_push_2(1) step.IH step.prems(1) by fastforce thenhave"Isolated p' γ' ≠ q" using LTS.srcs_def2 local.add_trans_push_2(3) by (metis state.disc(1,3) LTS_ε.trans_star_not_to_source_ε) thenhave"∄p γ. (p, γ, Isolated p' γ') = (Init p'', ε, q)" by auto thenshow ?thesis using nin add_trans_push_2(1) by auto qed qed
lemma post_star_rules_Isolated_source_invariant: assumes"post_star_rules** A A'" assumes"isols ⊆ LTS.isolated A" assumes"(Init p', Some γ', Isolated p' γ') ∉ A'" shows"Isolated p' γ' ∈ LTS.srcs A'" by (meson LTS.srcs_def2 assms(1) assms(2) assms(3) post_star_rules_Isolated_source_invariant')
lemma post_star_rules_Isolated_sink_invariant': assumes"post_star_rules** A A'" assumes"isols ⊆ LTS.isolated A" assumes"(Init p', Some γ', Isolated p' γ') ∉ A'" shows"∄p γ. (Isolated p' γ', γ, p) ∈ A'" using assms proof (induction rule: rtranclp_induct) case base thenshow ?case unfolding isols_def is_Isolated_def using LTS.isolated_no_edges by fastforce next case (step Aiminus1 Ai) from step(2) show ?case proof (cases rule: post_star_rules.cases) case (add_trans_pop p''' γ'' p'' q) thenhave"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenhave nin: "∄p γ. (Isolated p' γ', γ, p) ∈ Aiminus1" usinglocal.add_trans_pop(1) step.IH step.prems(1,2) by fastforce thenhave"Isolated p' γ' ≠ q" using add_trans_pop(4)
LTS_ε.trans_star_not_to_source_ε[of "Init p'''""[γ'']" q Aiminus1 "Isolated p' γ'"]
post_star_rules_Isolated_source_invariant local.add_trans_pop(1) step.hyps(1) step.prems(1,2)
UnI1 local.add_trans_pop(3) by (metis (full_types) state.distinct(3)) thenhave"∄p γ. (p, γ, Isolated p' γ') = (Init p'', ε, q)" by auto thenshow ?thesis using nin add_trans_pop(1) by auto next case (add_trans_swap p'''' γ'' p'' γ''' q) thenhave"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenhave nin: "∄p γ. (Isolated p' γ', γ, p) ∈ Aiminus1" usinglocal.add_trans_swap(1) step.IH step.prems(1,2) by fastforce thenhave"Isolated p' γ' ≠ q" using LTS_ε.trans_star_not_to_source_ε[of "Init p''''""[γ'']" q Aiminus1] local.add_trans_swap(3) post_star_rules_Isolated_source_invariant[of _ Aiminus1 p' γ'] UnCI local.add_trans_swap(1) step.hyps(1) step.prems(1,2) state.simps(7) by metis thenhave"∄p γ. (p, γ, Isolated p' γ') = (Init p'', Some γ''', q)" by auto thenshow ?thesis using nin add_trans_swap(1) by auto next case (add_trans_push_1 p'''' γ'' p'' γ''' γ''''' q) thenhave"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenshow ?thesis using add_trans_push_1(1) Un_iff state.inject prod.inject singleton_iff step.IH
step.prems(1,2) by blast next case (add_trans_push_2 p'''' γ'' p'' γ''' γ'''' q) have"(Init p', Some γ', Isolated p' γ') ∉ Ai" using step.prems(2) by blast thenhave nin: "∄p γ. (Isolated p' γ', γ, p) ∈ Aiminus1" usinglocal.add_trans_push_2(1) step.IH step.prems(1,2) by fastforce thenhave"Isolated p' γ' ≠ q" using state.disc(3)
LTS_ε.trans_star_not_to_source_ε[of "Init p''''""[γ'']" q Aiminus1 "Isolated p' γ'"] local.add_trans_push_2(3) using post_star_rules_Isolated_source_invariant[of _ Aiminus1 p' γ'] UnCI local.add_trans_push_2(1) step.hyps(1) step.prems(1,2) state.disc(1) by metis thenhave"∄p γ. (Isolated p' γ', γ, p) = (Init p'', ε, q)" by auto thenshow ?thesis using nin add_trans_push_2(1) usinglocal.add_trans_push_2 step.prems(2) by auto qed qed
lemma post_star_rules_Isolated_sink_invariant: assumes"post_star_rules** A A'" assumes"isols ⊆ LTS.isolated A" assumes"(Init p', Some γ', Isolated p' γ') ∉ A'" shows"Isolated p' γ' ∈ LTS.sinks A'" by (meson LTS.sinks_def2 assms(1,2,3) post_star_rules_Isolated_sink_invariant')
― ‹Corresponds to Schwoon's lemma 3.4› lemma rtranclp_post_star_rules_constains_successors_states: assumes"post_star_rules** A A'" assumes"inits ⊆ LTS.srcs A" assumes"isols ⊆ LTS.isolated A" assumes"(Init p, w, ss, q) ∈ LTS.trans_star_states A'" shows"(¬is_Isolated q ⟶ (∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p',w')==>* (p, LTS_ε.remove_ε w))) ∧ (is_Isolated q ⟶ (the_Ctr_Loc q, [the_Label q]) ==>* (p, LTS_ε.remove_ε w))" using assms proof (induction arbitrary: p q w ss rule: rtranclp_induct) case base
{ assume ctr_loc: "is_Init q ∨ is_Noninit q" thenhave"(Init p, LTS_ε.remove_ε w, q) ∈ LTS_ε.trans_star_ε A" using base LTS_ε.trans_star_states_trans_star_ε by metis thenhave"∃p' w'. (p', w', q) ∈ LTS_ε.trans_star_ε A" by auto thenhave ?case using ctr_loc ‹(Init p, LTS_ε.remove_ε w, q) ∈ LTS_ε.trans_star_ε A›by blast
} moreover
{ assume"is_Isolated q" thenhave ?case proof (cases w) case Nil thenhave False using base using LTS.trans_star_empty LTS.trans_star_states_trans_star ‹is_Isolated q› by (metis state.disc(7)) thenshow ?thesis by metis next case (Cons γ w_rest) thenhave"(Init p, γ#w_rest, ss, q) ∈ LTS.trans_star_states A" using base Cons by blast thenhave"∃s γ'. (s, γ', q) ∈ A" using LTS.trans_star_states_transition_relation by metis thenhave False using‹is_Isolated q› isols_def base.prems(2) LTS.isolated_no_edges by (metis mem_Collect_eq subset_eq) thenshow ?thesis by auto qed
} ultimately show ?case by (meson state.exhaust_disc) next case (step Aiminus1 Ai) from step(2) have"∃p1 γ p2 w2 q1. Ai = Aiminus1 ∪ {(p1, γ, q1)} ∧ (p1, γ, q1) ∉ Aiminus1" by (cases rule: post_star_rules.cases) auto thenobtain p1 γ q1 where p1_γ_p2_w2_q'_p: "Ai = Aiminus1 ∪ {(p1, γ, q1)}" "(p1, γ, q1) ∉ Aiminus1" by auto
from j_def ss_p show ?case proof (induction j arbitrary: p q w ss) case0 thenhave"(Init p, w, ss, q) ∈ LTS.trans_star_states Aiminus1" using count_zero_remove_path_with_word_trans_star_states p1_γ_p2_w2_q'_p(1) t_def by metis thenshow ?case using step by auto next case (Suc j) from step(2) show ?case proof (cases rule: post_star_rules.cases) case (add_trans_pop p2 γ2 p1 q1) (* Note: p1 shadows p1 from above. q1 shadows q1 from above. *) note III = add_trans_pop(3) note VI = add_trans_pop(2) have t_def: "t = (Init p1, ε, q1)" usinglocal.add_trans_pop(1) local.add_trans_pop p1_γ_p2_w2_q'_p(1) t_def by blast have init_Ai: "inits ⊆ LTS.srcs Ai" using step(1,2) step(4) using no_edge_to_Ctr_Loc_post_star_rules using r_into_rtranclp by (metis) have t_hd_once: "hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" proof - have"(ss, w) ∈ LTS.path_with_word Ai" using Suc(3) LTS.trans_star_states_path_with_word by metis moreover have"inits ⊆ LTS.srcs Ai" using init_Ai by auto moreover have"0 < count (transitions_of (ss, w)) t" by (metis Suc.prems(1) transitions_of'.simps zero_less_Suc) moreover have"t = (Init p1, ε, q1)" using t_def by auto moreover have"Init p1 ∈ inits" by (simp add: inits_def) ultimately show"hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" using init_only_hd[of ss w Ai t p1 ε q1] by auto qed
have"transition_list (ss, w) ≠ []" by (metis LTS.trans_star_states_path_with_word LTS.path_with_word.simps Suc.prems(1)
Suc.prems(2) count_empty less_not_refl2 list.distinct(1) transition_list.simps(1)
transitions_of'.simps transitions_of.simps(2) zero_less_Suc) thenhave ss_w_split: "([Init p1,q1], [ε]) @🍋 (tl ss, tl w) = (ss, w)" using t_hd_once t_def hd_transition_list_append_path_with_word by metis thenhave ss_w_split': "(Init p1, [ε], [Init p1,q1], q1) @@🍋 (q1, tl w, tl ss, q) = (Init p1, w, ss, q)" by auto have VII: "p = p1" proof - have"(Init p, w, ss, q) ∈ LTS.trans_star_states Ai" using Suc.prems(2) by blast moreover have"t = hd (transition_list' (Init p, w, ss, q))" using‹hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1› by fastforce moreover have"transition_list' (Init p, w, ss, q) ≠ []" by (simp add: ‹transition_list (ss, w) ≠ []›) moreover have"t = (Init p1, ε, q1)" using t_def by auto ultimately show"p = p1" using LTS.hd_is_hd by fastforce qed have"j=0" using Suc(2) ‹hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1› by force have"(Init p1, [ε], [Init p1, q1], q1) ∈ LTS.trans_star_states Ai" proof - have"(Init p1, ε, q1) ∈ Ai" usinglocal.add_trans_pop(1) by auto moreover have"(Init p1, ε, q1) ∉ Aiminus1" by (simp add: local.add_trans_pop) ultimately show"(Init p1, [ε], [Init p1, q1], q1) ∈ LTS.trans_star_states Ai" by (meson LTS.trans_star_states.trans_star_states_refl
LTS.trans_star_states.trans_star_states_step) qed have"(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1" proof - from Suc(3) have"(ss, w) ∈ LTS.path_with_word Ai" by (meson LTS.trans_star_states_path_with_word) thenhave tl_ss_w_Ai: "(tl ss, tl w) ∈ LTS.path_with_word Ai" by (metis LTS.path_with_word.simps ‹transition_list (ss, w) ≠ []› list.sel(3)
transition_list.simps(2)) from t_hd_once have zero_p1_ε_q1: "0 = count (transitions_of (tl ss, tl w)) (Init p1, ε, q1)" using count_append_path_with_word_γ[of "[hd ss]""[]""tl ss""hd w""tl w""Init p1" ε q1, simplified] ‹(Init p1, [ε], [Init p1, q1], q1) ∈ LTS.trans_star_states Ai› ‹transition_list (ss, w) ≠ []› Suc.prems(2) VII
LTS.transition_list_Cons[of "Init p" w ss q Ai ε q1] by (auto simp: t_def) have Ai_Aiminus1: "Ai = Aiminus1 ∪ {(Init p1, ε, q1)}" usinglocal.add_trans_pop(1) by auto from t_hd_once tl_ss_w_Ai zero_p1_ε_q1 Ai_Aiminus1
count_zero_remove_path_with_word[OF tl_ss_w_Ai, of "Init p1" ε q1 Aiminus1] have"(tl ss, tl w) ∈ LTS.path_with_word Aiminus1" by auto moreover have"hd (tl ss) = q1" using Suc.prems(2) VII ‹transition_list (ss, w) ≠ []› t_def
LTS.transition_list_Cons t_hd_once by fastforce moreover have"last ss = q" by (metis LTS.trans_star_states_last Suc.prems(2)) ultimately show"(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1" by (metis (no_types, lifting) LTS.trans_star_states_path_with_word
LTS.path_with_word_trans_star_states LTS.path_with_word_not_empty Suc.prems(2)
last_ConsR list.collapse) qed have"w = ε # (tl w)" by (metis Suc(3) VII ‹transition_list (ss, w) ≠ []› list.distinct(1) list.exhaust_sel
list.sel(1) t_def LTS.transition_list_Cons t_hd_once) thenhave w_tl_ε: "LTS_ε.remove_ε w = LTS_ε.remove_ε (tl w)" by (metis LTS_ε.remove_ε_def removeAll.simps(2))
have"∃γ2'. LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1" using add_trans_pop by (simp add: LTS_ε.trans_star_ε_ε_exp_trans_star) thenobtain γ2' where"LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1" by blast thenhave"∃ss2. (Init p2, γ2', ss2, q1) ∈ LTS.trans_star_states Aiminus1" by (simp add: LTS.trans_star_trans_star_states) thenobtain ss2 where IIII_1: "(Init p2, γ2', ss2, q1) ∈ LTS.trans_star_states Aiminus1" by blast have IIII_2: "(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1" using ss_w_split' Suc(3) Suc(2) ‹j=0› using‹(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1›by blast have IIII: "(Init p2, γ2' @ tl w, ss2 @ (tl (tl ss)), q) ∈ LTS.trans_star_states Aiminus1" using IIII_1 IIII_2 by (meson LTS.trans_star_states_append)
from Suc(1)[of p2 "γ2' @ tl w""ss2 @ (tl (tl ss))" q] have V: "(¬is_Isolated q ⟶ (∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)))) ∧ (is_Isolated q ⟶ (the_Ctr_Loc q, [the_Label q]) ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)))" using IIII using step.IH step.prems(1,2,3) by blast
have"¬is_Isolated q ∨ is_Isolated q" using state.exhaust_disc by blast thenshow ?thesis proof assume ctr_q: "¬is_Isolated q" thenhave"∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" using V by auto thenobtain p' w' where
VIII:"(Init p', w', q) ∈ LTS_ε.trans_star_ε A"and steps: "(p', w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" by blast thenhave"(p',w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)) ∧ (p2, LTS_ε.remove_ε (γ2' @ tl w)) ==>* (p, LTS_ε.remove_ε (tl w))" proof - have γ2'_γ2: "LTS_ε.remove_ε γ2' = [γ2]" by (metis LTS_ε.ε_exp_def LTS_ε.remove_ε_def‹LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1›) have"(p',w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" using steps by auto moreover have rule: "(p2, γ2) ↪ (p, pop)" using VI VII by auto from steps have steps': "(p', w') ==>* (p2, γ2 # (LTS_ε.remove_ε (tl w)))" using γ2'_γ2 by (metis Cons_eq_appendI LTS_ε.remove_ε_append_dist self_append_conv2) from rule steps' have"(p2, γ2 # (LTS_ε.remove_ε (tl w))) ==>* (p, LTS_ε.remove_ε (tl w))" using VIII by (metis PDS.transition_rel.intros append_self_conv2 lbl.simps(1) r_into_rtranclp
step_relp_def) (* VII *) thenhave"(p2, LTS_ε.remove_ε (γ2' @ tl w)) ==>* (p, LTS_ε.remove_ε (tl w))" by (simp add: LTS_ε.remove_ε_append_dist γ2'_γ2) ultimately show"(p',w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)) ∧ (p2, LTS_ε.remove_ε (γ2' @ tl w)) ==>* (p, LTS_ε.remove_ε (tl w))" by auto qed thenhave"(p',w') ==>* (p, LTS_ε.remove_ε (tl w)) ∧ (Init p', w', q) ∈ LTS_ε.trans_star_ε A" using VIII by force thenhave"∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p, LTS_ε.remove_ε w)" using w_tl_ε by auto thenshow ?thesis using ctr_q ‹p = p1›by blast next assume"is_Isolated q" from V have"(the_Ctr_Loc q, [the_Label q]) ==>* (p2, γ2#(LTS_ε.remove_ε w))" by (metis LTS_ε.ε_exp_def LTS_ε.remove_ε_append_dist LTS_ε.remove_ε_def ‹LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1›‹is_Isolated q›
append_Cons append_self_conv2 w_tl_ε)
thenhave"(the_Ctr_Loc q, [the_Label q]) ==>* (p1, LTS_ε.remove_ε w)" using VI by (metis append_Nil lbl.simps(1) rtranclp.simps step_relp_def2) thenhave"(the_Ctr_Loc q, [the_Label q]) ==>* (p, LTS_ε.remove_ε w)" using VII by auto thenshow ?thesis using‹is_Isolated q›by blast qed next case (add_trans_swap p2 γ2 p1 γ' q1) (* Adjusted from previous case *) note III = add_trans_swap(3) note VI = add_trans_swap(2) have t_def: "t = (Init p1, Some γ', q1)" usinglocal.add_trans_swap(1) local.add_trans_swap p1_γ_p2_w2_q'_p(1) t_def by blast have init_Ai: "inits ⊆ LTS.srcs Ai" using step(1,2,4) no_edge_to_Ctr_Loc_post_star_rules by (meson r_into_rtranclp) have t_hd_once: "hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" proof - have"(ss, w) ∈ LTS.path_with_word Ai" using Suc(3) LTS.trans_star_states_path_with_word by metis moreover have"inits ⊆ LTS.srcs Ai" using init_Ai by auto moreover have"0 < count (transitions_of (ss, w)) t" by (metis Suc.prems(1) transitions_of'.simps zero_less_Suc) moreover have"t = (Init p1, Some γ', q1)" using t_def by auto moreover have"Init p1 ∈ inits" using inits_def by force ultimately show"hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" using init_only_hd[of ss w Ai t p1 _ q1] by auto qed
have"transition_list (ss, w) ≠ []" by (metis LTS.trans_star_states_path_with_word LTS.path_with_word.simps Suc.prems(1,2)
count_empty less_not_refl2 list.distinct(1) transition_list.simps(1) transitions_of'.simps
transitions_of.simps(2) zero_less_Suc) thenhave ss_w_split: "([Init p1,q1], [Some γ']) @🍋 (tl ss, tl w) = (ss, w)" using t_hd_once t_def hd_transition_list_append_path_with_word by metis thenhave ss_w_split': "(Init p1, [Some γ'], [Init p1,q1], q1) @@🍋 (q1, tl w, tl ss, q) = (Init p1, w, ss, q)" by auto have VII: "p = p1" proof - have"(Init p, w, ss, q) ∈ LTS.trans_star_states Ai" using Suc.prems(2) by blast moreover have"t = hd (transition_list' (Init p, w, ss, q))" using‹hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1›by fastforce moreover have"transition_list' (Init p, w, ss, q) ≠ []" by (simp add: ‹transition_list (ss, w) ≠ []›) moreover have"t = (Init p1, Some γ', q1)" using t_def by auto ultimately show"p = p1" using LTS.hd_is_hd by fastforce qed have"j=0" using Suc(2) ‹hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1›by force have"(Init p1, [Some γ'], [Init p1, q1], q1) ∈ LTS.trans_star_states Ai" proof - have"(Init p1, Some γ', q1) ∈ Ai" usinglocal.add_trans_swap(1) by auto moreover have"(Init p1, Some γ', q1) ∉ Aiminus1" usinglocal.add_trans_swap(4) by blast ultimately show"(Init p1, [Some γ'], [Init p1, q1], q1) ∈ LTS.trans_star_states Ai" by (meson LTS.trans_star_states.trans_star_states_refl LTS.trans_star_states.trans_star_states_step) qed have"(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1" proof - from Suc(3) have"(ss, w) ∈ LTS.path_with_word Ai" by (meson LTS.trans_star_states_path_with_word) thenhave tl_ss_w_Ai: "(tl ss, tl w) ∈ LTS.path_with_word Ai" by (metis LTS.path_with_word.simps ‹transition_list (ss, w) ≠ []› list.sel(3)
transition_list.simps(2)) from t_hd_once have zero_p1_ε_q1: "0 = count (transitions_of (tl ss, tl w)) (Init p1, Some γ', q1)" using count_append_path_with_word_γ[of "[hd ss]""[]""tl ss""hd w""tl w""Init p1""Some γ'" q1, simplified] ‹(Init p1, [Some γ'], [Init p1, q1], q1) ∈ LTS.trans_star_states Ai›‹transition_list (ss, w) ≠ []›
Suc.prems(2) VII LTS.transition_list_Cons[of "Init p" w ss q Ai "Some γ'" q1] by (auto simp: t_def) have Ai_Aiminus1: "Ai = Aiminus1 ∪ {(Init p1, Some γ', q1)}" usinglocal.add_trans_swap(1) by auto from t_hd_once tl_ss_w_Ai zero_p1_ε_q1 Ai_Aiminus1
count_zero_remove_path_with_word[OF tl_ss_w_Ai, of "Init p1" _ q1 Aiminus1] have"(tl ss, tl w) ∈ LTS.path_with_word Aiminus1" by auto moreover have"hd (tl ss) = q1" using Suc.prems(2) VII ‹transition_list (ss, w) ≠ []› t_def LTS.transition_list_Cons t_hd_once by fastforce moreover have"last ss = q" by (metis LTS.trans_star_states_last Suc.prems(2)) ultimately show"(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1" by (metis (no_types, lifting) LTS.trans_star_states_path_with_word
LTS.path_with_word_trans_star_states LTS.path_with_word_not_empty Suc.prems(2)
last_ConsR list.collapse) qed have"w = Some γ' # (tl w)" by (metis Suc(3) VII ‹transition_list (ss, w) ≠ []› list.distinct(1) list.exhaust_sel
list.sel(1) t_def LTS.transition_list_Cons t_hd_once) thenhave w_tl_ε: "LTS_ε.remove_ε w = LTS_ε.remove_ε (Some γ'#tl w)" using LTS_ε.remove_ε_def removeAll.simps(2) by presburger have"∃γ2'. LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1" using add_trans_swap by (simp add: LTS_ε.trans_star_ε_ε_exp_trans_star) thenobtain γ2' where"LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1" by blast thenhave"∃ss2. (Init p2, γ2', ss2, q1) ∈ LTS.trans_star_states Aiminus1" by (simp add: LTS.trans_star_trans_star_states) thenobtain ss2 where IIII_1: "(Init p2, γ2', ss2, q1) ∈ LTS.trans_star_states Aiminus1" by blast have IIII_2: "(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1" using ss_w_split' Suc(3) Suc(2) ‹j=0› using‹(q1, tl w, tl ss, q) ∈ LTS.trans_star_states Aiminus1›by blast have IIII: "(Init p2, γ2' @ tl w, ss2 @ (tl (tl ss)), q) ∈ LTS.trans_star_states Aiminus1" using IIII_1 IIII_2 by (meson LTS.trans_star_states_append)
from Suc(1)[of p2 "γ2' @ tl w""ss2 @ (tl (tl ss))" q] have V: "(¬is_Isolated q ⟶ (∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)))) ∧ (is_Isolated q ⟶ (the_Ctr_Loc q, [the_Label q]) ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)))" using IIII using step.IH step.prems(1,2,3) by blast
have"¬is_Isolated q ∨ is_Isolated q" using state.exhaust_disc by blast thenshow ?thesis proof assume ctr_q: "¬is_Isolated q" thenhave"∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" using V by auto thenobtain p' w' where
VIII:"(Init p', w', q) ∈ LTS_ε.trans_star_ε A"and steps: "(p', w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" by blast thenhave"(p',w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)) ∧ (p2, LTS_ε.remove_ε (γ2' @ tl w)) ==>* (p, γ' # LTS_ε.remove_ε (tl w))" proof - have γ2'_γ2: "LTS_ε.remove_ε γ2' = [γ2]" by (metis LTS_ε.ε_exp_def LTS_ε.remove_ε_def‹LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1›) have"(p',w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" using steps by auto moreover have rule: "(p2, γ2) ↪ (p, swap γ')" using VI VII by auto from steps have steps': "(p', w') ==>* (p2, γ2 # (LTS_ε.remove_ε (tl w)))" using γ2'_γ2 by (metis Cons_eq_appendI LTS_ε.remove_ε_append_dist self_append_conv2) from rule steps' have"(p2, γ2 # (LTS_ε.remove_ε (tl w))) ==>* (p, γ' # LTS_ε.remove_ε (tl w))" using VIII using PDS.transition_rel.intros append_self_conv2 lbl.simps(1) r_into_rtranclp step_relp_def by fastforce thenhave"(p2, LTS_ε.remove_ε (γ2' @ tl w)) ==>* (p, γ' # LTS_ε.remove_ε (tl w))" by (simp add: LTS_ε.remove_ε_append_dist γ2'_γ2) ultimately show"(p',w') ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w)) ∧ (p2, LTS_ε.remove_ε (γ2' @ tl w)) ==>* (p, γ' # LTS_ε.remove_ε (tl w))" by auto qed thenhave"(p',w') ==>* (p, γ' # LTS_ε.remove_ε (tl w)) ∧ (Init p', w', q) ∈ LTS_ε.trans_star_ε A" using VIII by force thenhave"∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p, LTS_ε.remove_ε w)" using LTS_ε.remove_ε_Cons_tl by (metis ‹w = Some γ' # tl w›) thenshow ?thesis using ctr_q ‹p = p1›by blast next assume"is_Isolated q" from V this have"(the_Ctr_Loc q, [the_Label q]) ==>* (p2, LTS_ε.remove_ε (γ2' @ tl w))" by auto thenhave"(the_Ctr_Loc q, [the_Label q]) ==>* (p2, γ2#(LTS_ε.remove_ε (tl w)))" by (metis LTS_ε.ε_exp_def LTS_ε.remove_ε_append_dist LTS_ε.remove_ε_def ‹LTS_ε.ε_exp γ2' [γ2] ∧ (Init p2, γ2', q1) ∈ LTS.trans_star Aiminus1› append_Cons
append_self_conv2) thenhave"(the_Ctr_Loc q, [the_Label q]) ==>* (p1, γ' # LTS_ε.remove_ε (tl w))" using VI by (metis (no_types) append_Cons append_Nil lbl.simps(2) rtranclp.rtrancl_into_rtrancl
step_relp_def2) thenhave"(the_Ctr_Loc q, [the_Label q]) ==>* (p, γ' # LTS_ε.remove_ε (tl w))" using VII by auto thenshow ?thesis using‹is_Isolated q› by (metis LTS_ε.remove_ε_Cons_tl w_tl_ε) qed next case (add_trans_push_1 p2 γ2 p1 γ1 γ'' q1') thenhave t_def: "t = (Init p1, Some γ1, Isolated p1 γ1)" usinglocal.add_trans_pop(1) local.add_trans_pop p1_γ_p2_w2_q'_p(1) t_def by blast have init_Ai: "inits ⊆ LTS.srcs Ai" using step(1,2) step(4) using no_edge_to_Ctr_Loc_post_star_rules by (meson r_into_rtranclp) have t_hd_once: "hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" proof - have"(ss, w) ∈ LTS.path_with_word Ai" using Suc(3) LTS.trans_star_states_path_with_word by metis moreover have"inits ⊆ LTS.srcs Ai" using init_Ai by auto moreover have"0 < count (transitions_of (ss, w)) t" by (metis Suc.prems(1) transitions_of'.simps zero_less_Suc) moreover have"t = (Init p1, Some γ1, Isolated p1 γ1)" using t_def by auto moreover have"Init p1 ∈ inits" using inits_def by fastforce ultimately show"hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1" using init_only_hd[of ss w Ai t] by auto qed have"transition_list (ss, w) ≠ []" by (metis LTS.trans_star_states_path_with_word LTS.path_with_word.simps Suc.prems(1,2)
count_empty less_not_refl2 list.distinct(1) transition_list.simps(1)
transitions_of'.simps transitions_of.simps(2) zero_less_Suc)
have VII: "p = p1" proof - have"(Init p, w, ss, q) ∈ LTS.trans_star_states Ai" using Suc.prems(2) by blast moreover have"t = hd (transition_list' (Init p, w, ss, q))" using‹hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1›by fastforce moreover have"transition_list' (Init p, w, ss, q) ≠ []" by (simp add: ‹transition_list (ss, w) ≠ []›) moreover have"t = (Init p1, Some γ1, Isolated p1 γ1)" using t_def by auto ultimately show"p = p1" using LTS.hd_is_hd by fastforce qed from add_trans_push_1(4) have"∄p γ. (Isolated p1 γ1, γ, p) ∈ Aiminus1" using post_star_rules_Isolated_sink_invariant[of A Aiminus1 p1 γ1] step.hyps(1)
step.prems(1,2,3) unfolding LTS.sinks_def by blast thenhave"∄p γ. (Isolated p1 γ1, γ, p) ∈ Ai" usinglocal.add_trans_push_1(1) by blast thenhave ss_w_short: "ss = [Init p1, Isolated p1 γ1] ∧ w = [Some γ1]" using Suc.prems(2) VII ‹hd (transition_list (ss, w)) = t ∧ count (transitions_of (ss, w)) t = 1› t_def
LTS.nothing_after_sink[of "Init p1""Isolated p1 γ1""tl (tl ss)""Some γ1""tl w" Ai] ‹transition_list (ss, w) ≠ []›
LTS.trans_star_states_path_with_word[of "Init p" w ss q Ai]
LTS.transition_list_Cons[of "Init p" w ss q Ai] by (auto simp: LTS.sinks_def2) thenhave q_ext: "q = Isolated p1 γ1" using LTS.trans_star_states_last Suc.prems(2) by fastforce have"(p1, [γ1]) ==>* (p, LTS_ε.remove_ε w)" using ss_w_short unfolding LTS_ε.remove_ε_def using VII by force have"(the_Ctr_Loc q, [the_Label q]) ==>* (p, LTS_ε.remove_ε w)" by (simp add: ‹(p1, [γ1]) ==>* (p, LTS_ε.remove_ε w)› q_ext) thenshow ?thesis using q_ext by auto next case (add_trans_push_2 p2 γ2 p1 γ1 γ'' q') (* Adjusted from previous case *) note IX = add_trans_push_2(3) note XIII = add_trans_push_2(2) have t_def: "t = (Isolated p1 γ1, Some γ'', q')" usinglocal.add_trans_push_2(1,4) p1_γ_p2_w2_q'_p(1) t_def by blast have init_Ai: "inits ⊆ LTS.srcs Ai" using step(1,2) step(4) using no_edge_to_Ctr_Loc_post_star_rules by (meson r_into_rtranclp)
from Suc(2,3) split_at_first_t[of "Init p" w ss q Ai j "Isolated p1 γ1""Some γ''" q' Aiminus1] t_def have"∃u v u_ss v_ss. ss = u_ss @ v_ss ∧ w = u @ [Some γ''] @ v ∧ (Init p, u, u_ss, Isolated p1 γ1) ∈ LTS.trans_star_states Aiminus1 ∧ (Isolated p1 γ1, [Some γ''], q') ∈ LTS.trans_star Ai ∧ (q', v, v_ss, q) ∈ LTS.trans_star_states Ai" usinglocal.add_trans_push_2(1,4) by blast thenobtain u v u_ss v_ss where
ss_split: "ss = u_ss @ v_ss"and
w_split: "w = u @ [Some γ''] @ v"and
X_1: "(Init p, u, u_ss, Isolated p1 γ1) ∈ LTS.trans_star_states Aiminus1"and
out_trans: "(Isolated p1 γ1, [Some γ''], q') ∈ LTS.trans_star Ai"and
path: "(q', v, v_ss, q) ∈ LTS.trans_star_states Ai" by auto from step(3)[of p u u_ss "Isolated p1 γ1"] X_1 have "(¬is_Isolated (Isolated p1 γ1) ⟶ (∃p' w'. (Init p', w', Isolated p1 γ1) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p, LTS_ε.remove_ε u))) ∧ (is_Isolated (Isolated p1 γ1) ⟶ (the_Ctr_Loc (Isolated p1 γ1), [the_Label (Isolated p1 γ1)]) ==>* (p, LTS_ε.remove_ε u))" using step.prems(1,2,3) by auto thenhave"(the_Ctr_Loc (Isolated p1 γ1), [the_Label (Isolated p1 γ1)]) ==>* (p, LTS_ε.remove_ε u)" by auto thenhave p1_γ1_p_u: "(p1, [γ1]) ==>* (p, LTS_ε.remove_ε u)" by auto from IX have"∃γ2ε γ2ss. LTS_ε.ε_exp γ2ε [γ2] ∧ (Init p2, γ2ε, γ2ss, q') ∈ LTS.trans_star_states Aiminus1" by (meson LTS.trans_star_trans_star_states LTS_ε.trans_star_ε_ε_exp_trans_star) thenobtain γ2ε γ2ss where XI_1: "LTS_ε.ε_exp γ2ε [γ2] ∧ (Init p2, γ2ε, γ2ss, q') ∈ LTS.trans_star_states Aiminus1" by blast have"(q', v, v_ss, q) ∈ LTS.trans_star_states Ai" using path . have ind: "(¬is_Isolated q ⟶ (∃p' w'. (Init p', w', q) ∈ LTS_ε.trans_star_ε A ∧ (p', w') ==>* (p2, LTS_ε.remove_ε (γ2ε @ v)))) ∧ (is_Isolated q ⟶ (the_Ctr_Loc q, [the_Label q]) ==>* (p2, LTS_ε.remove_ε (γ2ε @ v)))" proof - have γ2ss_len: "length γ2ss = Suc (length γ2ε)" by (meson LTS.trans_star_states_length XI_1)
have v_ss_empty: "v_ss ≠ []" by (metis LTS.trans_star_states.simps path list.distinct(1))
have γ2ss_last: "last γ2ss = hd v_ss" by (metis LTS.trans_star_states_hd LTS.trans_star_states_last XI_1 path)
have cv: "j = count (transitions_of ((v_ss, v))) t" proof - have last_u_ss: "Isolated p1 γ1 = last u_ss" by (meson LTS.trans_star_states_last X_1) have q'_hd_v_ss: "q' = hd v_ss" by (meson LTS.trans_star_states_hd path)
have"count (transitions_of' (((Init p, u, u_ss, Isolated p1 γ1), Some γ'') @@\<gamma> (q', v, v_ss, q))) (Isolated p1 γ1, Some γ'', q') = count (transitions_of' (Init p, u, u_ss, Isolated p1 γ1)) (Isolated p1 γ1, Some γ'', q') + (if Isolated p1 γ1 = last u_ss ∧ q' = hd v_ss ∧ Some γ'' = Some γ'' then 1 else 0) + count (transitions_of' (q', v, v_ss, q)) (Isolated p1 γ1, Some γ'', q')" using count_append_trans_star_states_γ_length[of u_ss u v_ss "Init p""Isolated p1 γ1""Some γ''" q' v q "Isolated p1 γ1""Some γ''" q'] t_def ss_split w_split X_1 by (meson LTS.trans_star_states_length v_ss_empty) thenhave"count (transitions_of (u_ss @ v_ss, u @ Some γ'' # v)) (last u_ss, Some γ'', hd v_ss) = Suc (count (transitions_of (u_ss, u)) (last u_ss, Some γ'', hd v_ss) + count (transitions_of (v_ss, v)) (last u_ss, Some γ'', hd v_ss))" using last_u_ss q'_hd_v_ss by auto thenhave"j = count (transitions_of' ((q',v, v_ss, q))) t" using last_u_ss q'_hd_v_ss X_1 ss_split w_split add_trans_push_2(4) Suc(2)
LTS.avoid_count_zero[of "Init p" u u_ss "Isolated p1 γ1" Aiminus1 "Isolated p1 γ1""Some γ''" q'] by (auto simp: t_def) thenshow"j = count (transitions_of ((v_ss, v))) t" by force qed have p2_q'_states_Aiminus1: "(Init p2, γ2ε, γ2ss, q') ∈ LTS.trans_star_states Aiminus1" using XI_1 by blast thenhave cγ2: "count (transitions_of (γ2ss, γ2ε)) t = 0" using LTS.avoid_count_zero local.add_trans_push_2(4) t_def by fastforce have"j = count (transitions_of ((γ2ss, γ2ε) @🍋 (v_ss, v))) t" using LTS.count_append_path_with_word[of γ2ss γ2ε v_ss v "Isolated p1 γ1""Some γ''" q'] t_def
cγ2 cv γ2ss_len v_ss_empty γ2ss_last by force thenhave j_count: "j = count (transitions_of' (Init p2, γ2ε @ v, γ2ss @ tl v_ss, q)) t" by simp
have"(γ2ss, γ2ε) ∈ LTS.path_with_word Aiminus1" by (meson LTS.trans_star_states_path_with_word p2_q'_states_Aiminus1) thenhave γ2ss_path: "(γ2ss, γ2ε) ∈ LTS.path_with_word Ai" using add_trans_push_2(1)
path_with_word_mono'[of γ2ss γ2ε Aiminus1 Ai] by auto
have path': "(v_ss, v) ∈ LTS.path_with_word Ai" by (meson LTS.trans_star_states_path_with_word path) have"(γ2ss, γ2ε) @🍋 (v_ss, v) ∈ LTS.path_with_word Ai" using γ2ss_path path' LTS.append_path_with_word_path_with_word γ2ss_last by auto thenhave"(γ2ss @ tl v_ss, γ2ε @ v) ∈ LTS.path_with_word Ai" by auto
― ‹Corresponds to one direction of Schwoon's theorem 3.3› theorem post_star_rules_subset_post_star_lang: assumes"post_star_rules** A A'" assumes"inits ⊆ LTS.srcs A" assumes"isols ⊆ LTS.isolated A" shows"{c. accepts_ε A' c} ⊆ post_star (lang_ε A)" proof fix c :: "('ctr_loc, 'label) conf"
define p where"p = fst c"
define w where"w = snd c" assume"c ∈ {c. accepts_ε A' c}" thenhave"accepts_ε A' (p,w)" unfolding p_def w_def by auto thenobtain q where q_p: "q ∈ finals""(Init p, w, q) ∈ LTS_ε.trans_star_ε A'" unfolding accepts_ε_defby auto thenobtain w' where w'_def: "LTS_ε.ε_exp w' w ∧ (Init p, w', q) ∈ LTS.trans_star A'" by (meson LTS_ε.trans_star_ε_iff_ε_exp_trans_star) thenhave path: "(Init p, w', q) ∈ LTS.trans_star A'" by auto have"¬ is_Isolated q" using F_not_Ext q_p(1) by blast thenobtain p' w'a where"(Init p', w'a, q) ∈ LTS_ε.trans_star_ε A ∧ (p', w'a) ==>* (p, LTS_ε.remove_ε w')" using rtranclp_post_star_rules_constains_successors[OF assms(1) assms(2) assms(3) path] by auto thenhave"(Init p', w'a, q) ∈ LTS_ε.trans_star_ε A ∧ (p', w'a) ==>* (p, w)" using w'_def by (metis LTS_ε.ε_exp_def LTS_ε.remove_ε_def ‹LTS_ε.ε_exp w' w ∧ (Init p, w', q) ∈ LTS.trans_star A'›) thenhave"(p,w) ∈ post_star (lang_ε A)" using‹q ∈ finals›unfolding LTS.post_star_def accepts_ε_def lang_ε_defby fastforce thenshow"c ∈ post_star (lang_ε A)" unfolding p_def w_def by auto qed
― ‹Corresponds to Schwoon's theorem 3.3› theorem post_star_rules_accepts_ε_correct: assumes"saturation post_star_rules A A'" assumes"inits ⊆ LTS.srcs A" assumes"isols ⊆ LTS.isolated A" shows"{c. accepts_ε A' c} = post_star (lang_ε A)" proof (rule; rule) fix c :: "('ctr_loc, 'label) conf"
define p where"p = fst c"
define w where"w = snd c" assume"c ∈ post_star (lang_ε A)" thenobtain p' w' where"(p', w') ==>* (p, w) ∧ (p', w') ∈ lang_ε A" by (auto simp: post_star_def p_def w_def) thenhave"accepts_ε A' (p, w)" using lemma_3_3[of p' w' p w A A'] assms(1) by auto thenhave"accepts_ε A' c" unfolding p_def w_def by auto thenshow"c ∈ {c. accepts_ε A' c}" by auto next fix c :: "('ctr_loc, 'label) conf" assume"c ∈ {c. accepts_ε A' c}" thenshow"c ∈ post_star (lang_ε A)" using assms post_star_rules_subset_post_star_lang unfolding saturation_def by blast qed
― ‹Corresponds to Schwoon's theorem 3.3› theorem post_star_rules_correct: assumes"saturation post_star_rules A A'" assumes"inits ⊆ LTS.srcs A" assumes"isols ⊆ LTS.isolated A" shows"lang_ε A' = post_star (lang_ε A)" using assms lang_ε_def post_star_rules_accepts_ε_correct by presburger
lemma trans_star_ε_LTS_ε_of_LTS_trans_star: assumes"(p,w,q) ∈ LTS_ε.trans_star_ε (LTS_ε_of_LTS A2')" shows"(p,w,q) ∈ LTS.trans_star A2'" using assms proof (induction rule: LTS_ε.trans_star_ε.induct[OF assms(1)] ) case (1 p) thenshow ?case by (simp add: LTS.trans_star.trans_star_refl) next case (2 p γ q' w q) moreover have"(p, γ, q') ∈ A2'" using2(1) using LTS_ε_of_LTS_Some by metis moreover have"(q', w, q) ∈ LTS.trans_star A2'" using"2.IH"2(2) by auto ultimatelyshow ?case by (meson LTS.trans_star.trans_star_step) next case (3 p q' w q) thenshow ?case using LTS_ε_of_LTS_None by fastforce qed
lemma trans_star_trans_star_ε_LTS_ε_of_LTS: assumes"(p,w,q) ∈ LTS.trans_star A2'" shows"(p,w,q) ∈ LTS_ε.trans_star_ε (LTS_ε_of_LTS A2')" using assms proof (induction rule: LTS.trans_star.induct[OF assms(1)]) case (1 p) thenshow ?case by (simp add: LTS_ε.trans_star_ε.trans_star_ε_refl) next case (2 p γ q' w q) thenshow ?case by (meson LTS_ε.trans_star_ε.trans_star_ε_step_γ LTS_ε_of_LTS_Some) qed
lemma accepts_ε_LTS_ε_of_LTS_iff_accepts: "accepts_ε (LTS_ε_of_LTS A2') (p, w) ⟷ accepts A2' (p, w)" using accepts_ε_def accepts_def trans_star_ε_LTS_ε_of_LTS_trans_star
trans_star_trans_star_ε_LTS_ε_of_LTS by fastforce
lemma lang_ε_LTS_ε_of_LTS_is_lang: "lang_ε (LTS_ε_of_LTS A2') = lang A2'" unfolding lang_ε_def lang_def using accepts_ε_LTS_ε_of_LTS_iff_accepts by auto
have"{c. accepts A2' c} ⊆ pre_star (lang A2)" using pre_star_rule_subset_pre_star_lang[of A2 A2'] assms by auto thenhave A2'_correct: "lang A2' ⊆ pre_star (lang A2)" unfolding lang_def by auto
have"lang_ε_inters (inters_ε A1' (LTS_ε_of_LTS A2')) = lang_ε A1' ∩ lang_ε (LTS_ε_of_LTS A2')" using inters_ε_lang_ε[of A1' "(LTS_ε_of_LTS A2')"] by auto moreover have"... = lang_ε A1' ∩ lang A2'" using lang_ε_LTS_ε_of_LTS_is_lang by auto moreover have"... ⊆ post_star (lang_ε A1) ∩ pre_star (lang A2)" using A1'_correct A2'_correct by auto ultimately have inters_correct: "lang_ε_inters (inters_ε A1' (LTS_ε_of_LTS A2')) ⊆ post_star (lang_ε A1) ∩ pre_star (lang A2)" by metis
from assms have"post_star (lang_ε A1) ∩ pre_star (lang A2) ≠ {}" using inters_correct by auto thenshow"∃c1∈lang_ε A1. ∃c2∈lang A2. c1 ==>* c2" using dual2 by auto
have"{c. accepts A2' c} = pre_star (lang A2)" using pre_star_rule_accepts_correct[of A2 A2'] assms by auto thenhave A2'_correct: "lang A2' = pre_star (lang A2)" unfolding lang_def by auto
have"lang_ε_inters (inters_ε A1' (LTS_ε_of_LTS A2')) = lang_ε A1' ∩ lang_ε (LTS_ε_of_LTS A2')" using inters_ε_lang_ε[of A1' "(LTS_ε_of_LTS A2')"] by auto moreover have"... = lang_ε A1' ∩ lang A2'" using lang_ε_LTS_ε_of_LTS_is_lang by auto moreover have"... = post_star (lang_ε A1) ∩ pre_star (lang A2)" using A1'_correct A2'_correct by auto ultimately have inters_correct: "lang_ε_inters (inters_ε A1' (LTS_ε_of_LTS A2')) = post_star (lang_ε A1) ∩ pre_star (lang A2)" by metis
show ?thesis proof assume"lang_ε_inters (inters_ε A1' (LTS_ε_of_LTS A2')) ≠ {}" thenhave"post_star (lang_ε A1) ∩ pre_star (lang A2) ≠ {}" using inters_correct by auto thenshow"∃c1∈lang_ε A1. ∃c2∈lang A2. c1 ==>* c2" using dual2 by auto next assume"∃c1∈lang_ε A1. ∃c2∈lang A2. c1 ==>* c2" thenhave"post_star (lang_ε A1) ∩ pre_star (lang A2) ≠ {}" using dual2 by auto thenshow"lang_ε_inters (inters_ε A1' (LTS_ε_of_LTS A2')) ≠ {}" using inters_correct by auto qed qed
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.104Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.