author | wenzelm |
Wed, 25 Jun 2025 16:35:25 +0200 | |
changeset 82768 | 8f866fd6fae1 |
parent 81543 | fa37ee54644c |
permissions | -rw-r--r-- |
41775 | 1 |
(* Title: HOL/Auth/Guard/Proto.thy |
2 |
Author: Frederic Blanqui, University of Cambridge Computer Laboratory |
|
3 |
Copyright 2002 University of Cambridge |
|
4 |
*) |
|
13508 | 5 |
|
61830 | 6 |
section\<open>Other Protocol-Independent Results\<close> |
13508 | 7 |
|
16417 | 8 |
theory Proto imports Guard_Public begin |
13508 | 9 |
|
61830 | 10 |
subsection\<open>protocols\<close> |
13508 | 11 |
|
41774 | 12 |
type_synonym rule = "event set * event" |
13508 | 13 |
|
20768 | 14 |
abbreviation |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
15 |
msg' :: "rule => msg" where |
20768 | 16 |
"msg' R == msg (snd R)" |
13508 | 17 |
|
41774 | 18 |
type_synonym proto = "rule set" |
13508 | 19 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
20 |
definition wdef :: "proto => bool" where |
67613 | 21 |
"wdef p \<equiv> \<forall>R k. R \<in> p \<longrightarrow> Number k \<in> parts {msg' R} |
22 |
\<longrightarrow> Number k \<in> parts (msg`(fst R))" |
|
13508 | 23 |
|
61830 | 24 |
subsection\<open>substitutions\<close> |
13508 | 25 |
|
26 |
record subs = |
|
27 |
agent :: "agent => agent" |
|
28 |
nonce :: "nat => nat" |
|
29 |
nb :: "nat => msg" |
|
30 |
key :: "key => key" |
|
31 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
32 |
primrec apm :: "subs => msg => msg" where |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
33 |
"apm s (Agent A) = Agent (agent s A)" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
34 |
| "apm s (Nonce n) = Nonce (nonce s n)" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
35 |
| "apm s (Number n) = nb s n" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
36 |
| "apm s (Key K) = Key (key s K)" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
37 |
| "apm s (Hash X) = Hash (apm s X)" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
38 |
| "apm s (Crypt K X) = ( |
67613 | 39 |
if (\<exists>A. K = pubK A) then Crypt (pubK (agent s (agt K))) (apm s X) |
40 |
else if (\<exists>A. K = priK A) then Crypt (priK (agent s (agt K))) (apm s X) |
|
13508 | 41 |
else Crypt (key s K) (apm s X))" |
61956 | 42 |
| "apm s \<lbrace>X,Y\<rbrace> = \<lbrace>apm s X, apm s Y\<rbrace>" |
13508 | 43 |
|
67613 | 44 |
lemma apm_parts: "X \<in> parts {Y} \<Longrightarrow> apm s X \<in> parts {apm s Y}" |
13508 | 45 |
apply (erule parts.induct, simp_all, blast) |
46 |
apply (erule parts.Fst) |
|
47 |
apply (erule parts.Snd) |
|
48 |
by (erule parts.Body)+ |
|
49 |
||
67613 | 50 |
lemma Nonce_apm [rule_format]: "Nonce n \<in> parts {apm s X} \<Longrightarrow> |
51 |
(\<forall>k. Number k \<in> parts {X} \<longrightarrow> Nonce n \<notin> parts {nb s k}) \<longrightarrow> |
|
52 |
(\<exists>k. Nonce k \<in> parts {X} \<and> nonce s k = n)" |
|
13508 | 53 |
by (induct X, simp_all, blast) |
54 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
55 |
lemma wdef_Nonce: "\<lbrakk>Nonce n \<in> parts {apm s X}; R \<in> p; msg' R = X; wdef p; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
56 |
Nonce n \<notin> parts (apm s `(msg `(fst R)))\<rbrakk> \<Longrightarrow> |
67613 | 57 |
(\<exists>k. Nonce k \<in> parts {X} \<and> nonce s k = n)" |
13508 | 58 |
apply (erule Nonce_apm, unfold wdef_def) |
62343
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents:
61956
diff
changeset
|
59 |
apply (drule_tac x=R in spec, drule_tac x=k in spec, clarsimp) |
13508 | 60 |
apply (drule_tac x=x in bspec, simp) |
61 |
apply (drule_tac Y="msg x" and s=s in apm_parts, simp) |
|
62 |
by (blast dest: parts_parts) |
|
63 |
||
67613 | 64 |
primrec ap :: "subs \<Rightarrow> event \<Rightarrow> event" where |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
65 |
"ap s (Says A B X) = Says (agent s A) (agent s B) (apm s X)" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
66 |
| "ap s (Gets A X) = Gets (agent s A) (apm s X)" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
67 |
| "ap s (Notes A X) = Notes (agent s A) (apm s X)" |
13508 | 68 |
|
20768 | 69 |
abbreviation |
67613 | 70 |
ap' :: "subs \<Rightarrow> rule \<Rightarrow> event" where |
71 |
"ap' s R \<equiv> ap s (snd R)" |
|
13508 | 72 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
73 |
abbreviation |
67613 | 74 |
apm' :: "subs \<Rightarrow> rule \<Rightarrow> msg" where |
75 |
"apm' s R \<equiv> apm s (msg' R)" |
|
20768 | 76 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
77 |
abbreviation |
67613 | 78 |
priK' :: "subs \<Rightarrow> agent \<Rightarrow> key" where |
79 |
"priK' s A \<equiv> priK (agent s A)" |
|
20768 | 80 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
81 |
abbreviation |
67613 | 82 |
pubK' :: "subs \<Rightarrow> agent \<Rightarrow> key" where |
83 |
"pubK' s A \<equiv> pubK (agent s A)" |
|
13508 | 84 |
|
61830 | 85 |
subsection\<open>nonces generated by a rule\<close> |
13508 | 86 |
|
67613 | 87 |
definition newn :: "rule \<Rightarrow> nat set" where |
88 |
"newn R \<equiv> {n. Nonce n \<in> parts {msg (snd R)} \<and> Nonce n \<notin> parts (msg`(fst R))}" |
|
13508 | 89 |
|
67613 | 90 |
lemma newn_parts: "n \<in> newn R \<Longrightarrow> Nonce (nonce s n) \<in> parts {apm' s R}" |
13508 | 91 |
by (auto simp: newn_def dest: apm_parts) |
92 |
||
61830 | 93 |
subsection\<open>traces generated by a protocol\<close> |
13508 | 94 |
|
67613 | 95 |
definition ok :: "event list \<Rightarrow> rule \<Rightarrow> subs \<Rightarrow> bool" where |
96 |
"ok evs R s \<equiv> ((\<forall>x. x \<in> fst R \<longrightarrow> ap s x \<in> set evs) |
|
97 |
\<and> (\<forall>n. n \<in> newn R \<longrightarrow> Nonce (nonce s n) \<notin> used evs))" |
|
13508 | 98 |
|
23746 | 99 |
inductive_set |
100 |
tr :: "proto => event list set" |
|
101 |
for p :: proto |
|
102 |
where |
|
13508 | 103 |
|
67613 | 104 |
Nil [intro]: "[] \<in> tr p" |
13508 | 105 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
106 |
| Fake [intro]: "\<lbrakk>evsf \<in> tr p; X \<in> synth (analz (spies evsf))\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
107 |
\<Longrightarrow> Says Spy B X # evsf \<in> tr p" |
13508 | 108 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
109 |
| Proto [intro]: "\<lbrakk>evs \<in> tr p; R \<in> p; ok evs R s\<rbrakk> \<Longrightarrow> ap' s R # evs \<in> tr p" |
13508 | 110 |
|
61830 | 111 |
subsection\<open>general properties\<close> |
13508 | 112 |
|
113 |
lemma one_step_tr [iff]: "one_step (tr p)" |
|
114 |
apply (unfold one_step_def, clarify) |
|
67613 | 115 |
by (ind_cases "ev # evs \<in> tr p" for ev evs, auto) |
13508 | 116 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
117 |
definition has_only_Says' :: "proto => bool" where |
67613 | 118 |
"has_only_Says' p \<equiv> \<forall>R. R \<in> p \<longrightarrow> is_Says (snd R)" |
13508 | 119 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
120 |
lemma has_only_Says'D: "\<lbrakk>R \<in> p; has_only_Says' p\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
121 |
\<Longrightarrow> (\<exists>A B X. snd R = Says A B X)" |
13508 | 122 |
by (unfold has_only_Says'_def is_Says_def, blast) |
123 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
124 |
lemma has_only_Says_tr [simp]: "has_only_Says' p \<Longrightarrow> has_only_Says (tr p)" |
76290
64d29ebb7d3d
Mostly, removing the unfold method
paulson <lp15@cam.ac.uk>
parents:
76289
diff
changeset
|
125 |
unfolding has_only_Says_def |
13508 | 126 |
apply (rule allI, rule allI, rule impI) |
127 |
apply (erule tr.induct) |
|
128 |
apply (auto simp: has_only_Says'_def ok_def) |
|
129 |
by (drule_tac x=a in spec, auto simp: is_Says_def) |
|
130 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
131 |
lemma has_only_Says'_in_trD: "\<lbrakk>has_only_Says' p; list @ ev # evs1 \<in> tr p\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
132 |
\<Longrightarrow> (\<exists>A B X. ev = Says A B X)" |
13508 | 133 |
by (drule has_only_Says_tr, auto) |
134 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
135 |
lemma ok_not_used: "\<lbrakk>Nonce n \<notin> used evs; ok evs R s; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
136 |
\<forall>x. x \<in> fst R \<longrightarrow> is_Says x\<rbrakk> \<Longrightarrow> Nonce n \<notin> parts (apm s `(msg `(fst R)))" |
62343
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents:
61956
diff
changeset
|
137 |
apply (unfold ok_def, clarsimp) |
13508 | 138 |
apply (drule_tac x=x in spec, drule_tac x=x in spec) |
139 |
by (auto simp: is_Says_def dest: Says_imp_spies not_used_not_spied parts_parts) |
|
140 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
141 |
lemma ok_is_Says: "\<lbrakk>evs' @ ev # evs \<in> tr p; ok evs R s; has_only_Says' p; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
142 |
R \<in> p; x \<in> fst R\<rbrakk> \<Longrightarrow> is_Says x" |
13508 | 143 |
apply (unfold ok_def is_Says_def, clarify) |
144 |
apply (drule_tac x=x in spec, simp) |
|
145 |
apply (subgoal_tac "one_step (tr p)") |
|
146 |
apply (drule trunc, simp, drule one_step_Cons, simp) |
|
147 |
apply (drule has_only_SaysD, simp+) |
|
148 |
by (clarify, case_tac x, auto) |
|
149 |
||
61830 | 150 |
subsection\<open>types\<close> |
13508 | 151 |
|
67613 | 152 |
type_synonym keyfun = "rule \<Rightarrow> subs \<Rightarrow> nat \<Rightarrow> event list \<Rightarrow> key set" |
13508 | 153 |
|
67613 | 154 |
type_synonym secfun = "rule \<Rightarrow> nat \<Rightarrow> subs \<Rightarrow> key set \<Rightarrow> msg" |
13508 | 155 |
|
61830 | 156 |
subsection\<open>introduction of a fresh guarded nonce\<close> |
13508 | 157 |
|
67613 | 158 |
definition fresh :: "proto \<Rightarrow> rule \<Rightarrow> subs \<Rightarrow> nat \<Rightarrow> key set \<Rightarrow> event list |
159 |
\<Rightarrow> bool" where |
|
160 |
"fresh p R s n Ks evs \<equiv> (\<exists>evs1 evs2. evs = evs2 @ ap' s R # evs1 |
|
161 |
\<and> Nonce n \<notin> used evs1 \<and> R \<in> p \<and> ok evs1 R s \<and> Nonce n \<in> parts {apm' s R} |
|
162 |
\<and> apm' s R \<in> guard n Ks)" |
|
13508 | 163 |
|
67613 | 164 |
lemma freshD: "fresh p R s n Ks evs \<Longrightarrow> (\<exists>evs1 evs2. |
165 |
evs = evs2 @ ap' s R # evs1 \<and> Nonce n \<notin> used evs1 \<and> R \<in> p \<and> ok evs1 R s |
|
166 |
\<and> Nonce n \<in> parts {apm' s R} \<and> apm' s R \<in> guard n Ks)" |
|
76289 | 167 |
unfolding fresh_def by blast |
13508 | 168 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
169 |
lemma freshI [intro]: "\<lbrakk>Nonce n \<notin> used evs1; R \<in> p; Nonce n \<in> parts {apm' s R}; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
170 |
ok evs1 R s; apm' s R \<in> guard n Ks\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
171 |
\<Longrightarrow> fresh p R s n Ks (list @ ap' s R # evs1)" |
76289 | 172 |
unfolding fresh_def by blast |
13508 | 173 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
174 |
lemma freshI': "\<lbrakk>Nonce n \<notin> used evs1; (l,r) \<in> p; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
175 |
Nonce n \<in> parts {apm s (msg r)}; ok evs1 (l,r) s; apm s (msg r) \<in> guard n Ks\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
176 |
\<Longrightarrow> fresh p (l,r) s n Ks (evs2 @ ap s r # evs1)" |
13508 | 177 |
by (drule freshI, simp+) |
178 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
179 |
lemma fresh_used: "\<lbrakk>fresh p R' s' n Ks evs; has_only_Says' p\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
180 |
\<Longrightarrow> Nonce n \<in> used evs" |
13508 | 181 |
apply (unfold fresh_def, clarify) |
182 |
apply (drule has_only_Says'D) |
|
183 |
by (auto intro: parts_used_app) |
|
184 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
185 |
lemma fresh_newn: "\<lbrakk>evs' @ ap' s R # evs \<in> tr p; wdef p; has_only_Says' p; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
186 |
Nonce n \<notin> used evs; R \<in> p; ok evs R s; Nonce n \<in> parts {apm' s R}\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
187 |
\<Longrightarrow> \<exists>k. k \<in> newn R \<and> nonce s k = n" |
13508 | 188 |
apply (drule wdef_Nonce, simp+) |
189 |
apply (frule ok_not_used, simp+) |
|
190 |
apply (clarify, erule ok_is_Says, simp+) |
|
62343
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents:
61956
diff
changeset
|
191 |
apply (clarify, rule_tac x=k in exI, simp add: newn_def) |
13508 | 192 |
apply (clarify, drule_tac Y="msg x" and s=s in apm_parts) |
193 |
apply (drule ok_not_used, simp+) |
|
62343
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents:
61956
diff
changeset
|
194 |
by (clarify, erule ok_is_Says, simp_all) |
13508 | 195 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
196 |
lemma fresh_rule: "\<lbrakk>evs' @ ev # evs \<in> tr p; wdef p; Nonce n \<notin> used evs; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
197 |
Nonce n \<in> parts {msg ev}\<rbrakk> \<Longrightarrow> \<exists>R s. R \<in> p \<and> ap' s R = ev" |
67613 | 198 |
apply (drule trunc, simp, ind_cases "ev # evs \<in> tr p", simp) |
13508 | 199 |
by (drule_tac x=X in in_sub, drule parts_sub, simp, simp, blast+) |
200 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
201 |
lemma fresh_ruleD: "\<lbrakk>fresh p R' s' n Ks evs; keys R' s' n evs \<subseteq> Ks; wdef p; |
67613 | 202 |
has_only_Says' p; evs \<in> tr p; \<forall>R k s. nonce s k = n \<longrightarrow> Nonce n \<in> used evs \<longrightarrow> |
203 |
R \<in> p \<longrightarrow> k \<in> newn R \<longrightarrow> Nonce n \<in> parts {apm' s R} \<longrightarrow> apm' s R \<in> guard n Ks \<longrightarrow> |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
204 |
apm' s R \<in> parts (spies evs) \<longrightarrow> keys R s n evs \<subseteq> Ks \<longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
13508 | 205 |
apply (frule fresh_used, simp) |
206 |
apply (unfold fresh_def, clarify) |
|
207 |
apply (drule_tac x=R' in spec) |
|
208 |
apply (drule fresh_newn, simp+, clarify) |
|
209 |
apply (drule_tac x=k in spec) |
|
210 |
apply (drule_tac x=s' in spec) |
|
67613 | 211 |
apply (subgoal_tac "apm' s' R' \<in> parts (spies (evs2 @ ap' s' R' # evs1))") |
13508 | 212 |
apply (case_tac R', drule has_only_Says'D, simp, clarsimp) |
213 |
apply (case_tac R', drule has_only_Says'D, simp, clarsimp) |
|
214 |
apply (rule_tac Y="apm s' X" in parts_parts, blast) |
|
215 |
by (rule parts.Inj, rule Says_imp_spies, simp, blast) |
|
216 |
||
61830 | 217 |
subsection\<open>safe keys\<close> |
13508 | 218 |
|
67613 | 219 |
definition safe :: "key set \<Rightarrow> msg set \<Rightarrow> bool" where |
220 |
"safe Ks G \<equiv> \<forall>K. K \<in> Ks \<longrightarrow> Key K \<notin> analz G" |
|
13508 | 221 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
222 |
lemma safeD [dest]: "\<lbrakk>safe Ks G; K \<in> Ks\<rbrakk> \<Longrightarrow> Key K \<notin> analz G" |
76289 | 223 |
unfolding safe_def by blast |
13508 | 224 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
225 |
lemma safe_insert: "safe Ks (insert X G) \<Longrightarrow> safe Ks G" |
76289 | 226 |
unfolding safe_def by blast |
13508 | 227 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
228 |
lemma Guard_safe: "\<lbrakk>Guard n Ks G; safe Ks G\<rbrakk> \<Longrightarrow> Nonce n \<notin> analz G" |
13508 | 229 |
by (blast dest: Guard_invKey) |
230 |
||
61830 | 231 |
subsection\<open>guardedness preservation\<close> |
13508 | 232 |
|
67613 | 233 |
definition preserv :: "proto \<Rightarrow> keyfun \<Rightarrow> nat \<Rightarrow> key set \<Rightarrow> bool" where |
234 |
"preserv p keys n Ks \<equiv> (\<forall>evs R' s' R s. evs \<in> tr p \<longrightarrow> |
|
235 |
Guard n Ks (spies evs) \<longrightarrow> safe Ks (spies evs) \<longrightarrow> fresh p R' s' n Ks evs \<longrightarrow> |
|
236 |
keys R' s' n evs \<subseteq> Ks \<longrightarrow> R \<in> p \<longrightarrow> ok evs R s \<longrightarrow> apm' s R \<in> guard n Ks)" |
|
13508 | 237 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
238 |
lemma preservD: "\<lbrakk>preserv p keys n Ks; evs \<in> tr p; Guard n Ks (spies evs); |
67613 | 239 |
safe Ks (spies evs); fresh p R' s' n Ks evs; R \<in> p; ok evs R s; |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
240 |
keys R' s' n evs \<subseteq> Ks\<rbrakk> \<Longrightarrow> apm' s R \<in> guard n Ks" |
76289 | 241 |
unfolding preserv_def by blast |
13508 | 242 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
243 |
lemma preservD': "\<lbrakk>preserv p keys n Ks; evs \<in> tr p; Guard n Ks (spies evs); |
67613 | 244 |
safe Ks (spies evs); fresh p R' s' n Ks evs; (l,Says A B X) \<in> p; |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
245 |
ok evs (l,Says A B X) s; keys R' s' n evs \<subseteq> Ks\<rbrakk> \<Longrightarrow> apm s X \<in> guard n Ks" |
13508 | 246 |
by (drule preservD, simp+) |
247 |
||
61830 | 248 |
subsection\<open>monotonic keyfun\<close> |
13508 | 249 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
250 |
definition monoton :: "proto => keyfun => bool" where |
67613 | 251 |
"monoton p keys \<equiv> \<forall>R' s' n ev evs. ev # evs \<in> tr p \<longrightarrow> |
252 |
keys R' s' n evs \<subseteq> keys R' s' n (ev # evs)" |
|
13508 | 253 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
254 |
lemma monotonD [dest]: "\<lbrakk>keys R' s' n (ev # evs) \<subseteq> Ks; monoton p keys; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
255 |
ev # evs \<in> tr p\<rbrakk> \<Longrightarrow> keys R' s' n evs \<subseteq> Ks" |
76289 | 256 |
unfolding monoton_def by blast |
13508 | 257 |
|
61830 | 258 |
subsection\<open>guardedness theorem\<close> |
13508 | 259 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
260 |
lemma Guard_tr [rule_format]: "\<lbrakk>evs \<in> tr p; has_only_Says' p; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
261 |
preserv p keys n Ks; monoton p keys; Guard n Ks (initState Spy)\<rbrakk> \<Longrightarrow> |
67613 | 262 |
safe Ks (spies evs) \<longrightarrow> fresh p R' s' n Ks evs \<longrightarrow> keys R' s' n evs \<subseteq> Ks \<longrightarrow> |
13508 | 263 |
Guard n Ks (spies evs)" |
264 |
apply (erule tr.induct) |
|
265 |
(* Nil *) |
|
266 |
apply simp |
|
267 |
(* Fake *) |
|
268 |
apply (clarify, drule freshD, clarsimp) |
|
269 |
apply (case_tac evs2) |
|
270 |
(* evs2 = [] *) |
|
271 |
apply (frule has_only_Says'D, simp) |
|
272 |
apply (clarsimp, blast) |
|
273 |
(* evs2 = aa # list *) |
|
274 |
apply (clarsimp, rule conjI) |
|
275 |
apply (blast dest: safe_insert) |
|
276 |
(* X:guard n Ks *) |
|
277 |
apply (rule in_synth_Guard, simp, rule Guard_analz) |
|
278 |
apply (blast dest: safe_insert) |
|
279 |
apply (drule safe_insert, simp add: safe_def) |
|
280 |
(* Proto *) |
|
281 |
apply (clarify, drule freshD, clarify) |
|
282 |
apply (case_tac evs2) |
|
283 |
(* evs2 = [] *) |
|
284 |
apply (frule has_only_Says'D, simp) |
|
285 |
apply (frule_tac R=R' in has_only_Says'D, simp) |
|
286 |
apply (case_tac R', clarsimp, blast) |
|
287 |
(* evs2 = ab # list *) |
|
288 |
apply (frule has_only_Says'D, simp) |
|
289 |
apply (clarsimp, rule conjI) |
|
290 |
apply (drule Proto, simp+, blast dest: safe_insert) |
|
291 |
(* apm s X:guard n Ks *) |
|
292 |
apply (frule Proto, simp+) |
|
293 |
apply (erule preservD', simp+) |
|
294 |
apply (blast dest: safe_insert) |
|
295 |
apply (blast dest: safe_insert) |
|
296 |
by (blast, simp, simp, blast) |
|
297 |
||
61830 | 298 |
subsection\<open>useful properties for guardedness\<close> |
13508 | 299 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
300 |
lemma newn_neq_used: "\<lbrakk>Nonce n \<in> used evs; ok evs R s; k \<in> newn R\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
301 |
\<Longrightarrow> n \<noteq> nonce s k" |
13508 | 302 |
by (auto simp: ok_def) |
303 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
304 |
lemma ok_Guard: "\<lbrakk>ok evs R s; Guard n Ks (spies evs); x \<in> fst R; is_Says x\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
305 |
\<Longrightarrow> apm s (msg x) \<in> parts (spies evs) \<and> apm s (msg x) \<in> guard n Ks" |
13508 | 306 |
apply (unfold ok_def is_Says_def, clarify) |
307 |
apply (drule_tac x="Says A B X" in spec, simp) |
|
308 |
by (drule Says_imp_spies, auto intro: parts_parts) |
|
309 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
310 |
lemma ok_parts_not_new: "\<lbrakk>Y \<in> parts (spies evs); Nonce (nonce s n) \<in> parts {Y}; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
311 |
ok evs R s\<rbrakk> \<Longrightarrow> n \<notin> newn R" |
13508 | 312 |
by (auto simp: ok_def dest: not_used_not_spied parts_parts) |
313 |
||
61830 | 314 |
subsection\<open>unicity\<close> |
13508 | 315 |
|
67613 | 316 |
definition uniq :: "proto \<Rightarrow> secfun \<Rightarrow> bool" where |
317 |
"uniq p secret \<equiv> \<forall>evs R R' n n' Ks s s'. R \<in> p \<longrightarrow> R' \<in> p \<longrightarrow> |
|
318 |
n \<in> newn R \<longrightarrow> n' \<in> newn R' \<longrightarrow> nonce s n = nonce s' n' \<longrightarrow> |
|
319 |
Nonce (nonce s n) \<in> parts {apm' s R} \<longrightarrow> Nonce (nonce s n) \<in> parts {apm' s' R'} \<longrightarrow> |
|
320 |
apm' s R \<in> guard (nonce s n) Ks \<longrightarrow> apm' s' R' \<in> guard (nonce s n) Ks \<longrightarrow> |
|
321 |
evs \<in> tr p \<longrightarrow> Nonce (nonce s n) \<notin> analz (spies evs) \<longrightarrow> |
|
322 |
secret R n s Ks \<in> parts (spies evs) \<longrightarrow> secret R' n' s' Ks \<in> parts (spies evs) \<longrightarrow> |
|
13508 | 323 |
secret R n s Ks = secret R' n' s' Ks" |
324 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
325 |
lemma uniqD: "\<lbrakk>uniq p secret; evs \<in> tr p; R \<in> p; R' \<in> p; n \<in> newn R; n' \<in> newn R'; |
67613 | 326 |
nonce s n = nonce s' n'; Nonce (nonce s n) \<notin> analz (spies evs); |
327 |
Nonce (nonce s n) \<in> parts {apm' s R}; Nonce (nonce s n) \<in> parts {apm' s' R'}; |
|
328 |
secret R n s Ks \<in> parts (spies evs); secret R' n' s' Ks \<in> parts (spies evs); |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
329 |
apm' s R \<in> guard (nonce s n) Ks; apm' s' R' \<in> guard (nonce s n) Ks\<rbrakk> \<Longrightarrow> |
13508 | 330 |
secret R n s Ks = secret R' n' s' Ks" |
76289 | 331 |
unfolding uniq_def by blast |
13508 | 332 |
|
67613 | 333 |
definition ord :: "proto \<Rightarrow> (rule \<Rightarrow> rule \<Rightarrow> bool) \<Rightarrow> bool" where |
334 |
"ord p inff \<equiv> \<forall>R R'. R \<in> p \<longrightarrow> R' \<in> p \<longrightarrow> \<not> inff R R' \<longrightarrow> inff R' R" |
|
13508 | 335 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
336 |
lemma ordD: "\<lbrakk>ord p inff; \<not> inff R R'; R \<in> p; R' \<in> p\<rbrakk> \<Longrightarrow> inff R' R" |
76289 | 337 |
unfolding ord_def by blast |
13508 | 338 |
|
67613 | 339 |
definition uniq' :: "proto \<Rightarrow> (rule \<Rightarrow> rule \<Rightarrow> bool) \<Rightarrow> secfun \<Rightarrow> bool" where |
340 |
"uniq' p inff secret \<equiv> \<forall>evs R R' n n' Ks s s'. R \<in> p \<longrightarrow> R' \<in> p \<longrightarrow> |
|
341 |
inff R R' \<longrightarrow> n \<in> newn R \<longrightarrow> n' \<in> newn R' \<longrightarrow> nonce s n = nonce s' n' \<longrightarrow> |
|
342 |
Nonce (nonce s n) \<in> parts {apm' s R} \<longrightarrow> Nonce (nonce s n) \<in> parts {apm' s' R'} \<longrightarrow> |
|
343 |
apm' s R \<in> guard (nonce s n) Ks \<longrightarrow> apm' s' R' \<in> guard (nonce s n) Ks \<longrightarrow> |
|
344 |
evs \<in> tr p \<longrightarrow> Nonce (nonce s n) \<notin> analz (spies evs) \<longrightarrow> |
|
345 |
secret R n s Ks \<in> parts (spies evs) \<longrightarrow> secret R' n' s' Ks \<in> parts (spies evs) \<longrightarrow> |
|
13508 | 346 |
secret R n s Ks = secret R' n' s' Ks" |
347 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
348 |
lemma uniq'D: "\<lbrakk>uniq' p inff secret; evs \<in> tr p; inff R R'; R \<in> p; R' \<in> p; n \<in> newn R; |
67613 | 349 |
n' \<in> newn R'; nonce s n = nonce s' n'; Nonce (nonce s n) \<notin> analz (spies evs); |
350 |
Nonce (nonce s n) \<in> parts {apm' s R}; Nonce (nonce s n) \<in> parts {apm' s' R'}; |
|
351 |
secret R n s Ks \<in> parts (spies evs); secret R' n' s' Ks \<in> parts (spies evs); |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
352 |
apm' s R \<in> guard (nonce s n) Ks; apm' s' R' \<in> guard (nonce s n) Ks\<rbrakk> \<Longrightarrow> |
13508 | 353 |
secret R n s Ks = secret R' n' s' Ks" |
354 |
by (unfold uniq'_def, blast) |
|
355 |
||
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
356 |
lemma uniq'_imp_uniq: "\<lbrakk>uniq' p inff secret; ord p inff\<rbrakk> \<Longrightarrow> uniq p secret" |
76290
64d29ebb7d3d
Mostly, removing the unfold method
paulson <lp15@cam.ac.uk>
parents:
76289
diff
changeset
|
357 |
unfolding uniq_def |
13508 | 358 |
apply (rule allI)+ |
22426 | 359 |
apply (case_tac "inff R R'") |
13508 | 360 |
apply (blast dest: uniq'D) |
361 |
by (auto dest: ordD uniq'D intro: sym) |
|
362 |
||
61830 | 363 |
subsection\<open>Needham-Schroeder-Lowe\<close> |
13508 | 364 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
365 |
definition a :: agent where "a == Friend 0" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
366 |
definition b :: agent where "b == Friend 1" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
367 |
definition a' :: agent where "a' == Friend 2" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
368 |
definition b' :: agent where "b' == Friend 3" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
369 |
definition Na :: nat where "Na == 0" |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
370 |
definition Nb :: nat where "Nb == 1" |
13508 | 371 |
|
20768 | 372 |
abbreviation |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
373 |
ns1 :: rule where |
61956 | 374 |
"ns1 == ({}, Says a b (Crypt (pubK b) \<lbrace>Nonce Na, Agent a\<rbrace>))" |
13508 | 375 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
376 |
abbreviation |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
377 |
ns2 :: rule where |
61956 | 378 |
"ns2 == ({Says a' b (Crypt (pubK b) \<lbrace>Nonce Na, Agent a\<rbrace>)}, |
379 |
Says b a (Crypt (pubK a) \<lbrace>Nonce Na, Nonce Nb, Agent b\<rbrace>))" |
|
13508 | 380 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
381 |
abbreviation |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
382 |
ns3 :: rule where |
61956 | 383 |
"ns3 == ({Says a b (Crypt (pubK b) \<lbrace>Nonce Na, Agent a\<rbrace>), |
384 |
Says b' a (Crypt (pubK a) \<lbrace>Nonce Na, Nonce Nb, Agent b\<rbrace>)}, |
|
20768 | 385 |
Says a b (Crypt (pubK b) (Nonce Nb)))" |
13508 | 386 |
|
23746 | 387 |
inductive_set ns :: proto where |
67613 | 388 |
[iff]: "ns1 \<in> ns" |
389 |
| [iff]: "ns2 \<in> ns" |
|
390 |
| [iff]: "ns3 \<in> ns" |
|
13508 | 391 |
|
20768 | 392 |
abbreviation (input) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
393 |
ns3a :: event where |
61956 | 394 |
"ns3a == Says a b (Crypt (pubK b) \<lbrace>Nonce Na, Agent a\<rbrace>)" |
13508 | 395 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
396 |
abbreviation (input) |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
20768
diff
changeset
|
397 |
ns3b :: event where |
61956 | 398 |
"ns3b == Says b' a (Crypt (pubK a) \<lbrace>Nonce Na, Nonce Nb, Agent b\<rbrace>)" |
13508 | 399 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
400 |
definition keys :: "keyfun" where |
13508 | 401 |
"keys R' s' n evs == {priK' s' a, priK' s' b}" |
402 |
||
403 |
lemma "monoton ns keys" |
|
404 |
by (simp add: keys_def monoton_def) |
|
405 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
406 |
definition secret :: "secfun" where |
13508 | 407 |
"secret R n s Ks == |
61956 | 408 |
(if R=ns1 then apm s (Crypt (pubK b) \<lbrace>Nonce Na, Agent a\<rbrace>) |
409 |
else if R=ns2 then apm s (Crypt (pubK a) \<lbrace>Nonce Na, Nonce Nb, Agent b\<rbrace>) |
|
13508 | 410 |
else Number 0)" |
411 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
23746
diff
changeset
|
412 |
definition inf :: "rule => rule => bool" where |
13508 | 413 |
"inf R R' == (R=ns1 | (R=ns2 & R'~=ns1) | (R=ns3 & R'=ns3))" |
414 |
||
415 |
lemma inf_is_ord [iff]: "ord ns inf" |
|
416 |
apply (unfold ord_def inf_def) |
|
417 |
apply (rule allI)+ |
|
23746 | 418 |
apply (rule impI) |
419 |
apply (simp add: split_paired_all) |
|
13508 | 420 |
by (rule impI, erule ns.cases, simp_all)+ |
421 |
||
61830 | 422 |
subsection\<open>general properties\<close> |
13508 | 423 |
|
424 |
lemma ns_has_only_Says' [iff]: "has_only_Says' ns" |
|
425 |
apply (unfold has_only_Says'_def) |
|
426 |
apply (rule allI, rule impI) |
|
23746 | 427 |
apply (simp add: split_paired_all) |
13508 | 428 |
by (erule ns.cases, auto) |
429 |
||
430 |
lemma newn_ns1 [iff]: "newn ns1 = {Na}" |
|
431 |
by (simp add: newn_def) |
|
432 |
||
433 |
lemma newn_ns2 [iff]: "newn ns2 = {Nb}" |
|
434 |
by (auto simp: newn_def Na_def Nb_def) |
|
435 |
||
436 |
lemma newn_ns3 [iff]: "newn ns3 = {}" |
|
437 |
by (auto simp: newn_def) |
|
438 |
||
439 |
lemma ns_wdef [iff]: "wdef ns" |
|
440 |
by (auto simp: wdef_def elim: ns.cases) |
|
441 |
||
61830 | 442 |
subsection\<open>guardedness for NSL\<close> |
13508 | 443 |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
444 |
lemma "uniq ns secret \<Longrightarrow> preserv ns keys n Ks" |
76290
64d29ebb7d3d
Mostly, removing the unfold method
paulson <lp15@cam.ac.uk>
parents:
76289
diff
changeset
|
445 |
unfolding preserv_def |
13508 | 446 |
apply (rule allI)+ |
447 |
apply (rule impI, rule impI, rule impI, rule impI, rule impI) |
|
448 |
apply (erule fresh_ruleD, simp, simp, simp, simp) |
|
449 |
apply (rule allI)+ |
|
450 |
apply (rule impI, rule impI, rule impI) |
|
23746 | 451 |
apply (simp add: split_paired_all) |
13508 | 452 |
apply (erule ns.cases) |
453 |
(* fresh with NS1 *) |
|
454 |
apply (rule impI, rule impI, rule impI, rule impI, rule impI, rule impI) |
|
455 |
apply (erule ns.cases) |
|
456 |
(* NS1 *) |
|
457 |
apply clarsimp |
|
458 |
apply (frule newn_neq_used, simp, simp) |
|
459 |
apply (rule No_Nonce, simp) |
|
460 |
(* NS2 *) |
|
461 |
apply clarsimp |
|
462 |
apply (frule newn_neq_used, simp, simp) |
|
463 |
apply (case_tac "nonce sa Na = nonce s Na") |
|
464 |
apply (frule Guard_safe, simp) |
|
465 |
apply (frule Crypt_guard_invKey, simp) |
|
466 |
apply (frule ok_Guard, simp, simp, simp, clarsimp) |
|
81543
fa37ee54644c
clarified printing of consts: rename apart from all bounds, and thus avoid old Term.declare_free_names with its adhoc policy ("as they are printed");
wenzelm
parents:
76290
diff
changeset
|
467 |
apply (frule_tac K="pubK' s Proto.b" in Crypt_guard_invKey, simp) |
13508 | 468 |
apply (frule_tac R=ns1 and R'=ns1 and Ks=Ks and s=sa and s'=s in uniqD, simp+) |
469 |
apply (simp add: secret_def, simp add: secret_def, force, force) |
|
470 |
apply (simp add: secret_def keys_def, blast) |
|
471 |
apply (rule No_Nonce, simp) |
|
472 |
(* NS3 *) |
|
473 |
apply clarsimp |
|
474 |
apply (case_tac "nonce sa Na = nonce s Nb") |
|
475 |
apply (frule Guard_safe, simp) |
|
476 |
apply (frule Crypt_guard_invKey, simp) |
|
477 |
apply (frule_tac x=ns3b in ok_Guard, simp, simp, simp, clarsimp) |
|
81543
fa37ee54644c
clarified printing of consts: rename apart from all bounds, and thus avoid old Term.declare_free_names with its adhoc policy ("as they are printed");
wenzelm
parents:
76290
diff
changeset
|
478 |
apply (frule_tac K="pubK' s Proto.a" in Crypt_guard_invKey, simp) |
13508 | 479 |
apply (frule_tac R=ns1 and R'=ns2 and Ks=Ks and s=sa and s'=s in uniqD, simp+) |
480 |
apply (simp add: secret_def, simp add: secret_def, force, force) |
|
481 |
apply (simp add: secret_def, rule No_Nonce, simp) |
|
482 |
(* fresh with NS2 *) |
|
483 |
apply (rule impI, rule impI, rule impI, rule impI, rule impI, rule impI) |
|
484 |
apply (erule ns.cases) |
|
485 |
(* NS1 *) |
|
486 |
apply clarsimp |
|
487 |
apply (frule newn_neq_used, simp, simp) |
|
488 |
apply (rule No_Nonce, simp) |
|
489 |
(* NS2 *) |
|
490 |
apply clarsimp |
|
491 |
apply (frule newn_neq_used, simp, simp) |
|
492 |
apply (case_tac "nonce sa Nb = nonce s Na") |
|
493 |
apply (frule Guard_safe, simp) |
|
494 |
apply (frule Crypt_guard_invKey, simp) |
|
495 |
apply (frule ok_Guard, simp, simp, simp, clarsimp) |
|
81543
fa37ee54644c
clarified printing of consts: rename apart from all bounds, and thus avoid old Term.declare_free_names with its adhoc policy ("as they are printed");
wenzelm
parents:
76290
diff
changeset
|
496 |
apply (frule_tac K="pubK' s Proto.b" in Crypt_guard_invKey, simp) |
13508 | 497 |
apply (frule_tac R=ns2 and R'=ns1 and Ks=Ks and s=sa and s'=s in uniqD, simp+) |
498 |
apply (simp add: secret_def, simp add: secret_def, force, force) |
|
499 |
apply (simp add: secret_def, rule No_Nonce, simp) |
|
500 |
(* NS3 *) |
|
501 |
apply clarsimp |
|
502 |
apply (case_tac "nonce sa Nb = nonce s Nb") |
|
503 |
apply (frule Guard_safe, simp) |
|
504 |
apply (frule Crypt_guard_invKey, simp) |
|
505 |
apply (frule_tac x=ns3b in ok_Guard, simp, simp, simp, clarsimp) |
|
81543
fa37ee54644c
clarified printing of consts: rename apart from all bounds, and thus avoid old Term.declare_free_names with its adhoc policy ("as they are printed");
wenzelm
parents:
76290
diff
changeset
|
506 |
apply (frule_tac K="pubK' s Proto.a" in Crypt_guard_invKey, simp) |
13508 | 507 |
apply (frule_tac R=ns2 and R'=ns2 and Ks=Ks and s=sa and s'=s in uniqD, simp+) |
508 |
apply (simp add: secret_def, simp add: secret_def, force, force) |
|
509 |
apply (simp add: secret_def keys_def, blast) |
|
510 |
apply (rule No_Nonce, simp) |
|
511 |
(* fresh with NS3 *) |
|
512 |
by simp |
|
513 |
||
61830 | 514 |
subsection\<open>unicity for NSL\<close> |
13508 | 515 |
|
516 |
lemma "uniq' ns inf secret" |
|
517 |
apply (unfold uniq'_def) |
|
518 |
apply (rule allI)+ |
|
23746 | 519 |
apply (simp add: split_paired_all) |
13508 | 520 |
apply (rule impI, erule ns.cases) |
521 |
(* R = ns1 *) |
|
522 |
apply (rule impI, erule ns.cases) |
|
523 |
(* R' = ns1 *) |
|
524 |
apply (rule impI, rule impI, rule impI, rule impI) |
|
525 |
apply (rule impI, rule impI, rule impI, rule impI) |
|
526 |
apply (rule impI, erule tr.induct) |
|
527 |
(* Nil *) |
|
528 |
apply (simp add: secret_def) |
|
529 |
(* Fake *) |
|
530 |
apply (clarify, simp add: secret_def) |
|
531 |
apply (drule notin_analz_insert) |
|
532 |
apply (drule Crypt_insert_synth, simp, simp, simp) |
|
533 |
apply (drule Crypt_insert_synth, simp, simp, simp, simp) |
|
534 |
(* Proto *) |
|
23746 | 535 |
apply (erule_tac P="ok evsa R sa" in rev_mp) |
536 |
apply (simp add: split_paired_all) |
|
13508 | 537 |
apply (erule ns.cases) |
538 |
(* ns1 *) |
|
539 |
apply (clarify, simp add: secret_def) |
|
540 |
apply (erule disjE, erule disjE, clarsimp) |
|
541 |
apply (drule ok_parts_not_new, simp, simp, simp) |
|
542 |
apply (clarify, drule ok_parts_not_new, simp, simp, simp) |
|
543 |
(* ns2 *) |
|
544 |
apply (simp add: secret_def) |
|
545 |
(* ns3 *) |
|
546 |
apply (simp add: secret_def) |
|
547 |
(* R' = ns2 *) |
|
548 |
apply (rule impI, rule impI, rule impI, rule impI) |
|
549 |
apply (rule impI, rule impI, rule impI, rule impI) |
|
550 |
apply (rule impI, erule tr.induct) |
|
551 |
(* Nil *) |
|
552 |
apply (simp add: secret_def) |
|
553 |
(* Fake *) |
|
554 |
apply (clarify, simp add: secret_def) |
|
555 |
apply (drule notin_analz_insert) |
|
556 |
apply (drule Crypt_insert_synth, simp, simp, simp) |
|
557 |
apply (drule_tac n="nonce s' Nb" in Crypt_insert_synth, simp, simp, simp, simp) |
|
558 |
(* Proto *) |
|
23746 | 559 |
apply (erule_tac P="ok evsa R sa" in rev_mp) |
560 |
apply (simp add: split_paired_all) |
|
13508 | 561 |
apply (erule ns.cases) |
562 |
(* ns1 *) |
|
563 |
apply (clarify, simp add: secret_def) |
|
564 |
apply (drule_tac s=sa and n=Na in ok_parts_not_new, simp, simp, simp) |
|
565 |
(* ns2 *) |
|
566 |
apply (clarify, simp add: secret_def) |
|
567 |
apply (drule_tac s=sa and n=Nb in ok_parts_not_new, simp, simp, simp) |
|
568 |
(* ns3 *) |
|
569 |
apply (simp add: secret_def) |
|
570 |
(* R' = ns3 *) |
|
571 |
apply simp |
|
572 |
(* R = ns2 *) |
|
573 |
apply (rule impI, erule ns.cases) |
|
574 |
(* R' = ns1 *) |
|
575 |
apply (simp only: inf_def, blast) |
|
576 |
(* R' = ns2 *) |
|
577 |
apply (rule impI, rule impI, rule impI, rule impI) |
|
578 |
apply (rule impI, rule impI, rule impI, rule impI) |
|
579 |
apply (rule impI, erule tr.induct) |
|
580 |
(* Nil *) |
|
581 |
apply (simp add: secret_def) |
|
582 |
(* Fake *) |
|
583 |
apply (clarify, simp add: secret_def) |
|
584 |
apply (drule notin_analz_insert) |
|
585 |
apply (drule_tac n="nonce s' Nb" in Crypt_insert_synth, simp, simp, simp) |
|
586 |
apply (drule_tac n="nonce s' Nb" in Crypt_insert_synth, simp, simp, simp, simp) |
|
587 |
(* Proto *) |
|
23746 | 588 |
apply (erule_tac P="ok evsa R sa" in rev_mp) |
589 |
apply (simp add: split_paired_all) |
|
13508 | 590 |
apply (erule ns.cases) |
591 |
(* ns1 *) |
|
592 |
apply (simp add: secret_def) |
|
593 |
(* ns2 *) |
|
594 |
apply (clarify, simp add: secret_def) |
|
595 |
apply (erule disjE, erule disjE, clarsimp, clarsimp) |
|
596 |
apply (drule_tac s=sa and n=Nb in ok_parts_not_new, simp, simp, simp) |
|
597 |
apply (erule disjE, clarsimp) |
|
598 |
apply (drule_tac s=sa and n=Nb in ok_parts_not_new, simp, simp, simp) |
|
599 |
by (simp_all add: secret_def) |
|
600 |
||
601 |
end |