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