src/HOL/Auth/Shared.thy
author paulson
Thu, 26 Sep 1996 12:50:48 +0200
changeset 2032 1bbf1bdcaf56
parent 2012 1b234f1fd9c7
child 2064 5a5e508e2a2b
permissions -rw-r--r--
Introduction of "lost" argument Changed Enemy -> Spy Ran expandshort
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Shared
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     2
    ID:         $Id$
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     5
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     6
Theory of Shared Keys (common to all symmetric-key protocols)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     7
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     8
Server keys; initial states of agents; new nonces and keys; function "sees" 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     9
*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    10
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    11
Shared = Message + List + 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    12
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    13
consts
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    14
  shrK    :: agent => key  (*symmetric keys*)
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
    15
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    16
rules
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    17
  isSym_shrK "isSymKey (shrK A)"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    18
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    19
consts  (*Initial states of agents -- parameter of the construction*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    20
  initState :: [agent set, agent] => msg set
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    21
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    22
primrec initState agent
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    23
        (*Server knows all keys; other agents know only their own*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    24
  initState_Server  "initState lost Server     = Key `` range shrK"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    25
  initState_Friend  "initState lost (Friend i) = {Key (shrK (Friend i))}"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    26
  initState_Spy   "initState lost Spy      = Key``shrK``lost"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    27
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    28
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    29
datatype  (*Messages, and components of agent stores*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    30
  event = Says agent agent msg
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    31
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    32
consts  
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    33
  sees1 :: [agent, event] => msg set
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    34
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    35
primrec sees1 event
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    36
           (*First agent recalls all that it says, but NOT everything
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    37
             that is sent to it; it must note such things if/when received*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    38
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{A',Spy} then {X} else {})"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    39
          (*part of A's internal state*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    40
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    41
consts  
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    42
  sees :: [agent set, agent, event list] => msg set
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    43
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    44
primrec sees list
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    45
        (*Initial knowledge includes all public keys and own private key*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    46
  sees_Nil  "sees lost A []       = initState lost A"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    47
  sees_Cons "sees lost A (ev#evs) = sees1 A ev Un sees lost A evs"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    48
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    49
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    50
(*Agents generate "random" nonces.  Different traces always yield
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    51
  different nonces.  Same applies for keys.*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    52
consts
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    53
  newN :: "event list => nat"
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    54
  newK :: "event list => key"
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    55
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    56
rules
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    57
  inj_shrK      "inj shrK"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    58
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    59
  inj_newN      "inj newN"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    60
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    61
  inj_newK      "inj newK"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    62
  newK_neq_shrK "newK evs ~= shrK A" 
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2012
diff changeset
    63
  isSym_newK    "isSymKey (newK evs)"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    64
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    65
end