src/HOLCF/IOA/meta_theory/LiveIOA.thy
author wenzelm
Sun Oct 21 16:27:42 2007 +0200 (2007-10-21)
changeset 25135 4f8176c940cf
parent 19741 f65265d71426
child 26359 6d437bde2f1d
permissions -rw-r--r--
modernized specifications ('definition', 'axiomatization');
mueller@4559
     1
(*  Title:      HOLCF/IOA/meta_theory/LiveIOA.thy
mueller@4559
     2
    ID:         $Id$
wenzelm@12218
     3
    Author:     Olaf Müller
wenzelm@17233
     4
*)
mueller@4559
     5
wenzelm@17233
     6
header {* Live I/O automata -- specified by temproal formulas *}
mueller@4559
     7
wenzelm@17233
     8
theory LiveIOA
wenzelm@17233
     9
imports TLS
wenzelm@17233
    10
begin
wenzelm@17233
    11
wenzelm@17233
    12
defaultsort type
mueller@4559
    13
mueller@4559
    14
types
wenzelm@17233
    15
  ('a, 's) live_ioa = "('a,'s)ioa * ('a,'s)ioa_temp"
mueller@4559
    16
wenzelm@25135
    17
definition
wenzelm@25135
    18
  validLIOA :: "('a,'s)live_ioa => ('a,'s)ioa_temp  => bool" where
wenzelm@25135
    19
  "validLIOA AL P = validIOA (fst AL) ((snd AL) .--> P)"
mueller@4559
    20
wenzelm@25135
    21
definition
wenzelm@25135
    22
  WF :: "('a,'s)ioa => 'a set => ('a,'s)ioa_temp" where
wenzelm@25135
    23
  "WF A acts = (<> [] <%(s,a,t) . Enabled A acts s> .--> [] <> <xt2 (plift (%a. a : acts))>)"
wenzelm@25135
    24
definition
wenzelm@25135
    25
  SF :: "('a,'s)ioa => 'a set => ('a,'s)ioa_temp" where
wenzelm@25135
    26
  "SF A acts = ([] <> <%(s,a,t) . Enabled A acts s> .--> [] <> <xt2 (plift (%a. a : acts))>)"
mueller@4559
    27
wenzelm@25135
    28
definition
wenzelm@25135
    29
  liveexecutions :: "('a,'s)live_ioa => ('a,'s)execution set" where
wenzelm@25135
    30
  "liveexecutions AP = {exec. exec : executions (fst AP) & (exec |== (snd AP))}"
wenzelm@25135
    31
definition
wenzelm@25135
    32
  livetraces :: "('a,'s)live_ioa => 'a trace set" where
wenzelm@25135
    33
  "livetraces AP = {mk_trace (fst AP)$(snd ex) | ex. ex:liveexecutions AP}"
wenzelm@25135
    34
definition
wenzelm@25135
    35
  live_implements :: "('a,'s1)live_ioa => ('a,'s2)live_ioa => bool" where
wenzelm@25135
    36
  "live_implements CL AM = ((inp (fst CL) = inp (fst AM)) &
mueller@4559
    37
                            (out (fst CL) = out (fst AM)) &
wenzelm@25135
    38
                            livetraces CL <= livetraces AM)"
wenzelm@25135
    39
definition
wenzelm@25135
    40
  is_live_ref_map :: "('s1 => 's2) => ('a,'s1)live_ioa => ('a,'s2)live_ioa => bool" where
wenzelm@25135
    41
  "is_live_ref_map f CL AM =
wenzelm@25135
    42
           (is_ref_map f (fst CL ) (fst AM) &
wenzelm@17233
    43
            (! exec : executions (fst CL). (exec |== (snd CL)) -->
wenzelm@25135
    44
                                           ((corresp_ex (fst AM) f exec) |== (snd AM))))"
mueller@4559
    45
wenzelm@19741
    46
wenzelm@19741
    47
declare split_paired_Ex [simp del]
wenzelm@19741
    48
wenzelm@25135
    49
lemma live_implements_trans:
wenzelm@25135
    50
"!!LC. [| live_implements (A,LA) (B,LB); live_implements (B,LB) (C,LC) |]
wenzelm@19741
    51
      ==> live_implements (A,LA) (C,LC)"
wenzelm@19741
    52
apply (unfold live_implements_def)
wenzelm@19741
    53
apply auto
wenzelm@19741
    54
done
wenzelm@19741
    55
wenzelm@19741
    56
wenzelm@19741
    57
subsection "Correctness of live refmap"
wenzelm@25135
    58
wenzelm@25135
    59
lemma live_implements: "[| inp(C)=inp(A); out(C)=out(A);
wenzelm@25135
    60
                   is_live_ref_map f (C,M) (A,L) |]
wenzelm@19741
    61
                ==> live_implements (C,M) (A,L)"
wenzelm@19741
    62
apply (simp add: is_live_ref_map_def live_implements_def livetraces_def liveexecutions_def)
wenzelm@19741
    63
apply (tactic "safe_tac set_cs")
wenzelm@19741
    64
apply (rule_tac x = "corresp_ex A f ex" in exI)
wenzelm@19741
    65
apply (tactic "safe_tac set_cs")
wenzelm@19741
    66
  (* Traces coincide, Lemma 1 *)
wenzelm@19741
    67
  apply (tactic {* pair_tac "ex" 1 *})
wenzelm@19741
    68
  apply (erule lemma_1 [THEN spec, THEN mp])
wenzelm@19741
    69
  apply (simp (no_asm) add: externals_def)
wenzelm@19741
    70
  apply (auto)[1]
wenzelm@19741
    71
  apply (simp add: executions_def reachable.reachable_0)
wenzelm@25135
    72
wenzelm@19741
    73
  (* corresp_ex is execution, Lemma 2 *)
wenzelm@19741
    74
  apply (tactic {* pair_tac "ex" 1 *})
wenzelm@19741
    75
  apply (simp add: executions_def)
wenzelm@25135
    76
  (* start state *)
wenzelm@19741
    77
  apply (rule conjI)
wenzelm@19741
    78
  apply (simp add: is_ref_map_def corresp_ex_def)
wenzelm@19741
    79
  (* is-execution-fragment *)
wenzelm@19741
    80
  apply (erule lemma_2 [THEN spec, THEN mp])
wenzelm@19741
    81
  apply (simp add: reachable.reachable_0)
wenzelm@19741
    82
wenzelm@19741
    83
 (* Liveness *)
wenzelm@19741
    84
apply auto
wenzelm@19741
    85
done
mueller@4559
    86
wenzelm@17233
    87
end