src/HOL/Auth/Event.thy
author paulson
Sat May 19 12:19:23 2001 +0200 (2001-05-19)
changeset 11310 51e70b7bc315
parent 11192 5fd02b905a9a
child 11463 96b5b27da55c
permissions -rw-r--r--
spelling check
paulson@3512
     1
(*  Title:      HOL/Auth/Event
paulson@3512
     2
    ID:         $Id$
paulson@3512
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@3512
     4
    Copyright   1996  University of Cambridge
paulson@3512
     5
paulson@3512
     6
Theory of events for security protocols
paulson@3512
     7
paulson@3683
     8
Datatype of events; function "spies"; freshness
paulson@3678
     9
paulson@3683
    10
"bad" agents have been broken by the Spy; their private keys and internal
paulson@3678
    11
    stores are visible to him
paulson@3512
    12
*)
paulson@3512
    13
paulson@11104
    14
theory Event = Message
paulson@11104
    15
files ("Event_lemmas.ML"):
paulson@11104
    16
paulson@3512
    17
consts  (*Initial states of agents -- parameter of the construction*)
paulson@11104
    18
  initState :: "agent => msg set"
paulson@3512
    19
paulson@6399
    20
datatype
paulson@3512
    21
  event = Says  agent agent msg
paulson@6399
    22
        | Gets  agent       msg
paulson@3512
    23
        | Notes agent       msg
paulson@6308
    24
       
paulson@6308
    25
consts 
paulson@11104
    26
  bad    :: "agent set"				(*compromised agents*)
paulson@11104
    27
  knows  :: "agent => event list => msg set"
paulson@3512
    28
paulson@6308
    29
paulson@11310
    30
(*"spies" is retained for compatibility's sake*)
paulson@6308
    31
syntax
paulson@11104
    32
  spies  :: "event list => msg set"
paulson@3519
    33
paulson@6308
    34
translations
paulson@6308
    35
  "spies"   => "knows Spy"
paulson@6308
    36
paulson@6308
    37
paulson@11104
    38
axioms
paulson@3519
    39
  (*Spy has access to his own key for spoof messages, but Server is secure*)
paulson@11310
    40
  Spy_in_bad     [iff] :    "Spy \\<in> bad"
paulson@11310
    41
  Server_not_bad [iff] : "Server \\<notin> bad"
paulson@3512
    42
berghofe@5183
    43
primrec
paulson@11104
    44
  knows_Nil:   "knows A [] = initState A"
paulson@11104
    45
  knows_Cons:
paulson@6399
    46
    "knows A (ev # evs) =
paulson@6399
    47
       (if A = Spy then 
paulson@6399
    48
	(case ev of
paulson@6399
    49
	   Says A' B X => insert X (knows Spy evs)
paulson@6399
    50
	 | Gets A' X => knows Spy evs
paulson@6399
    51
	 | Notes A' X  => 
paulson@11310
    52
	     if A' \\<in> bad then insert X (knows Spy evs) else knows Spy evs)
paulson@6399
    53
	else
paulson@6399
    54
	(case ev of
paulson@6399
    55
	   Says A' B X => 
paulson@6399
    56
	     if A'=A then insert X (knows A evs) else knows A evs
paulson@6399
    57
	 | Gets A' X    => 
paulson@6399
    58
	     if A'=A then insert X (knows A evs) else knows A evs
paulson@6399
    59
	 | Notes A' X    => 
paulson@6399
    60
	     if A'=A then insert X (knows A evs) else knows A evs))"
paulson@6308
    61
paulson@6308
    62
(*
paulson@6308
    63
  Case A=Spy on the Gets event
paulson@6308
    64
  enforces the fact that if a message is received then it must have been sent,
paulson@6308
    65
  therefore the oops case must use Notes
paulson@6308
    66
*)
paulson@3678
    67
paulson@3683
    68
consts
paulson@3683
    69
  (*Set of items that might be visible to somebody:
paulson@3683
    70
    complement of the set of fresh items*)
paulson@11104
    71
  used :: "event list => msg set"
paulson@3512
    72
berghofe@5183
    73
primrec
paulson@11104
    74
  used_Nil:   "used []         = (UN B. parts (initState B))"
paulson@11104
    75
  used_Cons:  "used (ev # evs) =
paulson@11104
    76
		     (case ev of
paulson@11104
    77
			Says A B X => parts {X} Un (used evs)
paulson@11104
    78
		      | Gets A X   => used evs
paulson@11104
    79
		      | Notes A X  => parts {X} Un (used evs))"
paulson@6308
    80
paulson@6308
    81
paulson@11104
    82
use "Event_lemmas.ML"
paulson@11104
    83
paulson@11104
    84
method_setup analz_mono_contra = {*
paulson@11104
    85
    Method.no_args
paulson@11104
    86
      (Method.METHOD (fn facts => REPEAT_FIRST analz_mono_contra_tac)) *}
paulson@11310
    87
    "for proving theorems of the form X \\<notin> analz (knows Spy evs) --> P"
paulson@3512
    88
paulson@3512
    89
end