src/HOL/Auth/Message.thy
changeset 2373 490ffa16952e
parent 2284 80ebd1a213fd
child 2484 596a5b5a68ff
equal deleted inserted replaced
2372:a2999e19703b 2373:490ffa16952e
    26 
    26 
    27 constdefs
    27 constdefs
    28   isSymKey :: key=>bool
    28   isSymKey :: key=>bool
    29   "isSymKey K == (invKey K = K)"
    29   "isSymKey K == (invKey K = K)"
    30 
    30 
    31   (*We do not assume  Crypt (invKey K) (Crypt K X) = X
       
    32     because Crypt a is constructor!  We assume that encryption is injective,
       
    33     which is not true in the real world.  The alternative is to take
       
    34     Crypt an as uninterpreted function symbol satisfying the equation
       
    35     above.  This seems to require moving to ZF and regarding msg as an
       
    36     inductive definition instead of a datatype.*) 
       
    37 
       
    38 datatype  (*We allow any number of friendly agents*)
    31 datatype  (*We allow any number of friendly agents*)
    39   agent = Server | Friend nat | Spy
    32   agent = Server | Friend nat | Spy
    40 
    33 
    41 datatype  (*Messages are agent names, nonces, keys, pairs and encryptions*)
    34 datatype  (*Messages are agent names, nonces, keys, pairs and encryptions*)
    42   msg = Agent agent
    35   msg = Agent agent
    43       | Nonce nat
    36       | Nonce nat
    44       | Key   key
    37       | Key   key
       
    38       | Hash  msg
    45       | MPair msg msg
    39       | MPair msg msg
    46       | Crypt key msg
    40       | Crypt key msg
    47 
    41 
    48 (*Allows messages of the form {|A,B,NA|}, etc...*)
    42 (*Allows messages of the form {|A,B,NA|}, etc...*)
    49 syntax
    43 syntax
    61 (** Inductive definition of all "parts" of a message.  **)
    55 (** Inductive definition of all "parts" of a message.  **)
    62 
    56 
    63 consts  parts   :: msg set => msg set
    57 consts  parts   :: msg set => msg set
    64 inductive "parts H"
    58 inductive "parts H"
    65   intrs 
    59   intrs 
    66     Inj     "X: H ==> X: parts H"
    60     Inj     "X: H  ==>  X: parts H"
    67     Fst     "{|X,Y|} : parts H ==> X : parts H"
    61     Fst     "{|X,Y|}   : parts H ==> X : parts H"
    68     Snd     "{|X,Y|} : parts H ==> Y : parts H"
    62     Snd     "{|X,Y|}   : parts H ==> Y : parts H"
    69     Body    "Crypt K X : parts H ==> X : parts H"
    63     Body    "Crypt K X : parts H ==> X : parts H"
    70 
    64 
    71 
    65 
    72 (** Inductive definition of "analz" -- what can be broken down from a set of
    66 (** Inductive definition of "analz" -- what can be broken down from a set of
    73     messages, including keys.  A form of downward closure.  Pairs can
    67     messages, including keys.  A form of downward closure.  Pairs can
    89 consts  synth   :: msg set => msg set
    83 consts  synth   :: msg set => msg set
    90 inductive "synth H"
    84 inductive "synth H"
    91   intrs 
    85   intrs 
    92     Inj     "X: H ==> X: synth H"
    86     Inj     "X: H ==> X: synth H"
    93     Agent   "Agent agt : synth H"
    87     Agent   "Agent agt : synth H"
       
    88     Hash    "X: synth H ==> Hash X : synth H"
    94     MPair   "[| X: synth H;  Y: synth H |] ==> {|X,Y|} : synth H"
    89     MPair   "[| X: synth H;  Y: synth H |] ==> {|X,Y|} : synth H"
    95     Crypt   "[| X: synth H; Key(K): H |] ==> Crypt K X : synth H"
    90     Crypt   "[| X: synth H;  Key(K) : H |] ==> Crypt K X : synth H"
    96 
    91 
    97 end
    92 end