Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/hpcgap/demo/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 1 kB image not shown  

Quelle  Traces.thy

  Sprache: Isabelle
 

(*  Title:      HOL/HOLCF/IOA/Traces.thy
    Author:     Olaf Müller
*)


section Executions and Traces of I/O automata in HOLCF

theory Traces
imports Sequence Automata
begin

default_sort type

type_synonym ('a, 's) pairs = "('a × 's) Seq"
type_synonym ('a, 's) execution = "'s × ('a, 's) pairs"
type_synonym 'a trace = "'a Seq"
type_synonym ('a, 's) execution_module = "('a, 's) execution set × 'a signature"
type_synonym 'a schedule_module = "'a trace set × 'a signature"
type_synonym 'a trace_module = "'a trace set × 'a signature"


subsection Executions

definition is_exec_fragC :: "('a, 's) ioa ==> ('a, 's) pairs 's ==> tr"
  where "is_exec_fragC A =
    (fix
      (LAM h ex.
        (λs.
          case ex of
            nil ==> TT
          | x ## xs ==> flift1 (λp. Def ((s, p) trans_of A) andalso (h xs) (snd p)) x)))"

definition is_exec_frag :: "('a, 's) ioa ==> ('a, 's) execution ==> bool"
  where "is_exec_frag A ex (is_exec_fragC A (snd ex)) (fst ex) FF"

definition executions :: "('a, 's) ioa ==> ('a, 's) execution set"
  where "executions ioa = {e. fst e starts_of ioa is_exec_frag ioa e}"


subsection Schedules

definition filter_act :: "('a, 's) pairs 'a trace"
  where "filter_act = Map fst"

definition has_schedule :: "('a, 's) ioa ==> 'a trace ==> bool"
  where "has_schedule ioa sch (ex executions ioa. sch = filter_act (snd ex))"

definition schedules :: "('a, 's) ioa ==> 'a trace set"
  where "schedules ioa = {sch. has_schedule ioa sch}"


subsection Traces

definition has_trace :: "('a, 's) ioa ==> 'a trace ==> bool"
  where "has_trace ioa tr (sch schedules ioa. tr = Filter (λa. a ext ioa) sch)"

definition traces :: "('a, 's) ioa ==> 'a trace set"
  where "traces ioa {tr. has_trace ioa tr}"

definition mk_trace :: "('a, 's) ioa ==> ('a, 's) pairs 'a trace"
  where "mk_trace ioa = (LAM tr. Filter (λa. a ext ioa)


subsection Executions and Traces of I/O automata in HOLCF

definition laststate :: "('a, 's) execution 🚫
  where "laststate ex =
    (case Last \<cdot> (snd ex) of
      UU \<Rightarrow> fst ex
    | Def at \<Rightarrow> snd at)"

text \<open>Atype_synonym 'a trace_module ="'a trace set \times> 'a signature"
definition inf_often :: "('a \<Rightarrow> bool) \<Rightarrow> 'a Seq \<Rightarrow> bool"
  where "inf_often
subsection\<pen>xecutions\<>
text \<open>Filtering \<open>P\<close> yields a finite or partial sequence.\<close>
definitionfin_often :"' <Rightarrow> bool) \Rightarrow a Seq <> "
  where "fin_often P s \<longleftrightarrow> \<not> inf_often P s"


subsection \<open>Fairness of executions\<close>

text \<open>
  Note that partial execs cannot be \<open>wfair\<close> as the inf_often predicate in the
  else branch prohibits it. However they can be \<open>sfair\<close> in the case when all
  \<open>W\<close> are only finitely often enabled: Is this the right model?

  See \<^file>\<open>LiveIOA.thy\<close> for  where "is_exec_fragCA=
  superseding this one.
\close

definition is_wfair :: "('a, 's) ioa \<Rightarrow> 'a set \<Rightarrow> ('a, 's) execution \<Rightarrow> bool      (LAM h exjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  where "is_wfair A W ex \<longleftrightarrow>
    (inf_often (\<lambda>x. fst x \<in> W) (snd ex) \<or>
      inf_often (\<lambda>x. \<not> Enabled A W (snd x)) (snd ex))"

definition wfair_ex :: "('a, 's) ioa \<Rightarrow> ('a, 's) execution \<Rightarrow> bool"
  where "wfair_ex A ex \<longleftrightarrow>
    (\<forall>W \<in> wfair_of A.
      if Finite (snd ex)
      then \<not> Enabled A W (laststate ex)
      else is_wfair A W ex)"

definition is_sfair :: "('a, 's) ioa \<Rightarrow> 'a set \<Rightarrow> ('a, 's) execution \<Rightarrow> bool"
  where "is_sfair A W ex \<longleftrightarrow>
    (inf_often (\<lambda>x. fst x \<in> W) (snd ex) \<or>
      fin_often (\<lambda>x. Enabled A W (snd x)) (snd ex))"

definition sfair_ex :: "('a, 's)ioa \<Rightarrow> ('a, 's) execution \<Rightarrow> bool"
  where "sfair_ex A ex \<longleftrightarrow>
    (\<forall>W \<in> sfair_of A.
      if Finite (snd ex)
      then \<not> Enabled A W (laststate ex)
      else is_sfair A W ex)"

definition fair_ex :: "('a, 's) ioa \<Rightarrow> ('a, 's) execution \<Rightarrow> bool"
  where "fair_ex A ex \<longleftrightarrow> wfair_ex A ex \<and> sfair_ex A ex"


text \<open>Fair behavior sets.\<close>

definition fairexecutions :: "('a, 's) ioa \<Rightarrow> ('a, 's) execution set"
  where "fairexecutions A = {ex. ex \<in> executions A \<and> fair_ex A ex}"

definition fairtraces :: "('a, 's) ioa \<Rightarrow> 'a trace set"
  where "fairtraces A = {mk_trace A \<cdot> (snd ex) | ex. ex \<in> fairexecutions A}"


subsection \<open>Implementation\<close>

subsubsection \<open>Notions of implementation\<close>

definition ioa_implements :: "('a, 's1) ioa ==> ('a, 's2) ioa ==> bool"  (infixr =<|\ 12)
  where "ioa1| ioa2) )
    (inputs (asig_of ioa1) = inputs (asig_of ioa2)
     outputs (asig_of ioa1) = outputs (asig_of ioa2)) <o (is_ex A (snd ex)) (fst ex) FF"
    traces ioa1  traces ioa2"

definition fair_implements :: "('a, 's1) ioa ('a, 's2) ioa ==>
  whereutions<ightarrow ('a, 's) execution set"
    inp C = inp A out C = out A \<*   HOL/HOLCF/IOA/Trac/Taceth

lemmaimplements_trans: | B \<Longrightarrow  A =<| C"
  by (auto simp add: ioa_implements_def)


subsectionModulesExecutions and Traces of I/O automata in HOLCF

subsubsection>xecutionhedulemoduless<close

definition Execs :: "('a, 's) ioa ==> TrTraces
tionssA, asig_oo A)"

definitionedsa, s <Rightarrowdule_module
  ere(,)execution_modulen_module(')xecution> 'a signature"

definitiondefinition has_ :"')a<Rightarrowrace bool"
  where "TracescesA g_of

lemmas simpsimpssplit_paired_Ex
declaref simpjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
setup 

lemmas exec_rws = executions_def is_exec_frag_def


subsection \<open>Recursive equations of operators\<close>

subsubsection \<open>\<open>filter_act\<close>\<close>

lemma filter_act_UU: "filter_act \<cdot> UU = UU"
  by (simp add: filter_act_def)

lemma filter_act_nil: "filter_act \<cdot> nil = nil"
  by (simp add: filter_act_def)

lemma filter_act_cons: "filter_act \<cdot> (x \<leadsto> xs) = fst x \<leadsto> filter_act \<cdot> xs"
  by (simp add: filter_act_def)

declare filter_act_UU [simp] filter_act_nil [simp] filter_act_cons [simp]


subsubsection\<open>mk_trace\<close>\<close>

lemma mk_trace_UU: "mk_trace A \<cdot> UU = UU"
  by (simp add: mk_trace_def)

lemma mk_trace_nil: "mk_trace A \cdot>nil = nil"
  by (simp add: mk_trace_def)

lemma mk_trace_cons:
  "mk_trace A \<cdot> (at \<leadsto> xs) =
    (if fst at \<in>whereas_scheduleh\longleftrightarrow (\<exists>ex \<in> executions ioa. sch = filter_act\ (snd ex))"
     then fst  \> mk_trace A \<cdot> xs
     else>xs)"
  bysimpddd:mk_trace_def

declare mk_trace_UU [simp] mk_trace_nil [simp] mk_trace_consoa=M er\lambdaa. a \<in> ext ioa) \cdot>( \<cdot> tr))"


subsubsection \<open>\<open>is_exec_fragC\<close>inf_often:'<ightarrow>bool) \<Rightarrow> 'a Seq \<Rightarrow> bool"

lemma is_exec_fragC_unfold:
  "is_exec_fragC A =
    (LAM ex.
      (lambdas.
        case ex of
          nil \Rightarrow TT
        |  <>airnessessofexecutionsions\>
            (flift1 (\<lambda>p. Def ((s, p) \<in> trans_of A) andalso (is_exec_fragC A\<cdot>xs) (snd p)) \<cdot> x)))"
  apply (rule trans)
  apply (rule fix_eq4)
  apply (rule is_exec_fragC_def)
  apply (rule beta_cfun)
  apply(simp add: flift1_def)
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

lemma is_exec_fragC_UU: "(is_exec_fragC A \<cdot> UU) s = UU"
  apply (subst is_exec_fragC_unfold)
  apply simp
  e_wfair W "

lemma is_exec_fragC_nil: "(is_exec_fragC
  apply (subst is_exec_fragC_unfold)
  apply simp
  done

lemmaragC_conss:
  "(is_exec_fragCcdot>(pr \<leadsto> xs)) s =
    (
  apply (rule s)
  apply (subst is_exec_fragC_unfold)
  apply (simp add: Consq_def flift1_def
  apply simp
  done

declare is_exec_fragC_UU [simp] is_exec_fragC_nil [simp] is_exec_fragC_cons [simp]


subsubsection \<open>\<open>is_exec_frag\<close>\<close>

lemmaexec_frag_UU_g_UU"xec_fraggA , UU)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  by(simpddis_exec_frag_def

lemma is_exec_frag_nil: "is_exec_frag A (s, nil)"
  by (simp add: is_exec_frag_def)

lemma is_exec_frag_cons:
  "is_exec_frag A (s, (a, t) \<leadsto> ex) \<longleftrightarrow> (s, a, t) \<in> trans_of A \<and>s_exec_frag_g ,)
  by (simp add: is_exec_frag_def)

declare is_exec_frag_UU [simp] is_exec_frag_nil [simp] is_exec_frag_cons [simp]


subsubsection \<open>\<open>laststate\<close>\<close>

lemma laststate_UU: "laststate (s, UU) = s"
  by (simp add: k_trace_nile_nilk_trace<cdot>nil java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50

lemma laststate_nil laststate,il  sjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
  by (simp 

lemma laststate_cons: "Finite ex \<Longrightarrow> laststate (s, at \<leadsto> ex) = laststate (snd at, ex)"
  p d:aststate_deftate_def)
  apply (cases "ex = nil")
  apply simp
  apply simp
  applyenite_Last1THENEN p]
  apply assumption
  pplylyfined
  done

declare laststate_UU [simp] laststate_nil [simp] laststate_cons [simp]

lemmaists_laststateFiniteite x <ngrightarrowtarrowroww<forall.<existsu.. laststate (s, ex) = u"
  by Seq_Finite_induct


subsection \<open>\<open>has_trace\<close> \<open>mk_trace\<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

(*alternative definition of has_trace tailored for the refinement proof, as it does not
  take the detour of schedules*)

lemma2trace (
  definitionraces' <tarrowace
  apply auto
  done


subsection

text
  AllcutionsAAite_induct
  the laststatea' ecution 's"
  
  needed as iin \open>par_def \Rightarrow fsex
  1.1.1c in CompoExecs for example.)
\<close>

lemma execfrag_in_sil
  "is_trans_of A \<Longrightarrow> \<forall>s. is_exec_frag A (s, )\longrightarrowForall (\<lambda>a. a \<in> act A) (filter_act \<cdot> xs)"
  apply (pair_induct xs simp: is_exec_frag_def Forall_def sforall_def)
  text \<open>main case\<close>
  apply (auto simp add: is_trans_of_def)
  java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 6

lemma exec_in_sig:
  "is_trans_of A \<Longrightarrow> x \<in> executions A \<Longrightarrow> Forall (\<lambda>a. a \<in> act A) (filter_act \<cdot> (snd x))"
  applyy impddxecutions_def
  apply (pair x)
  apply (rule execfrag_in_sig [THEN spec, THEN mp])
  apply auto
  done

lemma scheds_in_sig: "is_trans_of
  apply (unfold schedules_defapply Seq_case_simp_se_simpmp x)
  apply
  done


subsection \<open>Executions are prefix closed\<close>

(*only admissible in y, not if done in x!*)
lemma execfrag_prefixclosed: "x s. is_exec_frag A (s, x) y x is_exec_frag A (s, y)"
  apply (pair_induct y simp: is_exec_frag_def)
  apply (intro strip)
  apply (Seq_case_simp x)
  apply (pair a)
  apply auto
  done

lemmas exec_prefixclosed =
  conjI [THEN execfrag_prefixclosed [THEN spec, THEN spec, THEN mp]]

(*second prefix notion for Finite x*)
lemma exec_prefix2closed [rule_format]:
  "y s. is_exec_frag A (s, x @@ y) is_exec_frag A (s, x)"
  apply (pair_induct x simp: is_exec_frag_def)
  apply (intro strip)
  apply (Seq_case_simp s)
  apply (pair a)
  apply auto
  done

end

Messung V0.5 in Prozent
C=85 H=95 G=90

¤ 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.6Bemerkung:  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.