theory af imports Main LTL_FGXU "Auxiliary/List2" begin
subsection‹af›
fun af_letter :: "'a ltl ==> 'a set ==> 'a ltl" where "af_letter true ν = true"
| "af_letter false ν = false"
| "af_letter p(a) ν = (if a ∈ ν then true else false)"
| "af_letter (np(a)) ν = (if a ∉ ν then true else false)"
| "af_letter (φ and ψ) ν = (af_letter φ ν) and (af_letter ψ ν)"
| "af_letter (φ or ψ) ν = (af_letter φ ν) or (af_letter ψ ν)"
| "af_letter (X φ) ν = φ"
| "af_letter (G φ) ν = (G φ) and (af_letter φ ν)"
| "af_letter (F φ) ν = (F φ) or (af_letter φ ν)"
| "af_letter (φ U ψ) ν = (φ U ψ and (af_letter φ ν)) or (af_letter ψ ν)"
abbreviation af :: "'a ltl ==> 'a set list ==> 'a ltl" (‹af›) where "af φ w ≡ foldl af_letter φ w"
lemma af_decompose: "af (φ and ψ) w = (af φ w) and (af ψ w)" "af (φ or ψ) w = (af φ w) or (af ψ w)" by (induction w rule: rev_induct) simp_all
lemma af_simps[simp]: "af true w = true" "af false w = false" "af (X φ) (x#xs) = af φ (xs)" by (induction w) simp_all
lemma af_F: "af (F φ) w = Or (F φ # map (af φ) (suffixes w))" proof (induction w) case (Cons x xs) have"af (F φ) (x # xs) = af (af_letter (F φ) x) xs" by simp also have"… = (af (F φ) xs) or (af (af_letter (φ) x) xs)" unfolding af_decompose[symmetric] by simp finally show ?caseusing Cons Or_append_syntactic by force qed simp
lemma af_G: "af (G φ) w = And (G φ # map (af φ) (suffixes w))" proof (induction w) case (Cons x xs) have"af (G φ) (x # xs) = af (af_letter (G φ) x) xs" by simp also have"… = (af (G φ) xs) and (af (af_letter (φ) x) xs)" unfolding af_decompose[symmetric] by simp finally show ?caseusing Cons Or_append_syntactic by force qed simp
lemma af_U: "af (φ U ψ) (x#xs) = (af (φ U ψ) xs and af φ (x#xs)) or af ψ (x#xs)" by (induction xs) (simp add: af_decompose)+
lemma af_respectfulness': "φ ⟶P ψ ==> af φ w ⟶P af ψ w" "φ ≡P ψ ==> af φ w ≡P af ψ w" by (induction w arbitrary: φ ψ) (insert af_respectfulness, fastforce+)
lemma af_nested_propos: "nested_propos (af_letter φ ν) ⊆ nested_propos φ" by (induction φ) auto
subsection‹@{term afG}›
fun af_G_letter :: "'a ltl ==> 'a set ==> 'a ltl" where "af_G_letter true ν = true"
| "af_G_letter false ν = false"
| "af_G_letter p(a) ν = (if a ∈ ν then true else false)"
| "af_G_letter (np(a)) ν = (if a ∉ ν then true else false)"
| "af_G_letter (φ and ψ) ν = (af_G_letter φ ν) and (af_G_letter ψ ν)"
| "af_G_letter (φ or ψ) ν = (af_G_letter φ ν) or (af_G_letter ψ ν)"
| "af_G_letter (X φ) ν = φ"
| "af_G_letter (G φ) ν = (G φ)"
| "af_G_letter (F φ) ν = (F φ) or (af_G_letter φ ν)"
| "af_G_letter (φ U ψ) ν = (φ U ψ and (af_G_letter φ ν)) or (af_G_letter ψ ν)"
abbreviation afG :: "'a ltl ==> 'a set list ==> 'a ltl" where "afG φ w ≡ (foldl af_G_letter φ w)"
lemma afG_decompose: "afG (φ and ψ) w = (afG φ w) and (afG ψ w)" "afG (φ or ψ) w = (afG φ w) or (afG ψ w)" by (induction w rule: rev_induct) simp_all
lemma afG_simps[simp]: "afG true w = true" "afG false w = false" "afG (G φ) w = G φ" "afG (X φ) (x#xs) = afG φ (xs)" by (induction w) simp_all
lemma afG_F: "afG (F φ) w = Or (F φ # map (afG φ) (suffixes w))" proof (induction w) case (Cons x xs) have"afG (F φ) (x # xs) = afG (af_G_letter (F φ) x) xs" by simp also have"… = (afG (F φ) xs) or (afG (af_G_letter (φ) x) xs)" unfolding afG_decompose[symmetric] by simp finally show ?caseusing Cons Or_append_syntactic by force qed simp
lemma afG_U: "afG (φ U ψ) (x#xs) = (afG (φ U ψ) xs and afG φ (x#xs)) or afG ψ (x#xs)" by (simp add: afG_decompose)
lemma afG_subsequence_U: "afG (φ U ψ) (w [0 → Suc n]) = (afG (φ U ψ) (w [1 → Suc n]) and afG φ (w [0 → Suc n])) or afG ψ (w [0 → Suc n])" proof - have"∧n. w [0 → Suc n] = w 0 # w [1 → Suc n]" using subsequence_append[of w 1] by (simp add: subsequence_def upt_conv_Cons) thus ?thesis using afG_Uby metis qed
lemma af_G_free: assumes"G φ = {}" shows"af φ w = afG φ w" using assms proof (induction w arbitrary: φ) case (Cons x xs) hence"af (af_letter φ x) xs = afG (af_letter φ x) xs" using af_G_letter_free_F[OF Cons.prems, THEN Cons.IH] by blast moreover have"af_letter φ x = af_G_letter φ x" using Cons.prems by (induction φ) auto ultimately show ?case by simp qed simp
lemma af_equals_afG_base_cases: "af true w = afG true w" "af false w = afG false w" "af p(a) w = afG p(a) w" "af (np(a)) w = afG (np(a)) w" by (auto intro: af_G_free)
lemma af_implies_afG: "S ⊨P af φ w ==> S ⊨P afG φ w" proof (induction w arbitrary: S rule: rev_induct) case (snoc x xs) hence"S ⊨P af_letter (af φ xs) x" by simp hence"S ⊨P af_letter (afG φ xs) x" using af_respectfulness(1) snoc.IH unfolding ltl_prop_implies_def by blast moreover
{ fix φ have"∧ν. S ⊨P af_letter φ ν ==> S ⊨P af_G_letter φ ν" by (induction φ) auto
} ultimately show ?case using snoc.prems foldl_append by simp qed simp
lemma af_implies_afG_2: "w ⊨ af φ xs ==> w ⊨ afG φ xs" by (metis ltl_prop_implication_implies_ltl_implication af_implies_afG ltl_prop_implies_def)
lemma afG_implies_af_evalG': assumes"S ⊨P evalGG (afG φ w)" assumes"∧ψ. G ψ ∈G==> S ⊨P G ψ" assumes"∧ψ i. G ψ ∈G==> i < length w ==> S ⊨P evalGG (afG ψ (drop i w))" shows"S ⊨P af φ w" using assms proof (induction φ arbitrary: w) case (LTLGlobal φ) hence"G φ ∈G" unfolding afG_simps evalG.simps by (cases "G φ ∈G") simp+ hence"S ⊨P G φ" using LTLGlobal by simp moreover
{ fix x assume"x ∈ set (map (af φ) (suffixes w))" thenobtain w' where"x = af φ w'"and"w' ∈ set (suffixes w)" by auto thenobtain i where"w' = drop i w"and"i < length w" by (auto simp add: suffixes_alt_def subsequence_def) hence"S ⊨P evalGG (afG φ w')" using LTLGlobal.prems ‹G φ ∈G›by simp hence"S ⊨P x" using LTLGlobal(1)[OF ‹S ⊨P evalGG (afG φ w')›] LTLGlobal(3-4) drop_drop unfolding‹x = af φ w'›‹w' = drop i w›by simp
} ultimately show ?case unfolding af_G evalG_And_map And_prop_entailment by simp next case (LTLFinal φ) thenobtain x where x_def: "x ∈ set (F φ # map (evalGG o afG φ) (suffixes w))" and"S ⊨P x" unfolding Or_prop_entailment afG_F evalG_Or_mapby force hence"∃y ∈ set (F φ # map (af φ) (suffixes w)). S ⊨P y" proof (cases "x ≠ F φ") case True thenobtain w' where"S ⊨P evalGG (afG φ w')"and"w' ∈ set (suffixes w)" using x_def ‹S ⊨P x›by auto hence"∧ψ i. G ψ ∈G==> i < length w' ==> S ⊨P evalGG (afG ψ (drop i w'))" using LTLFinal.prems by (auto simp add: suffixes_alt_def subsequence_def) moreover have"∧ψ. G ψ ∈G==> S ⊨P evalGG (G ψ)" using LTLFinal by simp ultimately have"S ⊨P af φ w'" using LTLFinal.IH[OF ‹S ⊨P evalGG (afG φ w')›] using assms(2) by blast thus ?thesis using‹w' ∈ set (suffixes w)›by auto qed simp thus ?case unfolding af_F Or_prop_entailment evalG_Or_mapby simp next case (LTLNext φ) thus ?case proof (cases w) case (Cons x xs)
{ fix ψ i assume"G ψ ∈G"and"Suc i < length (x#xs)" hence"S ⊨P evalGG (afG ψ (drop (Suc i) (x#xs)))" using LTLNext.prems unfolding Cons by blast hence"S ⊨P evalGG (afG ψ (drop i xs))" by simp
} hence"∧ψ i. G ψ ∈G==> i < length xs ==> S ⊨P evalGG (afG ψ (drop i xs))" by simp thus ?thesis using LTLNext Cons by simp qed simp next case (LTLUntil φ ψ) thus ?case proof (induction w) case (Cons x xs)
{ assume"S ⊨P evalGG (afG ψ (x # xs))" moreover have"∧ψ i. G ψ ∈G==> i < length (x#xs) ==> S ⊨P evalGG (afG ψ (drop i (x#xs)))" using Cons by simp ultimately have"S ⊨P af ψ (x # xs)" using Cons.prems by blast hence ?case unfolding af_U by simp
} moreover
{ assume"S ⊨P evalGG (afG (φ U ψ) xs)"and"S ⊨P evalGG (afG φ (x # xs))" moreover have"∧ψ i. G ψ ∈G==> i < length (x#xs) ==> S ⊨P evalGG (afG ψ (drop i (x#xs)))" using Cons by simp ultimately have"S ⊨P af φ (x # xs)"and"S ⊨P af (φ U ψ) xs" using Cons by (blast, force) hence ?case unfolding af_U by simp
} ultimately show ?case using Cons(4) unfolding afG_Uby auto qed simp next case (LTLProp a) thus ?case proof (cases w) case (Cons x xs) thus ?thesis using LTLProp by (cases "a ∈ x") simp+ qed simp next case (LTLPropNeg a) thus ?case proof (cases w) case (Cons x xs) thus ?thesis using LTLPropNeg by (cases "a ∈ x") simp+ qed simp qed (unfold af_equals_afG_base_cases afG_decompose af_decompose, auto)
lemma afG_implies_af_evalG: assumes"S ⊨P evalGG (afG φ (w [0→j]))" assumes"∧ψ. G ψ ∈G==> S ⊨P G ψ" assumes"∧ψ i. G ψ ∈G==> i ≤ j ==> S ⊨P evalGG (afG ψ (w [i → j]))" shows"S ⊨P af φ (w [0→j])" using afG_implies_af_evalG'[OF assms(1-2), unfolded subsequence_length subsequence_drop] assms(3) by force
subsection‹Continuation›
― ‹af fulfills the infinite continuation w' of a word after skipping some finite prefix w.
Corresponds to Lemma 7 in arXiv: 1402.3388v2›
lemma af_ltl_continuation: "(w ⌢ w') ⊨ φ ⟷ w' ⊨ af φ w" proof (induction w arbitrary: φ w') case (Cons x xs) have"((x # xs) ⌢ w') 0 = x" unfolding conc_def nth_Cons_0 by simp moreover have"suffix 1 ((x # xs) ⌢ w') = xs ⌢ w'" unfolding suffix_def conc_def by fastforce moreover
{ fix φ :: "'a ltl" have"∧w. w ⊨ φ ⟷ suffix 1 w ⊨ af_letter φ (w 0)" by (induction φ) ((unfold LTL_F_one_step_unfolding LTL_G_one_step_unfolding LTL_U_one_step_unfolding)?, auto)
} ultimately have"((x # xs) ⌢ w') ⊨ φ ⟷ (xs ⌢ w') ⊨ af_letter φ x" by metis also have"…⟷ w' ⊨ af φ (x#xs)" using Cons.IH by simp finally show ?case . qed simp
lemma af_ltl_continuation_suffix: "w ⊨ φ ⟷ suffix i w ⊨ af φ (w[0 → i])" using af_ltl_continuation prefix_suffix subsequence_def by metis
lemma af_G_ltl_continuation: "∀ψ ∈G φ. w' ⊨ ψ = (w ⌢ w') ⊨ ψ ==> (w ⌢ w') ⊨ φ ⟷ w' ⊨ afG φ w" proof (induction w arbitrary: w' φ) case (Cons x xs)
{ fix ψ :: "'a ltl"fix w w' w'' assume"w'' ⊨ G ψ = ((w @ w') ⌢ w'') ⊨ G ψ" hence"w'' ⊨ G ψ = (w' ⌢ w'') ⊨ G ψ"and"(w' ⌢ w'') ⊨ G ψ = ((w @ w') ⌢ w'') ⊨ G ψ" by (induction w' arbitrary: w) (metis LTL_suffix_G suffix_conc_length conc_conc)+
} note G_stable = this have A: "∀ψ∈G (afG φ [x]). w' ⊨ ψ = (xs ⌢ w') ⊨ ψ" using G_stable(1)[of w' _ "[x]"] Cons.prems unfolding G_afG_simp conc_conc append.simps unfolding G_nested_propos_alt_def by blast have B: "∀ψ∈G φ. ([x] ⌢ xs ⌢ w') ⊨ ψ = (xs ⌢ w') ⊨ ψ" using G_stable(2)[of w' _ "[x]"] Cons.prems unfolding conc_conc append.simps unfolding G_nested_propos_alt_def by blast hence"([x] ⌢ xs ⌢ w') ⊨ φ = (xs ⌢ w') ⊨ afG φ [x]" proof (induction φ) case (LTLFinal φ) thus ?case unfolding LTL_F_one_step_unfolding by (auto simp add: suffix_conc_length[of "[x]", simplified]) next case (LTLUntil φ ψ) thus ?case unfolding LTL_U_one_step_unfolding by (auto simp add: suffix_conc_length[of "[x]", simplified]) qed (auto simp add: conc_fst[of 0"[x]"] suffix_conc_length[of "[x]", simplified]) also have"... = w' ⊨ afG φ (x # xs)" using Cons.IH[of "afG φ [x]" w'] A by simp finally show ?caseunfolding conc_conc by simp qed simp
lemma afG_ltl_continuation_suffix: "∀ψ ∈G φ. w ⊨ ψ = (suffix i w) ⊨ ψ ==> w ⊨ φ ⟷ suffix i w ⊨ afG φ (w [0 → i])" by (metis af_G_ltl_continuation[of φ "suffix i w"] prefix_suffix subsequence_def)
subsection‹Eager Unfolding @{term af} and @{term afG}›
fun Unf :: "'a ltl ==> 'a ltl" where "Unf (F φ) = F φ or Unf φ"
| "Unf (G φ) = G φ and Unf φ"
| "Unf (φ U ψ) = (φ U ψ and Unf φ) or Unf ψ"
| "Unf (φ and ψ) = Unf φ and Unf ψ"
| "Unf (φ or ψ) = Unf φ or Unf ψ"
| "Unf φ = φ"
fun UnfG :: "'a ltl ==> 'a ltl" where "UnfG (F φ) = F φ or UnfG φ"
| "UnfG (G φ) = G φ"
| "UnfG (φ U ψ) = (φ U ψ and UnfG φ) or UnfG ψ"
| "UnfG (φ and ψ) = UnfG φ and UnfG ψ"
| "UnfG (φ or ψ) = UnfG φ or UnfG ψ"
| "UnfG φ = φ"
fun step :: "'a ltl ==> 'a set ==> 'a ltl" where "step p(a) ν = (if a ∈ ν then true else false)"
| "step (np(a)) ν = (if a ∉ ν then true else false)"
| "step (X φ) ν = φ"
| "step (φ and ψ) ν = step φ ν and step ψ ν"
| "step (φ or ψ) ν = step φ ν or step ψ ν"
| "step φ ν = φ"
fun af_letter_opt where "af_letter_opt φ ν = Unf (step φ ν)"
fun af_G_letter_opt where "af_G_letter_opt φ ν = UnfG (step φ ν)"
abbreviation af_opt :: "'a ltl ==> 'a set list ==> 'a ltl" (‹af\U›) where "af\<UU> φ w ≡ (foldl af_letter_opt φ w)"
abbreviation af_G_opt :: "'a ltl ==> 'a set list ==> 'a ltl" (‹afG\U›) where "afG\<UU> φ w ≡ (foldl af_G_letter_opt φ w)"
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.