src/HOLCF/IOA/Modelcheck/Cockpit.thy
author wenzelm
Tue, 10 Jul 2007 23:29:43 +0200
changeset 23719 ccd9cb15c062
parent 19764 372065f34795
child 30609 983e8b6e4e69
permissions -rw-r--r--
more markup for inner and outer syntax; added enclose;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
     1
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
     2
(* $Id$ *)
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
     3
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
     4
theory Cockpit
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
     5
imports MuIOAOracle
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
     6
begin
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
     7
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
     8
datatype 'a action = Alarm 'a | Info 'a | Ack 'a
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
     9
datatype event = NONE | PonR | Eng | Fue
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    10
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    11
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    12
text {*
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    13
  This cockpit automaton is a deeply simplified version of the
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    14
  control component of a helicopter alarm system considered in a study
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    15
  of ESG.  Some properties will be proved by using model checker
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    16
  mucke. *}
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    17
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    18
automaton cockpit =
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    19
  signature
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    20
    actions "event action"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    21
    inputs "Alarm a"
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    22
    outputs "Ack a", "Info a"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    23
  states
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    24
    APonR_incl :: bool
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    25
    info :: event
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    26
  initially "info = NONE & ~APonR_incl"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    27
  transitions
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    28
    "Alarm a"
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    29
      post info := "if (a=NONE) then info else a",
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    30
        APonR_incl := "if (a=PonR) then True else APonR_incl"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    31
    "Info a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    32
      pre "(a=info)"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    33
    "Ack a"
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    34
      pre "(a=PonR --> APonR_incl) & (a=NONE --> ~APonR_incl)"
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    35
      post info := "NONE",
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    36
        APonR_incl := "if (a=PonR) then False else APonR_incl"
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    37
8733
3213613a775a renamed 'hide' to 'hide_action';
wenzelm
parents: 7299
diff changeset
    38
automaton cockpit_hide = hide_action "Info a" in cockpit
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    39
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    40
text {*
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    41
  Subsequent automata express the properties to be proved, see also
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    42
  Cockpit.ML *}
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    43
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    44
automaton Al_before_Ack =
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    45
  signature
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    46
    actions "event action"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    47
    inputs "Alarm a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    48
    outputs "Ack a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    49
  states
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    50
    APonR_incl :: bool
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    51
  initially "~APonR_incl"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    52
  transitions
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    53
    "Alarm a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    54
      post APonR_incl:="if (a=PonR) then True else APonR_incl"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    55
    "Ack a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    56
      pre "(a=PonR --> APonR_incl)"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    57
      post APonR_incl:="if (a=PonR) then False else APonR_incl"
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    58
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    59
automaton Info_while_Al =
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    60
  signature
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    61
    actions "event action"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    62
    inputs "Alarm a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    63
    outputs "Ack a", "Info i"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    64
  states
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    65
    info_at_Pon :: bool
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    66
  initially "~info_at_Pon"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    67
  transitions
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    68
    "Alarm a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    69
      post
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    70
        info_at_Pon:="if (a=PonR) then True else (if (a=NONE) then info_at_Pon else False)"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    71
    "Info a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    72
      pre "(a=PonR) --> info_at_Pon"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    73
    "Ack a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    74
      post info_at_Pon:="False"
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    75
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    76
automaton Info_before_Al =
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    77
  signature
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
    78
    actions "event action"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    79
    inputs "Alarm a"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    80
    outputs "Ack a", "Info i"
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    81
  states
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    82
    info_at_NONE :: bool
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    83
  initially "info_at_NONE"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    84
  transitions
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    85
    "Alarm a"
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    86
      post info_at_NONE:="if (a=NONE) then info_at_NONE else False"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    87
    "Info a"
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    88
      pre "(a=NONE) --> info_at_NONE"
7299
743b22579a2f quite a lot of tuning and cleanup;
wenzelm
parents: 6471
diff changeset
    89
    "Ack a"
10127
86269867de34 renamed "None" to "NONE" (avoid clash with option type);
wenzelm
parents: 8733
diff changeset
    90
      post info_at_NONE:="True"
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
    91
19764
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    92
lemmas aut_simps =
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    93
  cockpit_def cockpit_asig_def cockpit_trans_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    94
  cockpit_initial_def cockpit_hide_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    95
  Al_before_Ack_def Al_before_Ack_asig_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    96
  Al_before_Ack_initial_def Al_before_Ack_trans_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    97
  Info_while_Al_def Info_while_Al_asig_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    98
  Info_while_Al_initial_def Info_while_Al_trans_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
    99
  Info_before_Al_def Info_before_Al_asig_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   100
  Info_before_Al_initial_def Info_before_Al_trans_def
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   101
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   102
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   103
(* to prove, that info is always set at the recent alarm *)
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   104
lemma cockpit_implements_Info_while_Al: "cockpit =<| Info_while_Al"
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   105
apply (tactic {* is_sim_tac (thms "aut_simps") 1 *})
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   106
done
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   107
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   108
(* to prove that before any alarm arrives (and after each acknowledgment),
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   109
   info remains at None *)
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   110
lemma cockpit_implements_Info_before_Al: "cockpit =<| Info_before_Al"
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   111
apply (tactic {* is_sim_tac (thms "aut_simps") 1 *})
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   112
done
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   113
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   114
(* to prove that before any alarm would be acknowledged, it must be arrived *)
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   115
lemma cockpit_implements_Al_before_Ack: "cockpit_hide =<| Al_before_Ack"
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   116
apply (tactic {* is_sim_tac (thms "aut_simps") 1 *})
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   117
apply auto
372065f34795 removed obsolete ML files;
wenzelm
parents: 17244
diff changeset
   118
done
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 10127
diff changeset
   119
6471
08d12ef5fc19 added translation from IOA to mucalculus and corresponding modelchecker examples;
mueller
parents:
diff changeset
   120
end