src/HOL/Auth/Public.thy
author nipkow
Tue Apr 08 10:48:42 1997 +0200 (1997-04-08)
changeset 2919 953a47dc0519
parent 2497 47de509bdd55
child 3478 770939fecbb3
permissions -rw-r--r--
Dep. on Provers/nat_transitive
paulson@2318
     1
(*  Title:      HOL/Auth/Public
paulson@2318
     2
    ID:         $Id$
paulson@2318
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2318
     4
    Copyright   1996  University of Cambridge
paulson@2318
     5
paulson@2318
     6
Theory of Public Keys (common to all symmetric-key protocols)
paulson@2318
     7
paulson@2318
     8
Server keys; initial states of agents; new nonces and keys; function "sees" 
paulson@2318
     9
*)
paulson@2318
    10
paulson@2318
    11
Public = Message + List + 
paulson@2318
    12
paulson@2318
    13
consts
paulson@2318
    14
  pubK    :: agent => key
paulson@2318
    15
paulson@2318
    16
syntax
paulson@2318
    17
  priK    :: agent => key
paulson@2318
    18
paulson@2318
    19
translations
paulson@2318
    20
  "priK x"  == "invKey(pubK x)"
paulson@2318
    21
paulson@2318
    22
consts  (*Initial states of agents -- parameter of the construction*)
paulson@2318
    23
  initState :: [agent set, agent] => msg set
paulson@2318
    24
paulson@2318
    25
primrec initState agent
paulson@2318
    26
        (*Agents know their private key and all public keys*)
paulson@2318
    27
  initState_Server  "initState lost Server     =    
paulson@2318
    28
 		         insert (Key (priK Server)) (Key `` range pubK)"
paulson@2318
    29
  initState_Friend  "initState lost (Friend i) =    
paulson@2318
    30
 		         insert (Key (priK (Friend i))) (Key `` range pubK)"
paulson@2318
    31
  initState_Spy     "initState lost Spy        =    
paulson@2318
    32
 		         (Key``invKey``pubK``lost) Un (Key `` range pubK)"
paulson@2318
    33
paulson@2318
    34
paulson@2318
    35
datatype  (*Messages, and components of agent stores*)
paulson@2318
    36
  event = Says agent agent msg
paulson@2318
    37
paulson@2318
    38
consts  
paulson@2318
    39
  sees1 :: [agent, event] => msg set
paulson@2318
    40
paulson@2318
    41
primrec sees1 event
paulson@2318
    42
           (*Spy reads all traffic whether addressed to him or not*)
paulson@2318
    43
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{B,Spy} then {X} else {})"
paulson@2318
    44
paulson@2318
    45
consts  
paulson@2318
    46
  sees :: [agent set, agent, event list] => msg set
paulson@2318
    47
paulson@2318
    48
primrec sees list
paulson@2318
    49
  sees_Nil  "sees lost A []       = initState lost A"
paulson@2318
    50
  sees_Cons "sees lost A (ev#evs) = sees1 A ev Un sees lost A evs"
paulson@2318
    51
paulson@2318
    52
paulson@2497
    53
constdefs
paulson@2497
    54
  (*Set of items that might be visible to somebody: complement of the set
paulson@2497
    55
        of fresh items*)
paulson@2497
    56
  used :: event list => msg set
paulson@2497
    57
    "used evs == parts (UN lost B. sees lost B evs)"
paulson@2497
    58
paulson@2497
    59
paulson@2451
    60
(*Agents generate "random" nonces, uniquely determined by their argument.*)
paulson@2318
    61
consts
paulson@2451
    62
  newN  :: nat => nat
paulson@2318
    63
paulson@2318
    64
rules
paulson@2318
    65
paulson@2318
    66
  (*Public keys are disjoint, and never clash with private keys*)
paulson@2451
    67
  inj_pubK        "inj pubK"
paulson@2451
    68
  priK_neq_pubK   "priK A ~= pubK B"
paulson@2318
    69
paulson@2451
    70
  inj_newN        "inj newN"
paulson@2318
    71
paulson@2318
    72
end