author | paulson |
Thu, 18 Sep 1997 13:24:04 +0200 | |
changeset 3683 | aafe719dff14 |
parent 3678 | 414e04d7c2d6 |
child 3701 | 6f0ed3eef1a9 |
permissions | -rw-r--r-- |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
1 |
(* Title: HOL/Auth/Event |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
4 |
Copyright 1996 University of Cambridge |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
5 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
6 |
Theory of events for security protocols |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
7 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
8 |
Datatype of events; function "sees"; freshness |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
9 |
*) |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
10 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
11 |
open Event; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
12 |
|
3683 | 13 |
AddIffs [Spy_in_bad, Server_not_bad]; |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
14 |
|
3683 | 15 |
(**** Function "spies" ****) |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
16 |
|
3683 | 17 |
(** Simplifying parts (insert X (spies evs)) |
18 |
= parts {X} Un parts (spies evs) -- since general case loops*) |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
19 |
|
3683 | 20 |
bind_thm ("parts_insert_spies", |
21 |
parts_insert |> |
|
22 |
read_instantiate_sg (sign_of thy) [("H", "spies evs")]); |
|
3678 | 23 |
|
24 |
||
3683 | 25 |
goal thy |
26 |
"P(event_case sf nf ev) = \ |
|
27 |
\ ((ALL A B X. ev = Says A B X --> P(sf A B X)) & \ |
|
28 |
\ (ALL A X. ev = Notes A X --> P(nf A X)))"; |
|
29 |
by (induct_tac "ev" 1); |
|
30 |
by (Auto_tac()); |
|
31 |
qed "expand_event_case"; |
|
3678 | 32 |
|
3683 | 33 |
goal thy "spies (Says A B X # evs) = insert X (spies evs)"; |
34 |
by (Simp_tac 1); |
|
35 |
qed "spies_Says"; |
|
3678 | 36 |
|
3683 | 37 |
(*The point of letting the Spy see "bad" agents' notes is to prevent |
38 |
redundant case-splits on whether A=Spy and whether A:bad*) |
|
39 |
goal thy "spies (Notes A X # evs) = \ |
|
40 |
\ (if A:bad then insert X (spies evs) else spies evs)"; |
|
41 |
by (Simp_tac 1); |
|
42 |
qed "spies_Notes"; |
|
3678 | 43 |
|
3683 | 44 |
goal thy "spies evs <= spies (Says A B X # evs)"; |
45 |
by (simp_tac (!simpset addsimps [subset_insertI]) 1); |
|
46 |
qed "spies_subset_spies_Says"; |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
47 |
|
3683 | 48 |
goal thy "spies evs <= spies (Notes A X # evs)"; |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
49 |
by (simp_tac (!simpset setloop split_tac [expand_if]) 1); |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
50 |
by (Fast_tac 1); |
3683 | 51 |
qed "spies_subset_spies_Notes"; |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
52 |
|
3678 | 53 |
(*Spy sees all traffic*) |
3683 | 54 |
goal thy "Says A B X : set evs --> X : spies evs"; |
3667 | 55 |
by (induct_tac "evs" 1); |
3683 | 56 |
by (ALLGOALS (asm_simp_tac |
57 |
(!simpset setloop split_tac [expand_event_case, expand_if]))); |
|
58 |
qed_spec_mp "Says_imp_spies"; |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
59 |
|
3683 | 60 |
(*Spy sees Notes of bad agents*) |
61 |
goal thy "Notes A X : set evs --> A: bad --> X : spies evs"; |
|
3678 | 62 |
by (induct_tac "evs" 1); |
3683 | 63 |
by (ALLGOALS (asm_simp_tac |
64 |
(!simpset setloop split_tac [expand_event_case, expand_if]))); |
|
65 |
qed_spec_mp "Notes_imp_spies"; |
|
3678 | 66 |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
67 |
(*Use with addSEs to derive contradictions from old Says events containing |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
68 |
items known to be fresh*) |
3683 | 69 |
val spies_partsEs = make_elim (Says_imp_spies RS parts.Inj) :: partsEs; |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
70 |
|
3683 | 71 |
Addsimps [spies_Says, spies_Notes]; |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
72 |
|
3683 | 73 |
(**** NOTE REMOVAL--laws above are cleaner, as they don't involve "case" ****) |
74 |
Delsimps [spies_Cons]; |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
75 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
76 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
77 |
(*** Fresh nonces ***) |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
78 |
|
3683 | 79 |
goal thy "parts (spies evs) <= used evs"; |
80 |
by (induct_tac "evs" 1); |
|
81 |
by (ALLGOALS (asm_simp_tac |
|
82 |
(!simpset addsimps [parts_insert_spies] |
|
83 |
setloop split_tac [expand_event_case, expand_if]))); |
|
84 |
by (ALLGOALS Blast_tac); |
|
85 |
bind_thm ("usedI", impOfSubs (result())); |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
86 |
AddIs [usedI]; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
87 |
|
3683 | 88 |
goal thy "parts (initState B) <= used evs"; |
89 |
by (induct_tac "evs" 1); |
|
90 |
by (ALLGOALS (asm_simp_tac |
|
91 |
(!simpset addsimps [parts_insert_spies] |
|
92 |
setloop split_tac [expand_event_case, expand_if]))); |
|
93 |
by (ALLGOALS Blast_tac); |
|
94 |
bind_thm ("initState_into_used", impOfSubs (result())); |
|
95 |
||
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
96 |
goal thy "used (Says A B X # evs) = parts{X} Un used evs"; |
3683 | 97 |
by (Simp_tac 1); |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
98 |
qed "used_Says"; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
99 |
Addsimps [used_Says]; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
100 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
101 |
goal thy "used (Notes A X # evs) = parts{X} Un used evs"; |
3683 | 102 |
by (Simp_tac 1); |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
103 |
qed "used_Notes"; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
104 |
Addsimps [used_Notes]; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
105 |
|
3683 | 106 |
goal thy "used [] <= used evs"; |
107 |
by (Simp_tac 1); |
|
108 |
by (blast_tac (!claset addIs [initState_into_used]) 1); |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
109 |
qed "used_nil_subset"; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
110 |
|
3683 | 111 |
(**** NOTE REMOVAL--laws above are cleaner, as they don't involve "case" ****) |
112 |
Delsimps [used_Nil, used_Cons]; |
|
113 |
||
114 |
||
115 |
(*currently unused*) |
|
116 |
goal thy "used evs <= used (evs@evs')"; |
|
117 |
by (induct_tac "evs" 1); |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
118 |
by (simp_tac (!simpset addsimps [used_nil_subset]) 1); |
3667 | 119 |
by (induct_tac "a" 1); |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
120 |
by (ALLGOALS Asm_simp_tac); |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
121 |
by (ALLGOALS Blast_tac); |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
122 |
qed "used_subset_append"; |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
123 |
|
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
124 |
|
3683 | 125 |
(*For proving theorems of the form X ~: analz (spies evs) --> P |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
126 |
New events added by induction to "evs" are discarded. Provided |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
127 |
this information isn't needed, the proof will be much shorter, since |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
128 |
it will omit complicated reasoning about analz.*) |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
129 |
val analz_mono_contra_tac = |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
130 |
let val impI' = read_instantiate_sg (sign_of thy) |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3512
diff
changeset
|
131 |
[("P", "?Y ~: analz (sees ?A ?evs)")] impI; |
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
132 |
in |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
133 |
rtac impI THEN' |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
134 |
REPEAT1 o |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
135 |
(dresolve_tac |
3683 | 136 |
[spies_subset_spies_Says RS analz_mono RS contra_subsetD, |
137 |
spies_subset_spies_Notes RS analz_mono RS contra_subsetD]) |
|
3512
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
138 |
THEN' |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
139 |
mp_tac |
9dcb4daa15e8
Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff
changeset
|
140 |
end; |