src/HOL/Auth/Shared.thy
author paulson
Mon Oct 07 10:55:51 1996 +0200 (1996-10-07)
changeset 2064 5a5e508e2a2b
parent 2032 1bbf1bdcaf56
child 2078 b198b3d46fb4
permissions -rw-r--r--
Simple tidying
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@1967
    15
paulson@1934
    16
rules
paulson@1943
    17
  isSym_shrK "isSymKey (shrK A)"
paulson@1934
    18
paulson@1934
    19
consts  (*Initial states of agents -- parameter of the construction*)
paulson@2032
    20
  initState :: [agent set, agent] => msg set
paulson@1934
    21
paulson@1934
    22
primrec initState agent
paulson@1934
    23
        (*Server knows all keys; other agents know only their own*)
paulson@2032
    24
  initState_Server  "initState lost Server     = Key `` range shrK"
paulson@2032
    25
  initState_Friend  "initState lost (Friend i) = {Key (shrK (Friend i))}"
paulson@2064
    26
  initState_Spy     "initState lost Spy        = Key``shrK``lost"
paulson@2032
    27
paulson@1934
    28
paulson@1934
    29
datatype  (*Messages, and components of agent stores*)
paulson@1934
    30
  event = Says agent agent msg
paulson@1934
    31
paulson@1934
    32
consts  
paulson@1934
    33
  sees1 :: [agent, event] => msg set
paulson@1934
    34
paulson@1934
    35
primrec sees1 event
paulson@1934
    36
           (*First agent recalls all that it says, but NOT everything
paulson@1934
    37
             that is sent to it; it must note such things if/when received*)
paulson@2032
    38
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{A',Spy} then {X} else {})"
paulson@1934
    39
          (*part of A's internal state*)
paulson@1934
    40
paulson@1934
    41
consts  
paulson@2032
    42
  sees :: [agent set, agent, event list] => msg set
paulson@1934
    43
paulson@1934
    44
primrec sees list
paulson@1934
    45
        (*Initial knowledge includes all public keys and own private key*)
paulson@2032
    46
  sees_Nil  "sees lost A []       = initState lost A"
paulson@2032
    47
  sees_Cons "sees lost A (ev#evs) = sees1 A ev Un sees lost A evs"
paulson@1934
    48
paulson@1934
    49
paulson@1934
    50
(*Agents generate "random" nonces.  Different traces always yield
paulson@1934
    51
  different nonces.  Same applies for keys.*)
paulson@1934
    52
consts
paulson@1934
    53
  newN :: "event list => nat"
paulson@1934
    54
  newK :: "event list => key"
paulson@1934
    55
paulson@1934
    56
rules
paulson@2032
    57
  inj_shrK      "inj shrK"
paulson@2032
    58
paulson@2032
    59
  inj_newN      "inj newN"
paulson@1934
    60
paulson@2032
    61
  inj_newK      "inj newK"
paulson@2032
    62
  newK_neq_shrK "newK evs ~= shrK A" 
paulson@2032
    63
  isSym_newK    "isSymKey (newK evs)"
paulson@1934
    64
paulson@1934
    65
end