author | blanchet |
Wed, 15 Dec 2010 18:10:32 +0100 | |
changeset 41171 | 043f8dc3b51f |
parent 35418 | 83b0f75810f0 |
child 41775 | 6214816d79d3 |
permissions | -rw-r--r-- |
13508 | 1 |
(****************************************************************************** |
2 |
lemmas on guarded messages for public protocols |
|
3 |
||
4 |
date: march 2002 |
|
5 |
author: Frederic Blanqui |
|
6 |
email: blanqui@lri.fr |
|
7 |
webpage: http://www.lri.fr/~blanqui/ |
|
8 |
||
9 |
University of Cambridge, Computer Laboratory |
|
10 |
William Gates Building, JJ Thomson Avenue |
|
11 |
Cambridge CB3 0FD, United Kingdom |
|
12 |
******************************************************************************) |
|
13 |
||
16417 | 14 |
theory Guard_Public imports Guard Public Extensions begin |
13508 | 15 |
|
16 |
subsection{*Extensions to Theory @{text Public}*} |
|
17 |
||
18 |
declare initState.simps [simp del] |
|
19 |
||
20 |
subsubsection{*signature*} |
|
21 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
20217
diff
changeset
|
22 |
definition sign :: "agent => msg => msg" where |
13508 | 23 |
"sign A X == {|Agent A, X, Crypt (priK A) (Hash X)|}" |
24 |
||
25 |
lemma sign_inj [iff]: "(sign A X = sign A' X') = (A=A' & X=X')" |
|
26 |
by (auto simp: sign_def) |
|
27 |
||
28 |
subsubsection{*agent associated to a key*} |
|
29 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
20217
diff
changeset
|
30 |
definition agt :: "key => agent" where |
13508 | 31 |
"agt K == @A. K = priK A | K = pubK A" |
32 |
||
33 |
lemma agt_priK [simp]: "agt (priK A) = A" |
|
34 |
by (simp add: agt_def) |
|
35 |
||
36 |
lemma agt_pubK [simp]: "agt (pubK A) = A" |
|
37 |
by (simp add: agt_def) |
|
38 |
||
39 |
subsubsection{*basic facts about @{term initState}*} |
|
40 |
||
41 |
lemma no_Crypt_in_parts_init [simp]: "Crypt K X ~:parts (initState A)" |
|
42 |
by (cases A, auto simp: initState.simps) |
|
43 |
||
44 |
lemma no_Crypt_in_analz_init [simp]: "Crypt K X ~:analz (initState A)" |
|
45 |
by auto |
|
46 |
||
47 |
lemma no_priK_in_analz_init [simp]: "A ~:bad |
|
48 |
==> Key (priK A) ~:analz (initState Spy)" |
|
49 |
by (auto simp: initState.simps) |
|
50 |
||
51 |
lemma priK_notin_initState_Friend [simp]: "A ~= Friend C |
|
52 |
==> Key (priK A) ~: parts (initState (Friend C))" |
|
53 |
by (auto simp: initState.simps) |
|
54 |
||
55 |
lemma keyset_init [iff]: "keyset (initState A)" |
|
56 |
by (cases A, auto simp: keyset_def initState.simps) |
|
57 |
||
58 |
subsubsection{*sets of private keys*} |
|
59 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
20217
diff
changeset
|
60 |
definition priK_set :: "key set => bool" where |
13508 | 61 |
"priK_set Ks == ALL K. K:Ks --> (EX A. K = priK A)" |
62 |
||
63 |
lemma in_priK_set: "[| priK_set Ks; K:Ks |] ==> EX A. K = priK A" |
|
64 |
by (simp add: priK_set_def) |
|
65 |
||
66 |
lemma priK_set1 [iff]: "priK_set {priK A}" |
|
67 |
by (simp add: priK_set_def) |
|
68 |
||
69 |
lemma priK_set2 [iff]: "priK_set {priK A, priK B}" |
|
70 |
by (simp add: priK_set_def) |
|
71 |
||
72 |
subsubsection{*sets of good keys*} |
|
73 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
20217
diff
changeset
|
74 |
definition good :: "key set => bool" where |
13508 | 75 |
"good Ks == ALL K. K:Ks --> agt K ~:bad" |
76 |
||
77 |
lemma in_good: "[| good Ks; K:Ks |] ==> agt K ~:bad" |
|
78 |
by (simp add: good_def) |
|
79 |
||
80 |
lemma good1 [simp]: "A ~:bad ==> good {priK A}" |
|
81 |
by (simp add: good_def) |
|
82 |
||
83 |
lemma good2 [simp]: "[| A ~:bad; B ~:bad |] ==> good {priK A, priK B}" |
|
84 |
by (simp add: good_def) |
|
85 |
||
86 |
subsubsection{*greatest nonce used in a trace, 0 if there is no nonce*} |
|
87 |
||
35418 | 88 |
primrec greatest :: "event list => nat" |
89 |
where |
|
90 |
"greatest [] = 0" |
|
91 |
| "greatest (ev # evs) = max (greatest_msg (msg ev)) (greatest evs)" |
|
13508 | 92 |
|
93 |
lemma greatest_is_greatest: "Nonce n:used evs ==> n <= greatest evs" |
|
94 |
apply (induct evs, auto simp: initState.simps) |
|
95 |
apply (drule used_sub_parts_used, safe) |
|
96 |
apply (drule greatest_msg_is_greatest, arith) |
|
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
16417
diff
changeset
|
97 |
by simp |
13508 | 98 |
|
99 |
subsubsection{*function giving a new nonce*} |
|
100 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
20217
diff
changeset
|
101 |
definition new :: "event list => nat" where |
13508 | 102 |
"new evs == Suc (greatest evs)" |
103 |
||
104 |
lemma new_isnt_used [iff]: "Nonce (new evs) ~:used evs" |
|
105 |
by (clarify, drule greatest_is_greatest, auto simp: new_def) |
|
106 |
||
107 |
subsection{*Proofs About Guarded Messages*} |
|
108 |
||
109 |
subsubsection{*small hack necessary because priK is defined as the inverse of pubK*} |
|
110 |
||
111 |
lemma pubK_is_invKey_priK: "pubK A = invKey (priK A)" |
|
112 |
by simp |
|
113 |
||
114 |
lemmas pubK_is_invKey_priK_substI = pubK_is_invKey_priK [THEN ssubst] |
|
115 |
||
116 |
lemmas invKey_invKey_substI = invKey [THEN ssubst] |
|
117 |
||
118 |
lemma "Nonce n:parts {X} ==> Crypt (pubK A) X:guard n {priK A}" |
|
119 |
apply (rule pubK_is_invKey_priK_substI, rule invKey_invKey_substI) |
|
120 |
by (rule Guard_Nonce, simp+) |
|
121 |
||
122 |
subsubsection{*guardedness results*} |
|
123 |
||
124 |
lemma sign_guard [intro]: "X:guard n Ks ==> sign A X:guard n Ks" |
|
125 |
by (auto simp: sign_def) |
|
126 |
||
127 |
lemma Guard_init [iff]: "Guard n Ks (initState B)" |
|
128 |
by (induct B, auto simp: Guard_def initState.simps) |
|
129 |
||
130 |
lemma Guard_knows_max': "Guard n Ks (knows_max' C evs) |
|
131 |
==> Guard n Ks (knows_max C evs)" |
|
132 |
by (simp add: knows_max_def) |
|
133 |
||
134 |
lemma Nonce_not_used_Guard_spies [dest]: "Nonce n ~:used evs |
|
135 |
==> Guard n Ks (spies evs)" |
|
136 |
by (auto simp: Guard_def dest: not_used_not_known parts_sub) |
|
137 |
||
138 |
lemma Nonce_not_used_Guard [dest]: "[| evs:p; Nonce n ~:used evs; |
|
139 |
Gets_correct p; one_step p |] ==> Guard n Ks (knows (Friend C) evs)" |
|
140 |
by (auto simp: Guard_def dest: known_used parts_trans) |
|
141 |
||
142 |
lemma Nonce_not_used_Guard_max [dest]: "[| evs:p; Nonce n ~:used evs; |
|
143 |
Gets_correct p; one_step p |] ==> Guard n Ks (knows_max (Friend C) evs)" |
|
144 |
by (auto simp: Guard_def dest: known_max_used parts_trans) |
|
145 |
||
146 |
lemma Nonce_not_used_Guard_max' [dest]: "[| evs:p; Nonce n ~:used evs; |
|
147 |
Gets_correct p; one_step p |] ==> Guard n Ks (knows_max' (Friend C) evs)" |
|
148 |
apply (rule_tac H="knows_max (Friend C) evs" in Guard_mono) |
|
149 |
by (auto simp: knows_max_def) |
|
150 |
||
151 |
subsubsection{*regular protocols*} |
|
152 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
20217
diff
changeset
|
153 |
definition regular :: "event list set => bool" where |
13508 | 154 |
"regular p == ALL evs A. evs:p --> (Key (priK A):parts (spies evs)) = (A:bad)" |
155 |
||
156 |
lemma priK_parts_iff_bad [simp]: "[| evs:p; regular p |] ==> |
|
157 |
(Key (priK A):parts (spies evs)) = (A:bad)" |
|
158 |
by (auto simp: regular_def) |
|
159 |
||
160 |
lemma priK_analz_iff_bad [simp]: "[| evs:p; regular p |] ==> |
|
161 |
(Key (priK A):analz (spies evs)) = (A:bad)" |
|
162 |
by auto |
|
163 |
||
164 |
lemma Guard_Nonce_analz: "[| Guard n Ks (spies evs); evs:p; |
|
165 |
priK_set Ks; good Ks; regular p |] ==> Nonce n ~:analz (spies evs)" |
|
166 |
apply (clarify, simp only: knows_decomp) |
|
167 |
apply (drule Guard_invKey_keyset, simp+, safe) |
|
168 |
apply (drule in_good, simp) |
|
169 |
apply (drule in_priK_set, simp+, clarify) |
|
170 |
apply (frule_tac A=A in priK_analz_iff_bad) |
|
171 |
by (simp add: knows_decomp)+ |
|
172 |
||
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
16417
diff
changeset
|
173 |
end |