src/HOL/Auth/Guard/P1.thy
author berghofe
Wed, 11 Jul 2007 11:14:51 +0200
changeset 23746 a455e69c31cc
parent 17778 93d7e524417a
child 35416 d8d7d1b785af
permissions -rw-r--r--
Adapted to new inductive definition package.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     1
(******************************************************************************
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     2
from G. Karjoth, N. Asokan and C. Gulcu
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     3
"Protecting the computation results of free-roaming agents"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     4
Mobiles Agents 1998, LNCS 1477
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     5
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     6
date: february 2002
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     7
author: Frederic Blanqui
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     8
email: blanqui@lri.fr
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
     9
webpage: http://www.lri.fr/~blanqui/
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    10
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    11
University of Cambridge, Computer Laboratory
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    12
William Gates Building, JJ Thomson Avenue
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    13
Cambridge CB3 0FD, United Kingdom
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    14
******************************************************************************)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    15
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    16
header{*Protocol P1*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    17
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 13508
diff changeset
    18
theory P1 imports Guard_Public List_Msg begin
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    19
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    20
subsection{*Protocol Definition*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    21
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    22
(******************************************************************************
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    23
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    24
the contents of the messages are not completely specified in the paper
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    25
we assume that the user sends his request and his itinerary in the clear
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    26
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    27
we will adopt the following format for messages: {|A,r,I,L|}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    28
A: originator (agent)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    29
r: request (number)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    30
I: next shops (agent list)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    31
L: collected offers (offer list)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    32
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    33
in the paper, the authors use nonces r_i to add redundancy in the offer
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    34
in order to make it safer against dictionary attacks
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    35
it is not necessary in our modelization since crypto is assumed to be strong
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    36
(Crypt in injective)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    37
******************************************************************************)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    38
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    39
subsubsection{*offer chaining:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    40
B chains his offer for A with the head offer of L for sending it to C*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    41
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    42
constdefs chain :: "agent => nat => agent => msg => agent => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    43
"chain B ofr A L C ==
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    44
let m1= Crypt (pubK A) (Nonce ofr) in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    45
let m2= Hash {|head L, Agent C|} in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    46
sign B {|m1,m2|}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    47
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    48
declare Let_def [simp]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    49
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    50
lemma chain_inj [iff]: "(chain B ofr A L C = chain B' ofr' A' L' C')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    51
= (B=B' & ofr=ofr' & A=A' & head L = head L' & C=C')"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    52
by (auto simp: chain_def Let_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    53
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    54
lemma Nonce_in_chain [iff]: "Nonce ofr:parts {chain B ofr A L C}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    55
by (auto simp: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    56
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    57
subsubsection{*agent whose key is used to sign an offer*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    58
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    59
consts shop :: "msg => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    60
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    61
recdef shop "measure size"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    62
"shop {|B,X,Crypt K H|} = Agent (agt K)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    63
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    64
lemma shop_chain [simp]: "shop (chain B ofr A L C) = Agent B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    65
by (simp add: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    66
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    67
subsubsection{*nonce used in an offer*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    68
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    69
consts nonce :: "msg => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    70
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    71
recdef nonce "measure size"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    72
"nonce {|B,{|Crypt K ofr,m2|},CryptH|} = ofr"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    73
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    74
lemma nonce_chain [simp]: "nonce (chain B ofr A L C) = Nonce ofr"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    75
by (simp add: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    76
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    77
subsubsection{*next shop*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    78
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    79
consts next_shop :: "msg => agent"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    80
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    81
recdef next_shop "measure size"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    82
"next_shop {|B,{|m1,Hash{|headL,Agent C|}|},CryptH|} = C"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    83
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    84
lemma next_shop_chain [iff]: "next_shop (chain B ofr A L C) = C"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    85
by (simp add: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    86
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    87
subsubsection{*anchor of the offer list*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    88
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    89
constdefs anchor :: "agent => nat => agent => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    90
"anchor A n B == chain A n A (cons nil nil) B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    91
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    92
lemma anchor_inj [iff]: "(anchor A n B = anchor A' n' B')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    93
= (A=A' & n=n' & B=B')"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    94
by (auto simp: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    95
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    96
lemma Nonce_in_anchor [iff]: "Nonce n:parts {anchor A n B}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    97
by (auto simp: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    98
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
    99
lemma shop_anchor [simp]: "shop (anchor A n B) = Agent A"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   100
by (simp add: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   101
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   102
lemma nonce_anchor [simp]: "nonce (anchor A n B) = Nonce n"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   103
by (simp add: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   104
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   105
lemma next_shop_anchor [iff]: "next_shop (anchor A n B) = B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   106
by (simp add: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   107
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   108
subsubsection{*request event*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   109
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   110
constdefs reqm :: "agent => nat => nat => msg => agent => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   111
"reqm A r n I B == {|Agent A, Number r, cons (Agent A) (cons (Agent B) I),
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   112
cons (anchor A n B) nil|}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   113
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   114
lemma reqm_inj [iff]: "(reqm A r n I B = reqm A' r' n' I' B')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   115
= (A=A' & r=r' & n=n' & I=I' & B=B')"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   116
by (auto simp: reqm_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   117
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   118
lemma Nonce_in_reqm [iff]: "Nonce n:parts {reqm A r n I B}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   119
by (auto simp: reqm_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   120
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   121
constdefs req :: "agent => nat => nat => msg => agent => event"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   122
"req A r n I B == Says A B (reqm A r n I B)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   123
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   124
lemma req_inj [iff]: "(req A r n I B = req A' r' n' I' B')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   125
= (A=A' & r=r' & n=n' & I=I' & B=B')"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   126
by (auto simp: req_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   127
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   128
subsubsection{*propose event*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   129
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   130
constdefs prom :: "agent => nat => agent => nat => msg => msg =>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   131
msg => agent => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   132
"prom B ofr A r I L J C == {|Agent A, Number r,
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   133
app (J, del (Agent B, I)), cons (chain B ofr A L C) L|}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   134
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   135
lemma prom_inj [dest]: "prom B ofr A r I L J C
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   136
= prom B' ofr' A' r' I' L' J' C'
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   137
==> B=B' & ofr=ofr' & A=A' & r=r' & L=L' & C=C'"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   138
by (auto simp: prom_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   139
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   140
lemma Nonce_in_prom [iff]: "Nonce ofr:parts {prom B ofr A r I L J C}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   141
by (auto simp: prom_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   142
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   143
constdefs pro :: "agent => nat => agent => nat => msg => msg =>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   144
msg => agent => event"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   145
"pro B ofr A r I L J C == Says B C (prom B ofr A r I L J C)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   146
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   147
lemma pro_inj [dest]: "pro B ofr A r I L J C = pro B' ofr' A' r' I' L' J' C'
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   148
==> B=B' & ofr=ofr' & A=A' & r=r' & L=L' & C=C'"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   149
by (auto simp: pro_def dest: prom_inj)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   150
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   151
subsubsection{*protocol*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   152
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   153
inductive_set p1 :: "event list set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   154
where
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   155
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   156
  Nil: "[]:p1"
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   157
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   158
| Fake: "[| evsf:p1; X:synth (analz (spies evsf)) |] ==> Says Spy B X # evsf : p1"
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   159
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   160
| Request: "[| evsr:p1; Nonce n ~:used evsr; I:agl |] ==> req A r n I B # evsr : p1"
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   161
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   162
| Propose: "[| evsp:p1; Says A' B {|Agent A,Number r,I,cons M L|}:set evsp;
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   163
  I:agl; J:agl; isin (Agent C, app (J, del (Agent B, I)));
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   164
  Nonce ofr ~:used evsp |] ==> pro B ofr A r I (cons M L) J C # evsp : p1"
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   165
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   166
subsubsection{*Composition of Traces*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   167
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   168
lemma "evs':p1 ==> 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   169
       evs:p1 & (ALL n. Nonce n:used evs' --> Nonce n ~:used evs) --> 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   170
       evs'@evs : p1"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   171
apply (erule p1.induct, safe) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   172
apply (simp_all add: used_ConsI) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   173
apply (erule p1.Fake, erule synth_sub, rule analz_mono, rule knows_sub_app)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   174
apply (erule p1.Request, safe, simp_all add: req_def, force) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   175
apply (erule_tac A'=A' in p1.Propose, simp_all) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   176
apply (drule_tac x=ofr in spec, simp add: pro_def, blast) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   177
apply (erule_tac A'=A' in p1.Propose, auto simp: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   178
done
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   179
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   180
subsubsection{*Valid Offer Lists*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   181
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   182
inductive_set
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   183
  valid :: "agent => nat => agent => msg set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   184
  for A :: agent and n :: nat and B :: agent
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   185
where
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   186
  Request [intro]: "cons (anchor A n B) nil:valid A n B"
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   187
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   188
| Propose [intro]: "L:valid A n B
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   189
==> cons (chain (next_shop (head L)) ofr A L C) L:valid A n B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   190
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   191
subsubsection{*basic properties of valid*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   192
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   193
lemma valid_not_empty: "L:valid A n B ==> EX M L'. L = cons M L'"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   194
by (erule valid.cases, auto)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   195
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   196
lemma valid_pos_len: "L:valid A n B ==> 0 < len L"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   197
by (erule valid.induct, auto)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   198
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   199
subsubsection{*offers of an offer list*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   200
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   201
constdefs offer_nonces :: "msg => msg set"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   202
"offer_nonces L == {X. X:parts {L} & (EX n. X = Nonce n)}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   203
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   204
subsubsection{*the originator can get the offers*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   205
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   206
lemma "L:valid A n B ==> offer_nonces L <= analz (insert L (initState A))"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   207
by (erule valid.induct, auto simp: anchor_def chain_def sign_def
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   208
offer_nonces_def initState.simps)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   209
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   210
subsubsection{*list of offers*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   211
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   212
consts offers :: "msg => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   213
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   214
recdef offers "measure size"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   215
"offers (cons M L) = cons {|shop M, nonce M|} (offers L)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   216
"offers other = nil"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   217
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   218
subsubsection{*list of agents whose keys are used to sign a list of offers*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   219
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   220
consts shops :: "msg => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   221
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   222
recdef shops "measure size"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   223
"shops (cons M L) = cons (shop M) (shops L)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   224
"shops other = other"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   225
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   226
lemma shops_in_agl: "L:valid A n B ==> shops L:agl"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   227
by (erule valid.induct, auto simp: anchor_def chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   228
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   229
subsubsection{*builds a trace from an itinerary*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   230
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   231
consts offer_list :: "agent * nat * agent * msg * nat => msg"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   232
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   233
recdef offer_list "measure (%(A,n,B,I,ofr). size I)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   234
"offer_list (A,n,B,nil,ofr) = cons (anchor A n B) nil"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   235
"offer_list (A,n,B,cons (Agent C) I,ofr) = (
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   236
let L = offer_list (A,n,B,I,Suc ofr) in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   237
cons (chain (next_shop (head L)) ofr A L C) L)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   238
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   239
lemma "I:agl ==> ALL ofr. offer_list (A,n,B,I,ofr):valid A n B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   240
by (erule agl.induct, auto)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   241
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   242
consts trace :: "agent * nat * agent * nat * msg * msg * msg
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   243
=> event list"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   244
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   245
recdef trace "measure (%(B,ofr,A,r,I,L,K). size K)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   246
"trace (B,ofr,A,r,I,L,nil) = []"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   247
"trace (B,ofr,A,r,I,L,cons (Agent D) K) = (
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   248
let C = (if K=nil then B else agt_nb (head K)) in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   249
let I' = (if K=nil then cons (Agent A) (cons (Agent B) I)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   250
          else cons (Agent A) (app (I, cons (head K) nil))) in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   251
let I'' = app (I, cons (head K) nil) in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   252
pro C (Suc ofr) A r I' L nil D
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   253
# trace (B,Suc ofr,A,r,I'',tail L,K))"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   254
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   255
constdefs trace' :: "agent => nat => nat => msg => agent => nat => event list"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   256
"trace' A r n I B ofr == (
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   257
let AI = cons (Agent A) I in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   258
let L = offer_list (A,n,B,AI,ofr) in
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   259
trace (B,ofr,A,r,nil,L,AI))"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   260
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   261
declare trace'_def [simp]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   262
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   263
subsubsection{*there is a trace in which the originator receives a valid answer*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   264
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   265
lemma p1_not_empty: "evs:p1 ==> req A r n I B:set evs -->
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   266
(EX evs'. evs'@evs:p1 & pro B' ofr A r I' L J A:set evs' & L:valid A n B)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   267
oops
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   268
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   269
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   270
subsection{*properties of protocol P1*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   271
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   272
text{*publicly verifiable forward integrity:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   273
anyone can verify the validity of an offer list*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   274
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   275
subsubsection{*strong forward integrity:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   276
except the last one, no offer can be modified*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   277
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   278
lemma strong_forward_integrity: "ALL L. Suc i < len L
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   279
--> L:valid A n B & repl (L,Suc i,M):valid A n B --> M = ith (L,Suc i)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   280
apply (induct i)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   281
(* i = 0 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   282
apply clarify
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   283
apply (frule len_not_empty, clarsimp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   284
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   285
apply (ind_cases "{|x,xa,l'a|}:valid A n B" for x xa l'a)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   286
apply (ind_cases "{|x,M,l'a|}:valid A n B" for x l'a)
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   287
apply (simp add: chain_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   288
(* i > 0 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   289
apply clarify
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   290
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   291
apply (ind_cases "{|x,repl(l',Suc na,M)|}:valid A n B" for x l' na)
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   292
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   293
apply (ind_cases "{|x,l'|}:valid A n B" for x l')
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   294
by (drule_tac x=l' in spec, simp, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   295
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   296
subsubsection{*insertion resilience:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   297
except at the beginning, no offer can be inserted*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   298
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   299
lemma chain_isnt_head [simp]: "L:valid A n B ==>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   300
head L ~= chain (next_shop (head L)) ofr A L C"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   301
by (erule valid.induct, auto simp: chain_def sign_def anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   302
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   303
lemma insertion_resilience: "ALL L. L:valid A n B --> Suc i < len L
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   304
--> ins (L,Suc i,M) ~:valid A n B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   305
apply (induct i)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   306
(* i = 0 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   307
apply clarify
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   308
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   309
apply (ind_cases "{|x,l'|}:valid A n B" for x l', simp)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   310
apply (ind_cases "{|x,M,l'|}:valid A n B" for x l', clarsimp)
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   311
apply (ind_cases "{|head l',l'|}:valid A n B" for l', simp, simp)
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   312
(* i > 0 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   313
apply clarify
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   314
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   315
apply (ind_cases "{|x,l'|}:valid A n B" for x l')
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   316
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   317
apply (ind_cases "{|x,ins(l',Suc na,M)|}:valid A n B" for x l' na)
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   318
apply (frule len_not_empty, clarsimp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   319
by (drule_tac x=l' in spec, clarsimp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   320
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   321
subsubsection{*truncation resilience:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   322
only shop i can truncate at offer i*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   323
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   324
lemma truncation_resilience: "ALL L. L:valid A n B --> Suc i < len L
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   325
--> cons M (trunc (L,Suc i)):valid A n B --> shop M = shop (ith (L,i))"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   326
apply (induct i)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   327
(* i = 0 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   328
apply clarify
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   329
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   330
apply (ind_cases "{|x,l'|}:valid A n B" for x l')
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   331
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   332
apply (ind_cases "{|M,l'|}:valid A n B" for l')
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   333
apply (frule len_not_empty, clarsimp, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   334
(* i > 0 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   335
apply clarify
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   336
apply (frule len_not_empty, clarsimp)
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   337
apply (ind_cases "{|x,l'|}:valid A n B" for x l')
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   338
apply (frule len_not_empty, clarsimp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   339
by (drule_tac x=l' in spec, clarsimp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   340
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   341
subsubsection{*declarations for tactics*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   342
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   343
declare knows_Spy_partsEs [elim]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   344
declare Fake_parts_insert [THEN subsetD, dest]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   345
declare initState.simps [simp del]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   346
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   347
subsubsection{*get components of a message*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   348
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   349
lemma get_ML [dest]: "Says A' B {|A,r,I,M,L|}:set evs ==>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   350
M:parts (spies evs) & L:parts (spies evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   351
by blast
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   352
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   353
subsubsection{*general properties of p1*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   354
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   355
lemma reqm_neq_prom [iff]:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   356
"reqm A r n I B ~= prom B' ofr A' r' I' (cons M L) J C"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   357
by (auto simp: reqm_def prom_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   358
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   359
lemma prom_neq_reqm [iff]:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   360
"prom B' ofr A' r' I' (cons M L) J C ~= reqm A r n I B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   361
by (auto simp: reqm_def prom_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   362
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   363
lemma req_neq_pro [iff]: "req A r n I B ~= pro B' ofr A' r' I' (cons M L) J C"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   364
by (auto simp: req_def pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   365
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   366
lemma pro_neq_req [iff]: "pro B' ofr A' r' I' (cons M L) J C ~= req A r n I B"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   367
by (auto simp: req_def pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   368
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   369
lemma p1_has_no_Gets: "evs:p1 ==> ALL A X. Gets A X ~:set evs"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   370
by (erule p1.induct, auto simp: req_def pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   371
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   372
lemma p1_is_Gets_correct [iff]: "Gets_correct p1"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   373
by (auto simp: Gets_correct_def dest: p1_has_no_Gets)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   374
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   375
lemma p1_is_one_step [iff]: "one_step p1"
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 17778
diff changeset
   376
by (unfold one_step_def, clarify, ind_cases "ev#evs:p1" for ev evs, auto)
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   377
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   378
lemma p1_has_only_Says' [rule_format]: "evs:p1 ==>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   379
ev:set evs --> (EX A B X. ev=Says A B X)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   380
by (erule p1.induct, auto simp: req_def pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   381
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   382
lemma p1_has_only_Says [iff]: "has_only_Says p1"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   383
by (auto simp: has_only_Says_def dest: p1_has_only_Says')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   384
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   385
lemma p1_is_regular [iff]: "regular p1"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   386
apply (simp only: regular_def, clarify)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   387
apply (erule_tac p1.induct)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   388
apply (simp_all add: initState.simps knows.simps pro_def prom_def
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   389
                     req_def reqm_def anchor_def chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   390
by (auto dest: no_Key_in_agl no_Key_in_appdel parts_trans)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   391
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   392
subsubsection{*private keys are safe*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   393
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   394
lemma priK_parts_Friend_imp_bad [rule_format,dest]:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   395
     "[| evs:p1; Friend B ~= A |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   396
      ==> (Key (priK A):parts (knows (Friend B) evs)) --> (A:bad)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   397
apply (erule p1.induct)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   398
apply (simp_all add: initState.simps knows.simps pro_def prom_def
17778
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 16417
diff changeset
   399
                req_def reqm_def anchor_def chain_def sign_def)
13508
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   400
apply (blast dest: no_Key_in_agl)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   401
apply (auto del: parts_invKey disjE  dest: parts_trans
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   402
            simp add: no_Key_in_appdel)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   403
done
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   404
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   405
lemma priK_analz_Friend_imp_bad [rule_format,dest]:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   406
     "[| evs:p1; Friend B ~= A |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   407
==> (Key (priK A):analz (knows (Friend B) evs)) --> (A:bad)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   408
by auto
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   409
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   410
lemma priK_notin_knows_max_Friend: "[| evs:p1; A ~:bad; A ~= Friend C |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   411
==> Key (priK A) ~:analz (knows_max (Friend C) evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   412
apply (rule not_parts_not_analz, simp add: knows_max_def, safe)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   413
apply (drule_tac H="spies' evs" in parts_sub)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   414
apply (rule_tac p=p1 in knows_max'_sub_spies', simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   415
apply (drule_tac H="spies evs" in parts_sub)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   416
by (auto dest: knows'_sub_knows [THEN subsetD] priK_notin_initState_Friend)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   417
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   418
subsubsection{*general guardedness properties*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   419
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   420
lemma agl_guard [intro]: "I:agl ==> I:guard n Ks"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   421
by (erule agl.induct, auto)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   422
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   423
lemma Says_to_knows_max'_guard: "[| Says A' C {|A'',r,I,L|}:set evs;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   424
Guard n Ks (knows_max' C evs) |] ==> L:guard n Ks"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   425
by (auto dest: Says_to_knows_max')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   426
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   427
lemma Says_from_knows_max'_guard: "[| Says C A' {|A'',r,I,L|}:set evs;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   428
Guard n Ks (knows_max' C evs) |] ==> L:guard n Ks"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   429
by (auto dest: Says_from_knows_max')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   430
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   431
lemma Says_Nonce_not_used_guard: "[| Says A' B {|A'',r,I,L|}:set evs;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   432
Nonce n ~:used evs |] ==> L:guard n Ks"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   433
by (drule not_used_not_parts, auto)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   434
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   435
subsubsection{*guardedness of messages*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   436
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   437
lemma chain_guard [iff]: "chain B ofr A L C:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   438
by (case_tac "ofr=n", auto simp: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   439
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   440
lemma chain_guard_Nonce_neq [intro]: "n ~= ofr
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   441
==> chain B ofr A' L C:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   442
by (auto simp: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   443
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   444
lemma anchor_guard [iff]: "anchor A n' B:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   445
by (case_tac "n'=n", auto simp: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   446
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   447
lemma anchor_guard_Nonce_neq [intro]: "n ~= n'
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   448
==> anchor A' n' B:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   449
by (auto simp: anchor_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   450
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   451
lemma reqm_guard [intro]: "I:agl ==> reqm A r n' I B:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   452
by (case_tac "n'=n", auto simp: reqm_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   453
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   454
lemma reqm_guard_Nonce_neq [intro]: "[| n ~= n'; I:agl |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   455
==> reqm A' r n' I B:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   456
by (auto simp: reqm_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   457
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   458
lemma prom_guard [intro]: "[| I:agl; J:agl; L:guard n {priK A} |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   459
==> prom B ofr A r I L J C:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   460
by (auto simp: prom_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   461
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   462
lemma prom_guard_Nonce_neq [intro]: "[| n ~= ofr; I:agl; J:agl;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   463
L:guard n {priK A} |] ==> prom B ofr A' r I L J C:guard n {priK A}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   464
by (auto simp: prom_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   465
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   466
subsubsection{*Nonce uniqueness*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   467
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   468
lemma uniq_Nonce_in_chain [dest]: "Nonce k:parts {chain B ofr A L C} ==> k=ofr"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   469
by (auto simp: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   470
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   471
lemma uniq_Nonce_in_anchor [dest]: "Nonce k:parts {anchor A n B} ==> k=n"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   472
by (auto simp: anchor_def chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   473
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   474
lemma uniq_Nonce_in_reqm [dest]: "[| Nonce k:parts {reqm A r n I B};
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   475
I:agl |] ==> k=n"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   476
by (auto simp: reqm_def dest: no_Nonce_in_agl)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   477
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   478
lemma uniq_Nonce_in_prom [dest]: "[| Nonce k:parts {prom B ofr A r I L J C};
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   479
I:agl; J:agl; Nonce k ~:parts {L} |] ==> k=ofr"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   480
by (auto simp: prom_def dest: no_Nonce_in_agl no_Nonce_in_appdel)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   481
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   482
subsubsection{*requests are guarded*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   483
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   484
lemma req_imp_Guard [rule_format]: "[| evs:p1; A ~:bad |] ==>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   485
req A r n I B:set evs --> Guard n {priK A} (spies evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   486
apply (erule p1.induct, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   487
apply (simp add: req_def knows.simps, safe)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   488
apply (erule in_synth_Guard, erule Guard_analz, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   489
by (auto simp: req_def pro_def dest: Says_imp_knows_Spy)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   490
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   491
lemma req_imp_Guard_Friend: "[| evs:p1; A ~:bad; req A r n I B:set evs |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   492
==> Guard n {priK A} (knows_max (Friend C) evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   493
apply (rule Guard_knows_max')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   494
apply (rule_tac H="spies evs" in Guard_mono)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   495
apply (rule req_imp_Guard, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   496
apply (rule_tac B="spies' evs" in subset_trans)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   497
apply (rule_tac p=p1 in knows_max'_sub_spies', simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   498
by (rule knows'_sub_knows)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   499
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   500
subsubsection{*propositions are guarded*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   501
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   502
lemma pro_imp_Guard [rule_format]: "[| evs:p1; B ~:bad; A ~:bad |] ==>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   503
pro B ofr A r I (cons M L) J C:set evs --> Guard ofr {priK A} (spies evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   504
apply (erule p1.induct) (* +3 subgoals *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   505
(* Nil *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   506
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   507
(* Fake *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   508
apply (simp add: pro_def, safe) (* +4 subgoals *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   509
(* 1 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   510
apply (erule in_synth_Guard, drule Guard_analz, simp, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   511
(* 2 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   512
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   513
(* 3 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   514
apply (simp, simp add: req_def pro_def, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   515
(* 4 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   516
apply (simp add: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   517
apply (blast dest: prom_inj Says_Nonce_not_used_guard Nonce_not_used_Guard)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   518
(* 5 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   519
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   520
apply safe (* +1 subgoal *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   521
apply (simp add: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   522
apply (blast dest: prom_inj Says_Nonce_not_used_guard)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   523
(* 6 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   524
apply (simp add: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   525
apply (blast dest: Says_imp_knows_Spy)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   526
(* Request *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   527
apply (simp add: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   528
apply (blast dest: prom_inj Says_Nonce_not_used_guard Nonce_not_used_Guard)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   529
(* Propose *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   530
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   531
apply safe (* +1 subgoal *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   532
(* 1 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   533
apply (simp add: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   534
apply (blast dest: prom_inj Says_Nonce_not_used_guard)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   535
(* 2 *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   536
apply (simp add: pro_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   537
by (blast dest: Says_imp_knows_Spy)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   538
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   539
lemma pro_imp_Guard_Friend: "[| evs:p1; B ~:bad; A ~:bad;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   540
pro B ofr A r I (cons M L) J C:set evs |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   541
==> Guard ofr {priK A} (knows_max (Friend D) evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   542
apply (rule Guard_knows_max')
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   543
apply (rule_tac H="spies evs" in Guard_mono)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   544
apply (rule pro_imp_Guard, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   545
apply (rule_tac B="spies' evs" in subset_trans)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   546
apply (rule_tac p=p1 in knows_max'_sub_spies', simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   547
by (rule knows'_sub_knows)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   548
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   549
subsubsection{*data confidentiality:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   550
no one other than the originator can decrypt the offers*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   551
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   552
lemma Nonce_req_notin_spies: "[| evs:p1; req A r n I B:set evs; A ~:bad |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   553
==> Nonce n ~:analz (spies evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   554
by (frule req_imp_Guard, simp+, erule Guard_Nonce_analz, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   555
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   556
lemma Nonce_req_notin_knows_max_Friend: "[| evs:p1; req A r n I B:set evs;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   557
A ~:bad; A ~= Friend C |] ==> Nonce n ~:analz (knows_max (Friend C) evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   558
apply (clarify, frule_tac C=C in req_imp_Guard_Friend, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   559
apply (simp add: knows_max_def, drule Guard_invKey_keyset, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   560
by (drule priK_notin_knows_max_Friend, auto simp: knows_max_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   561
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   562
lemma Nonce_pro_notin_spies: "[| evs:p1; B ~:bad; A ~:bad;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   563
pro B ofr A r I (cons M L) J C:set evs |] ==> Nonce ofr ~:analz (spies evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   564
by (frule pro_imp_Guard, simp+, erule Guard_Nonce_analz, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   565
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   566
lemma Nonce_pro_notin_knows_max_Friend: "[| evs:p1; B ~:bad; A ~:bad;
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   567
A ~= Friend D; pro B ofr A r I (cons M L) J C:set evs |]
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   568
==> Nonce ofr ~:analz (knows_max (Friend D) evs)"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   569
apply (clarify, frule_tac A=A in pro_imp_Guard_Friend, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   570
apply (simp add: knows_max_def, drule Guard_invKey_keyset, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   571
by (drule priK_notin_knows_max_Friend, auto simp: knows_max_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   572
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   573
subsubsection{*non repudiability:
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   574
an offer signed by B has been sent by B*}
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   575
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   576
lemma Crypt_reqm: "[| Crypt (priK A) X:parts {reqm A' r n I B}; I:agl |] ==> A=A'"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   577
by (auto simp: reqm_def anchor_def chain_def sign_def dest: no_Crypt_in_agl)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   578
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   579
lemma Crypt_prom: "[| Crypt (priK A) X:parts {prom B ofr A' r I L J C};
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   580
I:agl; J:agl |] ==> A=B | Crypt (priK A) X:parts {L}"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   581
apply (simp add: prom_def anchor_def chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   582
by (blast dest: no_Crypt_in_agl no_Crypt_in_appdel)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   583
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   584
lemma Crypt_safeness: "[| evs:p1; A ~:bad |] ==> Crypt (priK A) X:parts (spies evs)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   585
--> (EX B Y. Says A B Y:set evs & Crypt (priK A) X:parts {Y})"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   586
apply (erule p1.induct)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   587
(* Nil *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   588
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   589
(* Fake *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   590
apply clarsimp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   591
apply (drule_tac P="%G. Crypt (priK A) X:G" in parts_insert_substD, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   592
apply (erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   593
apply (drule_tac K="priK A" in Crypt_synth, simp+, blast, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   594
(* Request *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   595
apply (simp add: req_def, clarify)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   596
apply (drule_tac P="%G. Crypt (priK A) X:G" in parts_insert_substD, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   597
apply (erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   598
apply (frule Crypt_reqm, simp, clarify)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   599
apply (rule_tac x=B in exI, rule_tac x="reqm A r n I B" in exI, simp, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   600
(* Propose *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   601
apply (simp add: pro_def, clarify)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   602
apply (drule_tac P="%G. Crypt (priK A) X:G" in parts_insert_substD, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   603
apply (rotate_tac -1, erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   604
apply (frule Crypt_prom, simp, simp)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   605
apply (rotate_tac -1, erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   606
apply (rule_tac x=C in exI)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   607
apply (rule_tac x="prom B ofr Aa r I (cons M L) J C" in exI, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   608
apply (subgoal_tac "cons M L:parts (spies evsp)")
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   609
apply (drule_tac G="{cons M L}" and H="spies evsp" in parts_trans, blast, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   610
apply (drule Says_imp_spies, rotate_tac -1, drule parts.Inj)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   611
apply (drule parts.Snd, drule parts.Snd, drule parts.Snd)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   612
by auto
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   613
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   614
lemma Crypt_Hash_imp_sign: "[| evs:p1; A ~:bad |] ==>
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   615
Crypt (priK A) (Hash X):parts (spies evs)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   616
--> (EX B Y. Says A B Y:set evs & sign A X:parts {Y})"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   617
apply (erule p1.induct)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   618
(* Nil *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   619
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   620
(* Fake *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   621
apply clarsimp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   622
apply (drule_tac P="%G. Crypt (priK A) (Hash X):G" in parts_insert_substD)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   623
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   624
apply (erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   625
apply (drule_tac K="priK A" in Crypt_synth, simp+, blast, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   626
(* Request *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   627
apply (simp add: req_def, clarify)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   628
apply (drule_tac P="%G. Crypt (priK A) (Hash X):G" in parts_insert_substD)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   629
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   630
apply (erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   631
apply (frule Crypt_reqm, simp+)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   632
apply (rule_tac x=B in exI, rule_tac x="reqm Aa r n I B" in exI)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   633
apply (simp add: reqm_def sign_def anchor_def no_Crypt_in_agl)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   634
apply (simp add: chain_def sign_def, blast)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   635
(* Propose *)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   636
apply (simp add: pro_def, clarify)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   637
apply (drule_tac P="%G. Crypt (priK A) (Hash X):G" in parts_insert_substD)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   638
apply simp
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   639
apply (rotate_tac -1, erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   640
apply (simp add: prom_def sign_def no_Crypt_in_agl no_Crypt_in_appdel)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   641
apply (simp add: chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   642
apply (rotate_tac -1, erule disjE)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   643
apply (rule_tac x=C in exI)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   644
apply (rule_tac x="prom B ofr Aa r I (cons M L) J C" in exI)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   645
apply (simp add: prom_def chain_def sign_def)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   646
apply (erule impE) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   647
apply (blast dest: get_ML parts_sub) 
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   648
apply (blast del: MPair_parts)+
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   649
done
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   650
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   651
lemma sign_safeness: "[| evs:p1; A ~:bad |] ==> sign A X:parts (spies evs)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   652
--> (EX B Y. Says A B Y:set evs & sign A X:parts {Y})"
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   653
apply (clarify, simp add: sign_def, frule parts.Snd)
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   654
apply (blast dest: Crypt_Hash_imp_sign [unfolded sign_def])
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   655
done
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   656
890d736b93a5 Frederic Blanqui's new "guard" examples
paulson
parents:
diff changeset
   657
end