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