src/HOL/Auth/Shared.ML
author paulson
Tue, 01 Jul 1997 17:36:42 +0200
changeset 3479 2aacd6f10654
parent 3472 fb3c38c88c08
child 3512 9dcb4daa15e8
permissions -rw-r--r--
Reordered rules in analz_image_freshK_ss to improve clarity
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2320
41289907faed Moved much common material to Message.ML
paulson
parents: 2284
diff changeset
     1
(*  Title:      HOL/Auth/Shared
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     2
    ID:         $Id$
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     5
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     6
Theory of Shared Keys (common to all symmetric-key protocols)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     7
3472
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
     8
Server keys; initial states of agents; freshness; function "sees" 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
     9
*)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    10
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    11
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    12
open Shared;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    13
1964
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    14
(*Holds because Friend is injective: thus cannot prove for all f*)
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    15
goal thy "(Friend x : Friend``A) = (x:A)";
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    16
by (Auto_tac());
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    17
qed "Friend_image_eq";
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    18
Addsimps [Friend_image_eq];
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    19
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    20
Addsimps [Un_insert_left, Un_insert_right];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    21
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    22
(*By default only o_apply is built-in.  But in the presence of eta-expansion
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    23
  this means that some terms displayed as (f o g) will be rewritten, and others
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    24
  will not!*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    25
Addsimps [o_def];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    26
3472
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
    27
(*** Basic properties of shrK ***)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    28
3472
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
    29
(*Injectiveness: Agents' long-term keys are distinct.*)
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
    30
AddIffs [inj_shrK RS inj_eq];
2376
f5c61fd9b9b6 Temporary additions (random) for the nested Otway-Rees protocol
paulson
parents: 2320
diff changeset
    31
3472
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
    32
(* invKey(shrK A) = shrK A *)
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
    33
Addsimps [rewrite_rule [isSymKey_def] isSym_keys];
2320
41289907faed Moved much common material to Message.ML
paulson
parents: 2284
diff changeset
    34
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    35
(** Rewrites should not refer to  initState(Friend i) 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    36
    -- not in normal form! **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    37
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    38
goalw thy [keysFor_def] "keysFor (parts (initState lost C)) = {}";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    39
by (agent.induct_tac "C" 1);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
    40
by (Auto_tac ());
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    41
qed "keysFor_parts_initState";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    42
Addsimps [keysFor_parts_initState];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    43
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    44
goalw thy [keysFor_def] "keysFor (Key``E) = {}";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    45
by (Auto_tac ());
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    46
qed "keysFor_image_Key";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    47
Addsimps [keysFor_image_Key];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    48
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    49
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    50
(*** Function "sees" ***)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    51
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    52
goal thy
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    53
    "!!evs. lost' <= lost ==> sees lost' A evs <= sees lost A evs";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    54
by (list.induct_tac "evs" 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    55
by (agent.induct_tac "A" 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    56
by (event.induct_tac "a" 2);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    57
by (Auto_tac ());
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    58
qed "sees_mono";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    59
1964
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    60
(*Agents see their own shared keys!*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    61
goal thy "A ~= Spy --> Key (shrK A) : sees lost A evs";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    62
by (list.induct_tac "evs" 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    63
by (agent.induct_tac "A" 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    64
by (Auto_tac ());
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    65
qed_spec_mp "sees_own_shrK";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    66
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    67
(*Spy sees shared keys of lost agents!*)
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    68
goal thy "!!A. A: lost ==> Key (shrK A) : sees lost Spy evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    69
by (list.induct_tac "evs" 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    70
by (Auto_tac());
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    71
qed "Spy_sees_lost";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    72
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    73
AddSIs [sees_own_shrK, Spy_sees_lost];
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    74
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    75
(** Specialized rewrite rules for (sees lost A (Says...#evs)) **)
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2012
diff changeset
    76
2078
b198b3d46fb4 New version of axiom sees1_Says:
paulson
parents: 2072
diff changeset
    77
goal thy "sees lost B (Says A B X # evs) = insert X (sees lost B evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    78
by (Simp_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    79
qed "sees_own";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    80
2078
b198b3d46fb4 New version of axiom sees1_Says:
paulson
parents: 2072
diff changeset
    81
goal thy "!!A. Server ~= B ==> \
b198b3d46fb4 New version of axiom sees1_Says:
paulson
parents: 2072
diff changeset
    82
\          sees lost Server (Says A B X # evs) = sees lost Server evs";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    83
by (Asm_simp_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    84
qed "sees_Server";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    85
2078
b198b3d46fb4 New version of axiom sees1_Says:
paulson
parents: 2072
diff changeset
    86
goal thy "!!A. Friend i ~= B ==> \
b198b3d46fb4 New version of axiom sees1_Says:
paulson
parents: 2072
diff changeset
    87
\          sees lost (Friend i) (Says A B X # evs) = sees lost (Friend i) evs";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    88
by (Asm_simp_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    89
qed "sees_Friend";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    90
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    91
goal thy "sees lost Spy (Says A B X # evs) = insert X (sees lost Spy evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    92
by (Simp_tac 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    93
qed "sees_Spy";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    94
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    95
goal thy "sees lost A (Says A' B X # evs) <= insert X (sees lost A evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    96
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
    97
by (Blast_tac 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    98
qed "sees_Says_subset_insert";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    99
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   100
goal thy "sees lost A evs <= sees lost A (Says A' B X # evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   101
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   102
by (Blast_tac 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   103
qed "sees_subset_sees_Says";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   104
2132
aeba09ebd8bc Tidied up a big mess in UN_parts_sees_Says
paulson
parents: 2124
diff changeset
   105
(*Pushing Unions into parts.  One of the agents A is B, and thus sees Y.
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2132
diff changeset
   106
  Once used to prove new_keys_not_seen; now obsolete.*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   107
goal thy "(UN A. parts (sees lost A (Says B C Y # evs))) = \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   108
\         parts {Y} Un (UN A. parts (sees lost A evs))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   109
by (Step_tac 1);
2132
aeba09ebd8bc Tidied up a big mess in UN_parts_sees_Says
paulson
parents: 2124
diff changeset
   110
by (etac rev_mp 1);     (*split_tac does not work on assumptions*)
aeba09ebd8bc Tidied up a big mess in UN_parts_sees_Says
paulson
parents: 2124
diff changeset
   111
by (ALLGOALS
3207
fe79ad367d77 renamed unsafe_addss to addss
oheimb
parents: 3121
diff changeset
   112
    (fast_tac (!claset addss (!simpset addsimps [parts_Un, sees_Cons] 
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   113
				            setloop split_tac [expand_if]))));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   114
qed "UN_parts_sees_Says";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   115
3465
e85c24717cad set_of_list -> set
nipkow
parents: 3451
diff changeset
   116
goal thy "Says A B X : set evs --> X : sees lost Spy evs";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   117
by (list.induct_tac "evs" 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   118
by (Auto_tac ());
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   119
qed_spec_mp "Says_imp_sees_Spy";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   120
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   121
(*Use with addSEs to derive contradictions from old Says events containing
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   122
  items known to be fresh*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   123
val sees_Spy_partsEs = make_elim (Says_imp_sees_Spy RS parts.Inj):: partsEs;
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   124
3443
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   125
(*For not_lost_tac*)
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   126
goal thy "!!A. [| Crypt (shrK A) X : analz (sees lost Spy evs);  A: lost |] \
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   127
\              ==> X : analz (sees lost Spy evs)";
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   128
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1);
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   129
qed "Crypt_Spy_analz_lost";
2072
6ac12b9478d5 Put in the theorem Says_Crypt_not_lost
paulson
parents: 2064
diff changeset
   130
3443
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   131
(*Prove that the agent is uncompromised by the confidentiality of 
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   132
  a component of a message she's said.*)
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   133
fun not_lost_tac s =
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   134
    case_tac ("(" ^ s ^ ") : lost") THEN'
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   135
    SELECT_GOAL 
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   136
      (REPEAT_DETERM (dtac (Says_imp_sees_Spy RS analz.Inj) 1) THEN
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   137
       REPEAT_DETERM (etac MPair_analz 1) THEN
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   138
       THEN_BEST_FIRST 
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   139
         (dres_inst_tac [("A", s)] Crypt_Spy_analz_lost 1 THEN assume_tac 1)
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   140
         (has_fewer_prems 1, size_of_thm)
387ca417e7f5 Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3414
diff changeset
   141
         (Step_tac 1));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   142
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2132
diff changeset
   143
Addsimps [sees_own, sees_Server, sees_Friend, sees_Spy];
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   144
Delsimps [sees_Cons];   (**** NOTE REMOVAL -- laws above are cleaner ****)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   145
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   146
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   147
(*** Fresh nonces ***)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   148
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   149
goal thy "Nonce N ~: parts (initState lost B)";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   150
by (agent.induct_tac "B" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   151
by (Auto_tac ());
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   152
qed "Nonce_notin_initState";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   153
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   154
AddIffs [Nonce_notin_initState];
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   155
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   156
goalw thy [used_def] "!!X. X: parts (sees lost B evs) ==> X: used evs";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   157
by (etac (impOfSubs parts_mono) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   158
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   159
qed "usedI";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   160
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   161
AddIs [usedI];
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   162
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   163
(** Fresh keys never clash with long-term shared keys **)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   164
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   165
goal thy "Key (shrK A) : used evs";
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   166
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   167
qed "shrK_in_used";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   168
AddIffs [shrK_in_used];
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   169
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   170
(*Used in parts_induct_tac and analz_Fake_tac to distinguish session keys
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   171
  from long-term shared keys*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   172
goal thy "!!K. Key K ~: used evs ==> K ~: range shrK";
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   173
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   174
qed "Key_not_used";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   175
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   176
(*A session key cannot clash with a long-term shared key*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   177
goal thy "!!K. K ~: range shrK ==> shrK B ~= K";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   178
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   179
qed "shrK_neq";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   180
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   181
Addsimps [Key_not_used, shrK_neq, shrK_neq RS not_sym];
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   182
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   183
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   184
goal thy "used (Says A B X # evs) = parts{X} Un used evs";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   185
by (simp_tac (!simpset addsimps [used_def, UN_parts_sees_Says]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   186
qed "used_Says";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   187
Addsimps [used_Says];
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   188
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   189
goal thy "used [] <= used l";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   190
by (list.induct_tac "l" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   191
by (event.induct_tac "a" 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   192
by (ALLGOALS Asm_simp_tac);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   193
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   194
qed "used_nil_subset";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   195
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   196
goal thy "used l <= used (l@l')";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   197
by (list.induct_tac "l" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   198
by (simp_tac (!simpset addsimps [used_nil_subset]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   199
by (event.induct_tac "a" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   200
by (Asm_simp_tac 1);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   201
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   202
qed "used_subset_append";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   203
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   204
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   205
(*** Supply fresh nonces for possibility theorems. ***)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   206
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   207
goalw thy [used_def] "EX N. ALL n. N<=n --> Nonce n ~: used evs";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   208
by (list.induct_tac "evs" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   209
by (res_inst_tac [("x","0")] exI 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   210
by (Step_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   211
by (Full_simp_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   212
(*Inductive step*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   213
by (event.induct_tac "a" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   214
by (full_simp_tac (!simpset addsimps [UN_parts_sees_Says]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   215
by (msg.induct_tac "msg" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   216
by (ALLGOALS (asm_simp_tac (!simpset addsimps [exI, parts_insert2])));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   217
by (Step_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   218
(*MPair case*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   219
by (res_inst_tac [("x","Na+Nb")] exI 2);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   220
by (blast_tac (!claset addSEs [add_leE]) 2);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   221
(*Nonce case*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   222
by (res_inst_tac [("x","N + Suc nat")] exI 1);
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2516
diff changeset
   223
by (fast_tac (!claset addSEs [add_leE] addaltern trans_tac) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   224
val lemma = result();
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   225
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   226
goal thy "EX N. Nonce N ~: used evs";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   227
by (rtac (lemma RS exE) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   228
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   229
qed "Nonce_supply1";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   230
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   231
goal thy "EX N N'. Nonce N ~: used evs & Nonce N' ~: used evs' & N ~= N'";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   232
by (cut_inst_tac [("evs","evs")] lemma 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   233
by (cut_inst_tac [("evs","evs'")] lemma 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   234
by (Step_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   235
by (res_inst_tac [("x","N")] exI 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   236
by (res_inst_tac [("x","Suc (N+Na)")] exI 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   237
by (asm_simp_tac (!simpset addsimps [less_not_refl2 RS not_sym, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   238
				     le_add2, le_add1, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   239
				     le_eq_less_Suc RS sym]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   240
qed "Nonce_supply2";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   241
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   242
goal thy "EX N N' N''. Nonce N ~: used evs & Nonce N' ~: used evs' & \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   243
\                   Nonce N'' ~: used evs'' & N ~= N' & N' ~= N'' & N ~= N''";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   244
by (cut_inst_tac [("evs","evs")] lemma 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   245
by (cut_inst_tac [("evs","evs'")] lemma 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   246
by (cut_inst_tac [("evs","evs''")] lemma 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   247
by (Step_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   248
by (res_inst_tac [("x","N")] exI 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   249
by (res_inst_tac [("x","Suc (N+Na)")] exI 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   250
by (res_inst_tac [("x","Suc (Suc (N+Na+Nb))")] exI 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   251
by (asm_simp_tac (!simpset addsimps [less_not_refl2 RS not_sym, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   252
				     le_add2, le_add1, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   253
				     le_eq_less_Suc RS sym]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   254
by (rtac (less_trans RS less_not_refl2 RS not_sym) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   255
by (stac (le_eq_less_Suc RS sym) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   256
by (asm_simp_tac (!simpset addsimps [le_eq_less_Suc RS sym]) 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   257
by (REPEAT (rtac le_add1 1));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   258
qed "Nonce_supply3";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   259
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   260
goal thy "Nonce (@ N. Nonce N ~: used evs) ~: used evs";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   261
by (rtac (lemma RS exE) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   262
by (rtac selectI 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   263
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   264
qed "Nonce_supply";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   265
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   266
(*** Supply fresh keys for possibility theorems. ***)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   267
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   268
goal thy "EX K. Key K ~: used evs";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   269
by (rtac (Finites.emptyI RS Key_supply_ax RS exE) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   270
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   271
qed "Key_supply1";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   272
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   273
goal thy "EX K K'. Key K ~: used evs & Key K' ~: used evs' & K ~= K'";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   274
by (cut_inst_tac [("evs","evs")] (Finites.emptyI RS Key_supply_ax) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   275
by (etac exE 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   276
by (cut_inst_tac [("evs","evs'")] 
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   277
    (Finites.emptyI RS Finites.insertI RS Key_supply_ax) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   278
by (Auto_tac());
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   279
qed "Key_supply2";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   280
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   281
goal thy "EX K K' K''. Key K ~: used evs & Key K' ~: used evs' & \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   282
\                      Key K'' ~: used evs'' & K ~= K' & K' ~= K'' & K ~= K''";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   283
by (cut_inst_tac [("evs","evs")] (Finites.emptyI RS Key_supply_ax) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   284
by (etac exE 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   285
by (cut_inst_tac [("evs","evs'")] 
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   286
    (Finites.emptyI RS Finites.insertI RS Key_supply_ax) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   287
by (etac exE 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   288
by (cut_inst_tac [("evs","evs''")] 
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   289
    (Finites.emptyI RS Finites.insertI RS Finites.insertI RS Key_supply_ax) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   290
by (Step_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   291
by (Full_simp_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   292
by (fast_tac (!claset addSEs [allE]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   293
qed "Key_supply3";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   294
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   295
goal thy "Key (@ K. Key K ~: used evs) ~: used evs";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3207
diff changeset
   296
by (rtac (Finites.emptyI RS Key_supply_ax RS exE) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   297
by (rtac selectI 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   298
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   299
qed "Key_supply";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   300
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   301
(*** Tactics for possibility theorems ***)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   302
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   303
val possibility_tac =
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   304
    REPEAT (*omit used_Says so that Nonces, Keys start from different traces!*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   305
    (ALLGOALS (simp_tac 
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2516
diff changeset
   306
               (!simpset delsimps [used_Says] setSolver safe_solver))
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   307
     THEN
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   308
     REPEAT_FIRST (eq_assume_tac ORELSE' 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   309
                   resolve_tac [refl, conjI, Nonce_supply, Key_supply]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   310
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   311
(*For harder protocols (such as Recur) where we have to set up some
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   312
  nonces and keys initially*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   313
val basic_possibility_tac =
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   314
    REPEAT 
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2516
diff changeset
   315
    (ALLGOALS (asm_simp_tac (!simpset setSolver safe_solver))
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   316
     THEN
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   317
     REPEAT_FIRST (resolve_tac [refl, conjI]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   318
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   319
2049
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   320
(** Power of the Spy **)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   321
2049
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   322
(*The Spy can see more than anybody else, except for their initial state*)
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   323
goal thy "sees lost A evs <= initState lost A Un sees lost Spy evs";
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   324
by (list.induct_tac "evs" 1);
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   325
by (event.induct_tac "a" 2);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   326
by (ALLGOALS Asm_simp_tac);
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   327
by (ALLGOALS (blast_tac (!claset addDs [sees_Says_subset_insert RS subsetD])));
2049
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   328
qed "sees_agent_subset_sees_Spy";
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   329
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   330
(*The Spy can see more than anybody else who's lost their key!*)
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   331
goal thy "A: lost --> A ~= Server --> sees lost A evs <= sees lost Spy evs";
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   332
by (list.induct_tac "evs" 1);
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   333
by (event.induct_tac "a" 2);
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   334
by (agent.induct_tac "A" 1);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   335
by (ALLGOALS Asm_simp_tac);
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2922
diff changeset
   336
by (ALLGOALS (blast_tac (!claset addDs [sees_Says_subset_insert RS subsetD])));
2049
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   337
qed_spec_mp "sees_lost_agent_subset_sees_Spy";
d3b93e1765bc Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents: 2045
diff changeset
   338
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   339
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   340
(** Simplifying   parts (insert X (sees lost A evs))
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   341
      = parts {X} Un parts (sees lost A evs) -- since general case loops*)
2012
1b234f1fd9c7 Removal of the Notes constructor
paulson
parents: 2000
diff changeset
   342
1b234f1fd9c7 Removal of the Notes constructor
paulson
parents: 2000
diff changeset
   343
val parts_insert_sees = 
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   344
    parts_insert |> read_instantiate_sg (sign_of thy)
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   345
                                        [("H", "sees lost A evs")]
2012
1b234f1fd9c7 Removal of the Notes constructor
paulson
parents: 2000
diff changeset
   346
                 |> standard;
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   347
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   348
3472
fb3c38c88c08 Deleted the obsolete operators newK, newN and nPair
paulson
parents: 3465
diff changeset
   349
(*** Specialized rewriting for analz_insert_freshK ***)
2320
41289907faed Moved much common material to Message.ML
paulson
parents: 2284
diff changeset
   350
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   351
goal thy "!!A. A <= Compl (range shrK) ==> shrK x ~: A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   352
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   353
qed "subset_Compl_range";
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   354
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   355
goal thy "insert (Key K) H = Key `` {K} Un H";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   356
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   357
qed "insert_Key_singleton";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   358
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   359
goal thy "insert (Key K) (Key``KK Un C) = Key `` (insert K KK) Un C";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   360
by (Blast_tac 1);
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2637
diff changeset
   361
qed "insert_Key_image";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   362
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3443
diff changeset
   363
(*Reverse the normal simplification of "image" to build up (not break down)
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3443
diff changeset
   364
  the set of keys.  Use analz_insert_eq with (Un_upper2 RS analz_mono) to
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3443
diff changeset
   365
  erase occurrences of forwarded message components (X).*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   366
val analz_image_freshK_ss = 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   367
     !simpset delsimps [image_insert, image_Un]
3479
2aacd6f10654 Reordered rules in analz_image_freshK_ss to improve clarity
paulson
parents: 3472
diff changeset
   368
              addsimps ([image_insert RS sym, image_Un RS sym,
2aacd6f10654 Reordered rules in analz_image_freshK_ss to improve clarity
paulson
parents: 3472
diff changeset
   369
                         analz_insert_eq, impOfSubs (Un_upper2 RS analz_mono),
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   370
                         insert_Key_singleton, subset_Compl_range,
3479
2aacd6f10654 Reordered rules in analz_image_freshK_ss to improve clarity
paulson
parents: 3472
diff changeset
   371
                         Key_not_used, insert_Key_image, Un_assoc RS sym]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   372
                        @disj_comms)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   373
              setloop split_tac [expand_if];
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   374
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   375
(*Lemma for the trivial direction of the if-and-only-if*)
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   376
goal thy  
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   377
 "!!evs. (Key K : analz (Key``nE Un H)) --> (K : nE | Key K : analz H)  ==> \
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   378
\        (Key K : analz (Key``nE Un H)) = (K : nE | Key K : analz H)";
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   379
by (blast_tac (!claset addIs [impOfSubs analz_mono]) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   380
qed "analz_image_freshK_lemma";