src/HOL/Auth/Shared.thy
author paulson
Mon Sep 23 18:19:38 1996 +0200 (1996-09-23)
changeset 2012 1b234f1fd9c7
parent 1967 0ff58b41c037
child 2032 1bbf1bdcaf56
permissions -rw-r--r--
Removal of the Notes constructor
paulson@1934
     1
(*  Title:      HOL/Auth/Shared
paulson@1934
     2
    ID:         $Id$
paulson@1934
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1934
     4
    Copyright   1996  University of Cambridge
paulson@1934
     5
paulson@1934
     6
Theory of Shared Keys (common to all symmetric-key protocols)
paulson@1934
     7
paulson@1934
     8
Server keys; initial states of agents; new nonces and keys; function "sees" 
paulson@1934
     9
*)
paulson@1934
    10
paulson@1934
    11
Shared = Message + List + 
paulson@1934
    12
paulson@1934
    13
consts
paulson@1943
    14
  shrK    :: agent => key  (*symmetric keys*)
paulson@1965
    15
  leaked  :: nat set       (*Friendly agents whose keys have leaked to Enemy*)
paulson@1934
    16
paulson@1967
    17
constdefs     (*Enemy and compromised agents*)
paulson@1967
    18
  bad     :: agent set     "bad == insert Enemy (Friend``leaked)"
paulson@1967
    19
paulson@1934
    20
rules
paulson@1943
    21
  isSym_shrK "isSymKey (shrK A)"
paulson@1934
    22
paulson@1934
    23
consts  (*Initial states of agents -- parameter of the construction*)
paulson@1934
    24
  initState :: agent => msg set
paulson@1934
    25
paulson@1934
    26
primrec initState agent
paulson@1934
    27
        (*Server knows all keys; other agents know only their own*)
paulson@1943
    28
  initState_Server  "initState Server     = Key `` range shrK"
paulson@1943
    29
  initState_Friend  "initState (Friend i) = {Key (shrK (Friend i))}"
paulson@1967
    30
  initState_Enemy   "initState Enemy      = Key``shrK``bad"
paulson@1934
    31
paulson@1934
    32
datatype  (*Messages, and components of agent stores*)
paulson@1934
    33
  event = Says agent agent msg
paulson@1934
    34
paulson@1934
    35
consts  
paulson@1934
    36
  sees1 :: [agent, event] => msg set
paulson@1934
    37
paulson@1934
    38
primrec sees1 event
paulson@1934
    39
           (*First agent recalls all that it says, but NOT everything
paulson@1934
    40
             that is sent to it; it must note such things if/when received*)
paulson@1934
    41
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{A',Enemy} then {X} else {})"
paulson@1934
    42
          (*part of A's internal state*)
paulson@1934
    43
paulson@1934
    44
consts  
paulson@1934
    45
  sees :: [agent, event list] => msg set
paulson@1934
    46
paulson@1934
    47
primrec sees list
paulson@1934
    48
        (*Initial knowledge includes all public keys and own private key*)
paulson@1934
    49
  sees_Nil  "sees A []       = initState A"
paulson@1934
    50
  sees_Cons "sees A (ev#evs) = sees1 A ev Un sees A evs"
paulson@1934
    51
paulson@1934
    52
paulson@1934
    53
(*Agents generate "random" nonces.  Different traces always yield
paulson@1934
    54
  different nonces.  Same applies for keys.*)
paulson@1934
    55
consts
paulson@1934
    56
  newN :: "event list => nat"
paulson@1934
    57
  newK :: "event list => key"
paulson@1934
    58
paulson@1934
    59
rules
paulson@1943
    60
  inj_shrK "inj shrK"
paulson@1934
    61
paulson@1934
    62
  inj_newN   "inj newN"
paulson@1934
    63
  fresh_newN "Nonce (newN evs) ~: parts (initState B)" 
paulson@1934
    64
paulson@1934
    65
  inj_newK   "inj newK"
paulson@1934
    66
  fresh_newK "Key (newK evs) ~: parts (initState B)" 
paulson@1934
    67
  isSym_newK "isSymKey (newK evs)"
paulson@1934
    68
paulson@1934
    69
end