src/HOL/Auth/Public.thy
author paulson
Tue, 01 Jul 1997 17:35:09 +0200
changeset 3478 770939fecbb3
parent 2497 47de509bdd55
child 3512 9dcb4daa15e8
permissions -rw-r--r--
Removal of the obsolete newN function
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Public
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     2
    ID:         $Id$
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     5
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     6
Theory of Public Keys (common to all symmetric-key protocols)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     7
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     8
Server keys; initial states of agents; new nonces and keys; function "sees" 
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     9
*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    10
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    11
Public = Message + List + 
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    12
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    13
consts
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    14
  pubK    :: agent => key
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    15
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    16
syntax
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    17
  priK    :: agent => key
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    18
3478
770939fecbb3 Removal of the obsolete newN function
paulson
parents: 2497
diff changeset
    19
translations  (*BEWARE! expressions like  (inj priK)  will NOT work!*)
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    20
  "priK x"  == "invKey(pubK x)"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    21
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    22
consts  (*Initial states of agents -- parameter of the construction*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    23
  initState :: [agent set, agent] => msg set
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    24
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    25
primrec initState agent
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    26
        (*Agents know their private key and all public keys*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    27
  initState_Server  "initState lost Server     =    
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    28
 		         insert (Key (priK Server)) (Key `` range pubK)"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    29
  initState_Friend  "initState lost (Friend i) =    
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    30
 		         insert (Key (priK (Friend i))) (Key `` range pubK)"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    31
  initState_Spy     "initState lost Spy        =    
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    32
 		         (Key``invKey``pubK``lost) Un (Key `` range pubK)"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    33
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    34
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    35
datatype  (*Messages, and components of agent stores*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    36
  event = Says agent agent msg
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    37
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    38
consts  
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    39
  sees1 :: [agent, event] => msg set
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    40
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    41
primrec sees1 event
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    42
           (*Spy reads all traffic whether addressed to him or not*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    43
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{B,Spy} then {X} else {})"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    44
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    45
consts  
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    46
  sees :: [agent set, agent, event list] => msg set
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    47
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    48
primrec sees list
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    49
  sees_Nil  "sees lost A []       = initState lost A"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    50
  sees_Cons "sees lost A (ev#evs) = sees1 A ev Un sees lost A evs"
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    51
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    52
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    53
constdefs
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    54
  (*Set of items that might be visible to somebody: complement of the set
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    55
        of fresh items*)
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    56
  used :: event list => msg set
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    57
    "used evs == parts (UN lost B. sees lost B evs)"
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    58
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    59
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    60
rules
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    61
  (*Public keys are disjoint, and never clash with private keys*)
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2318
diff changeset
    62
  inj_pubK        "inj pubK"
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2318
diff changeset
    63
  priK_neq_pubK   "priK A ~= pubK B"
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    64
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    65
end