theory LTL3 imports Main Traces AnswerIndexedFamilies LinearTemporalLogic begin
chapter‹LTL3: Semantics, Equivalence and Formula Progression›
type_synonym 'a AiF3 = ‹answer ==> 'a state dset›
primrec and_AiF3 :: ‹'a AiF3==> 'a AiF3==> 'a AiF3› (infixl‹∧3⏹›60) where ‹(a ∧3⏹ b) T = a T ⊓ b T›
| ‹(a ∧3⏹ b) F = a F ⊔ b F›
primrec or_AiF3 :: ‹'a AiF3==> 'a AiF3==> 'a AiF3› (infixl‹∨3⏹›59) where ‹(a ∨3⏹ b) T = a T ⊔ b T›
| ‹(a ∨3⏹ b) F = a F ⊓ b F›
fun not_AiF3 :: ‹'a AiF3==> 'a AiF3› (‹¬3⏹ _›) where ‹(¬3⏹ a) T = a F›
| ‹(¬3⏹ a) F = a T›
fun univ_AiF3 :: ‹'a AiF3› (‹T3∙›) where ‹T3∙ T = Σ∞›
| ‹T3∙ F = ∅›
fun lsatisfying_AiF3 :: ‹'a ==> 'a AiF3› (‹lsat3∙›) where ‹lsat3∙ x T = compr (λt. t ≠ ε ∧ x ∈ L (thead t))›
| ‹lsat3∙ x F = compr (λt. t ≠ ε ∧ x ∉ L (thead t))›
fun x3_operator :: ‹'a AiF3==> 'a AiF3› (‹X3⏹›) where ‹X3⏹ t T = prepend (t T)›
| ‹X3⏹ t F = prepend (t F)›
fun iterate :: ‹('a ==> 'a) ==> nat ==> ('a ==> 'a)›where ‹iterate f 0 x = x›| ‹iterate f (Suc n) x = f (iterate f n x)›
primrec u3_operator :: ‹'a AiF3==> 'a AiF3==> 'a AiF3› (infix‹U3⏹›61) where ‹(a U3⏹ b) T = ⊔ ( range (λi. iterate (λx. prepend x ⊓ a T) i (b T) ))›
| ‹(a U3⏹ b) F = ⊓ ( range (λi. iterate (λx. prepend x ⊔ a F) i (b F) ))›
fun triv_true :: ‹'a ==> bool›where ‹triv_true x = (∀s. x∈ L s)›
fun triv_false :: ‹'a ==> bool›where ‹triv_false x = (∀s. x∉ L s)›
fun nontrivial :: ‹'a ==> bool›where ‹nontrivial x = ((∃s. x∈ L s) ∧ (∃t. x∉ L t))›
lemma itdrop_all_split: assumes‹x ∈ A›and‹∀i<k. itdrop (Suc i) x ∈ A› shows‹i < Suc k ==> itdrop i x ∈ A› using assms proof (cases ‹i›) qed (auto simp: itdrop_def)
lemma itdrop_exists_split[simp]: shows‹(∃i<Suc k. itdrop i x ∈ A) ⟷ (∃i < k. itdrop (Suc i) x ∈ A) ∨ x ∈ A› proof (rule iffI)
{ fix i assume‹i < Suc k›‹itdrop i x ∈ A›‹x ∉ A› thenhave‹∃i<k. itdrop (Suc i) x ∈ A› proof (cases ‹i›) qed auto
} thenshow‹∃i<Suc k. itdrop i x ∈ A ==> (∃i<k. itdrop (Suc i) x ∈ A) ∨ x ∈ A›by auto next assume‹(∃i<k. itdrop (Suc i) x ∈ A) ∨ x ∈ A› thenshow‹∃i<Suc k. itdrop i x ∈ A› by auto qed
lemma until_iterate : ‹{x. ∃k. (∀i<k. itdrop i x ∈ A) ∧ itdrop k x ∈ B} = ∪ (range (λk. iterate (λx. iprepend x ∩ A) k B))› proof (rule set_eqI; rule iffI) fix x
{ fix k assume‹∀i<k. itdrop i x ∈ A ›and‹itdrop k x ∈ B› thenhave‹x ∈ iterate (λx. iprepend x ∩ A) k B› proof (induct ‹k› arbitrary: ‹x›) case0 thenshow‹?case›by simp next case (Suc k) from this(2,3) show‹?case› by (auto intro!: Suc.hyps[where x = ‹itdrop 1 x›, simplified]) qed } thenshow‹x ∈ {x. ∃k. (∀i<k. itdrop i x ∈ A) ∧ itdrop k x ∈ B} ==> x ∈ (∪k. iterate (λx. iprepend x ∩ A) k B)› by blast next fix x
{ fix k assume‹x ∈ iterate (λx. iprepend x ∩ A) k B› thenhave‹(∀i<k. itdrop i x ∈ A) ∧ itdrop k x ∈ B › proof (induct ‹k› arbitrary: ‹x›) case0 thenshow‹?case›by auto next case (Suc k) from this(2) show‹?case› by (auto dest: Suc.hyps[where x = ‹itdrop 1 x›, simplified]
intro: itdrop_all_split) qed } thenshow‹x ∈ (∪k. iterate (λx. iprepend x ∩ A) k B) ==> x ∈ {x. ∃k. (∀i<k. itdrop i x ∈ A) ∧ itdrop k x ∈ B}› by blast qed
lemma release_iterate: ‹ {u. ∀k. (∃i<k. itdrop i u ∈ A) ∨ itdrop k u ∈ B} = ∩ (range (λi. iterate (λx. iprepend x ∪ A) i B))› proof (rule set_eqI; rule iffI) fix x
{ fix i assume‹∀k. (∃i<k. itdrop i x ∈ A) ∨ itdrop k x ∈ B› thenhave‹x ∈ iterate (λx. iprepend x ∪ A) i B› proof (induct ‹i› arbitrary: ‹x›) case0 thenshow‹?case›by auto next case (Suc i) show‹?case› apply (clarsimp) apply (rule Suc.hyps[where x = ‹itdrop 1 x›, simplified]) using Suc(2)[THEN spec, where x = ‹Suc _›,simplified] by auto qed } thenshow‹x ∈ {u. ∀k. (∃i<k. itdrop i u ∈ A) ∨ itdrop k u ∈ B} ==> x ∈ (∩i. iterate (λx. iprepend x ∪ A) i B)› by auto next fix x
{ fix k assume‹∀i. x ∈ iterate (λx. iprepend x ∪ A) i B› thenhave P: ‹∀i. x ∈ iterate (λx. iprepend x ∪ A) i B› by blast assume‹itdrop k x ∉ B›with P have‹∃i<k. itdrop i x ∈ A› proof (induct ‹k› arbitrary: ‹x›) case0 thenshow‹?case›by (simp, metis iterate.simps(1)) next case (Suc k) from this(3) show‹?case› apply clarsimp apply (rule Suc.hyps[where x = ‹itdrop 1 x›, simplified]) using Suc(2)[THEN spec, where x = ‹Suc _›] by auto qed } thenshow‹x ∈ (∩i. iterate (λx. iprepend x ∪ A) i B) ==> x ∈ {u. ∀k. (∃i<k. itdrop i u ∈ A) ∨ itdrop k u ∈ B}› by auto qed
lemma property_until_iterate: ‹property (iterate (λx. prepend x ⊓ A) k B) = iterate (λx. iprepend x ∩ property A) k (property B)› by (induct ‹k›, auto simp: property_Inter property_prepend)
lemma property_release_iterate: ‹property (iterate (λx. prepend x ⊔ A) k B) = iterate (λx. iprepend x ∪ property A) k (property B)› by (induct ‹k›, auto simp: property_Union property_prepend)
lemma ltl3_equiv_ltl: shows‹property ([ φ ]3 T) = [ φ ]l T› and‹property ([ φ ]3 F) = [ φ ]l F› proof (induct ‹φ›) case True_ltl
{ case1 thenshow‹?case›by (simp, transfer, simp) next case2 thenshow‹?case›by (simp, transfer, simp)
} next case (Not_ltl φ)
{ case1 thenshow‹?case›using Not_ltl by simp next case2 thenshow‹?case›using Not_ltl by simp
} next case (Prop_ltl x)
{ case1 thenshow‹?case› apply simp apply transfer apply (simp add: infinites_dprefixes) apply (clarsimp simp add: infinites_def split: trace.split_asm trace.split) apply (rule set_eqI, rule iffI) apply (clarsimp split: trace.split_asm trace.split) apply (metis zero_length.cases) apply (clarsimp split: trace.split_asm trace.split) by (metis Traces.append.simps(3) append_is_empty(2) trace.distinct(1) trace.inject(2)) next case2 thenshow‹?case› apply simp apply transfer apply (simp add: infinites_dprefixes) apply (clarsimp simp add: infinites_def split: trace.split_asm trace.split) apply (rule set_eqI, rule iffI) apply (clarsimp split: trace.split_asm trace.split) apply (metis zero_length.cases) apply (clarsimp split: trace.split_asm trace.split) by (metis Traces.append.simps(3) append_is_empty(2) trace.distinct(1) trace.inject(2))
} next case (Or_ltl φ1 φ2)
{ case1 thenshow‹?case›by (simp add: property_Union Or_ltl) next case2 thenshow‹?case›by (simp add: property_Inter Or_ltl)
} next case (And_ltl φ1 φ2)
{ case1 thenshow‹?case›by (simp add: property_Inter And_ltl) next case2 thenshow‹?case›by (simp add: property_Union And_ltl)
} next case (Next_ltl φ)
{ case1 thenshow‹?case›by (simp add: property_prepend Next_ltl iprepend_def) next case2 thenshow‹?case›by (simp add: property_prepend Next_ltl iprepend_def)
} next case (Until_ltl φ1 φ2)
{ case1 thenshow‹?case› apply (simp add: Until_ltl[THEN sym] property_Union image_Collect property_until_iterate) using until_iterate[simplified] by blast next case2 thenshow‹?case› apply (simp add: Until_ltl[THEN sym] property_Inter image_Collect property_release_iterate) using release_iterate[simplified] by metis
} qed
section‹Equivalence to LTL3 of Bauer et al.›
lemma extension_lemma: ‹in_dset t A = (∀ψ. t ⌢ Infinite ψ ∈ Infinite ` property A)› proof transfer fix t and A :: ‹'a trace set› assume D: ‹definitive A› show‹t ∈ A = (∀ψ. t ⌢ Infinite ψ ∈ Infinite ` infinites A) › proof (rule iffI) assume‹t ∈ A› with D have D': ‹↑ t ⊆ A ›by (rule definitive_contains_extensions)
{ fix ψ have‹t ⌢ Infinite ψ ∈ A› by (rule subsetD[OF D'], force simp add: extensions_def)
} thenhave‹∀ψ. t ⌢ Infinite ψ ∈ A›by auto thus‹∀ψ. t ⌢ Infinite ψ ∈ Infinite ` infinites A› by (simp add: infinites_append_right infinites_alt) next assume‹∀ψ. t ⌢ Infinite ψ ∈ Infinite ` infinites A›then have inA: ‹∀ψ. t ⌢ Infinite ψ ∈ A› by (simp add: infinites_alt infinites_append_right) have‹↑ t ⊆↓s A› proof -
{ fix u obtain ψ :: ‹'a infinite_trace›where‹Infinite ψ = u ⌢ Infinite undefined› by (cases ‹u›; simp) thenhave‹∃v. (t ⌢ u) ⌢ v ∈ A› using inA[THEN spec, where x = ‹ψ›] by (metis trace.assoc)
} thus‹?thesis›unfolding extensions_def prefix_closure_def prefixes_def by auto qed with D show‹t ∈ A›by (rule definitive_elemI) qed qed
lemma iterates_nonempty: ‹range (λi. iterate f i X) ≠ {}› by blast
lemma until_cont: ‹A ≠ {} ==> prepend (⊔ A) ⊓ X = ⊔ ((λx. prepend x ⊓ X) ` A)› by (simp add: prepend_Union[THEN sym] dset.SUP_inf)
lemma release_cont: ‹A ≠ {} ==> prepend (⊓ A) ⊔ X = ⊓ ((λx. prepend x ⊔ X) ` A)› by (simp add: prepend_Inter[THEN sym] dset.INF_sup)
lemma iterate_unroll_Inter: assumes‹∧A. A ≠ {} ==> f (⊓ A) = ⊓ (f ` A)› shows‹⊓ (range (λi. iterate f i X)) = X ⊓ f (⊓ (range (λi. iterate f i X )))› apply (subst unroll_Inter) by (force simp: assms[OF iterates_nonempty] property_Inter intro: definitives_inverse_eqI)
lemma iterate_unroll_Union: assumes‹∧A. A ≠ {} ==> f (⊔ A) = ⊔ (f ` A)› shows‹⊔ (range (λi. iterate f i X)) = X ⊔ f (⊔ (range (λi. iterate f i X )))› apply (subst unroll_Union) by (force simp: assms[OF iterates_nonempty] property_Union intro: definitives_inverse_eqI)
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.