src/HOL/Auth/Public.ML
author paulson
Wed, 18 Jun 1997 15:23:29 +0200
changeset 3442 0b804b390b0e
parent 3207 fe79ad367d77
child 3465 e85c24717cad
permissions -rw-r--r--
Removed Says_Crypt_lost and Says_Crypt_not_lost. Installed not_lost_tac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Public
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     2
    ID:         $Id$
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     5
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     6
Theory of Public Keys (common to all symmetric-key protocols)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     7
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     8
Server keys; initial states of agents; new nonces and keys; function "sees" 
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
     9
*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    10
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    11
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    12
open Public;
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    13
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    14
(*Injectiveness of new nonces*)
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    15
AddIffs [inj_newN RS inj_eq];
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    16
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    17
(*Holds because Friend is injective: thus cannot prove for all f*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    18
goal thy "(Friend x : Friend``A) = (x:A)";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    19
by (Auto_tac());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    20
qed "Friend_image_eq";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    21
Addsimps [Friend_image_eq];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    22
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    23
Addsimps [Un_insert_left, Un_insert_right];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    24
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    25
(*By default only o_apply is built-in.  But in the presence of eta-expansion
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    26
  this means that some terms displayed as (f o g) will be rewritten, and others
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    27
  will not!*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    28
Addsimps [o_def];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    29
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    30
goalw thy [keysFor_def] "keysFor (parts (initState lost C)) = {}";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    31
by (agent.induct_tac "C" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    32
by (auto_tac (!claset addIs [range_eqI], !simpset));
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    33
qed "keysFor_parts_initState";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    34
Addsimps [keysFor_parts_initState];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    35
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    36
goalw thy [keysFor_def] "keysFor (Key``E) = {}";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    37
by (Auto_tac ());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    38
qed "keysFor_image_Key";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    39
Addsimps [keysFor_image_Key];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    40
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    41
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    42
(*** Function "sees" ***)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    43
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    44
goal thy
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    45
    "!!evs. lost' <= lost ==> sees lost' A evs <= sees lost A evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    46
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    47
by (agent.induct_tac "A" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    48
by (event.induct_tac "a" 2);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    49
by (Auto_tac ());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    50
qed "sees_mono";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    51
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    52
(*** Basic properties of pubK & priK ***)
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    53
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    54
AddIffs [inj_pubK RS inj_eq];
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    55
Addsimps [priK_neq_pubK, priK_neq_pubK RS not_sym];
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
    56
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    57
(*Agents see their own private keys!*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    58
goal thy "A ~= Spy --> Key (priK A) : sees lost A evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    59
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    60
by (agent.induct_tac "A" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    61
by (Auto_tac ());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    62
qed_spec_mp "sees_own_priK";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    63
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    64
(*All public keys are visible*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    65
goal thy "Key (pubK A) : sees lost A evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    66
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    67
by (agent.induct_tac "A" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    68
by (Auto_tac ());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    69
qed_spec_mp "sees_pubK";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    70
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    71
(*Spy sees private keys of lost agents!*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    72
goal thy "!!A. A: lost ==> Key (priK A) : sees lost Spy evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    73
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    74
by (Auto_tac());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    75
qed "Spy_sees_lost";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    76
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    77
AddIffs [sees_pubK];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    78
AddSIs  [sees_own_priK, Spy_sees_lost];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    79
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    80
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    81
(** Specialized rewrite rules for (sees lost A (Says...#evs)) **)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    82
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    83
goal thy "sees lost B (Says A B X # evs) = insert X (sees lost B evs)";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    84
by (Simp_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    85
qed "sees_own";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    86
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    87
goal thy "!!A. Server ~= B ==> \
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    88
\          sees lost Server (Says A B X # evs) = sees lost Server evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    89
by (Asm_simp_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    90
qed "sees_Server";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    91
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    92
goal thy "!!A. Friend i ~= B ==> \
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    93
\          sees lost (Friend i) (Says A B X # evs) = sees lost (Friend i) evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    94
by (Asm_simp_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    95
qed "sees_Friend";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    96
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    97
goal thy "sees lost Spy (Says A B X # evs) = insert X (sees lost Spy evs)";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    98
by (Simp_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
    99
qed "sees_Spy";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   100
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   101
goal thy "sees lost A (Says A' B X # evs) <= insert X (sees lost A evs)";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   102
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   103
by (Fast_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   104
qed "sees_Says_subset_insert";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   105
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   106
goal thy "sees lost A evs <= sees lost A (Says A' B X # evs)";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   107
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   108
by (Fast_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   109
qed "sees_subset_sees_Says";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   110
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   111
(*Pushing Unions into parts.  One of the agents A is B, and thus sees Y.
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   112
  Once used to prove new_keys_not_seen; now obsolete.*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   113
goal thy "(UN A. parts (sees lost A (Says B C Y # evs))) = \
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   114
\         parts {Y} Un (UN A. parts (sees lost A evs))";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   115
by (Step_tac 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   116
by (etac rev_mp 1);     (*split_tac does not work on assumptions*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   117
by (ALLGOALS
3207
fe79ad367d77 renamed unsafe_addss to addss
oheimb
parents: 3121
diff changeset
   118
    (fast_tac (!claset addss (!simpset addsimps [parts_Un, sees_Cons] 
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   119
				            setloop split_tac [expand_if]))));
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   120
qed "UN_parts_sees_Says";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   121
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   122
goal thy "Says A B X : set_of_list evs --> X : sees lost Spy evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   123
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   124
by (Auto_tac ());
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   125
qed_spec_mp "Says_imp_sees_Spy";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   126
2537
906704a5b3bf Added sees_Spy_partsEs
paulson
parents: 2516
diff changeset
   127
(*Use with addSEs to derive contradictions from old Says events containing
906704a5b3bf Added sees_Spy_partsEs
paulson
parents: 2516
diff changeset
   128
  items known to be fresh*)
906704a5b3bf Added sees_Spy_partsEs
paulson
parents: 2516
diff changeset
   129
val sees_Spy_partsEs = make_elim (Says_imp_sees_Spy RS parts.Inj):: partsEs;
906704a5b3bf Added sees_Spy_partsEs
paulson
parents: 2516
diff changeset
   130
3442
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   131
(*For not_lost_tac*)
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   132
goal thy "!!A. [| Crypt (pubK A) X : analz (sees lost Spy evs);  A: lost |] \
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   133
\              ==> X : analz (sees lost Spy evs)";
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   134
by (blast_tac (!claset addSDs [analz.Decrypt]) 1);
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   135
qed "Crypt_Spy_analz_lost";
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   136
3442
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   137
(*Prove that the agent is uncompromised by the confidentiality of 
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   138
  a component of a message she's said.*)
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   139
fun not_lost_tac s =
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   140
    case_tac ("(" ^ s ^ ") : lost") THEN'
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   141
    SELECT_GOAL 
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   142
      (REPEAT_DETERM (dtac (Says_imp_sees_Spy RS analz.Inj) 1) THEN
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   143
       REPEAT_DETERM (etac MPair_analz 1) THEN
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   144
       THEN_BEST_FIRST 
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   145
         (dres_inst_tac [("A", s)] Crypt_Spy_analz_lost 1 THEN assume_tac 1)
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   146
         (has_fewer_prems 1, size_of_thm)
0b804b390b0e Removed Says_Crypt_lost and Says_Crypt_not_lost.
paulson
parents: 3207
diff changeset
   147
         (Step_tac 1));
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   148
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   149
Addsimps [sees_own, sees_Server, sees_Friend, sees_Spy];
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   150
Delsimps [sees_Cons];   (**** NOTE REMOVAL -- laws above are cleaner ****)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   151
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   152
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   153
(*** Fresh nonces ***)
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   154
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   155
goal thy "Nonce N ~: parts (initState lost B)";
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   156
by (agent.induct_tac "B" 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   157
by (Auto_tac ());
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   158
qed "Nonce_notin_initState";
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   159
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   160
AddIffs [Nonce_notin_initState];
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   161
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   162
goalw thy [used_def] "!!X. X: parts (sees lost B evs) ==> X: used evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   163
by (etac (impOfSubs parts_mono) 1);
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   164
by (Fast_tac 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   165
qed "usedI";
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   166
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   167
AddIs [usedI];
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   168
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   169
(** A supply of fresh nonces for possibility theorems. **)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   170
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   171
goalw thy [used_def] "EX N. ALL n. N<=n --> Nonce n ~: used evs";
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   172
by (list.induct_tac "evs" 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   173
by (res_inst_tac [("x","0")] exI 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   174
by (Step_tac 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   175
by (Full_simp_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   176
(*Inductive step*)
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   177
by (event.induct_tac "a" 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   178
by (full_simp_tac (!simpset addsimps [UN_parts_sees_Says]) 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   179
by (msg.induct_tac "msg" 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   180
by (ALLGOALS (asm_simp_tac (!simpset addsimps [exI, parts_insert2])));
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   181
by (Step_tac 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   182
(*MPair case*)
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   183
by (res_inst_tac [("x","Na+Nb")] exI 2);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   184
by (fast_tac (!claset addSEs [add_leE]) 2);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   185
(*Nonce case*)
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   186
by (res_inst_tac [("x","N + Suc nat")] exI 1);
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2537
diff changeset
   187
by (fast_tac (!claset addSEs [add_leE] addaltern trans_tac) 1);
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   188
val lemma = result();
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   189
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   190
goal thy "Nonce (@ N. Nonce N ~: used evs) ~: used evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   191
by (rtac (lemma RS exE) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   192
by (rtac selectI 1);
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   193
by (Fast_tac 1);
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   194
qed "Nonce_supply";
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   195
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   196
(*Tactic for possibility theorems*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   197
val possibility_tac =
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   198
    REPEAT 
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2537
diff changeset
   199
    (ALLGOALS (simp_tac (!simpset setSolver safe_solver))
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   200
     THEN
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   201
     REPEAT_FIRST (eq_assume_tac ORELSE' 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2497
diff changeset
   202
                   resolve_tac [refl, conjI, Nonce_supply]));
2497
47de509bdd55 New treatment of nonce creation
paulson
parents: 2451
diff changeset
   203
2318
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   204
(** Power of the Spy **)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   205
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   206
(*The Spy can see more than anybody else, except for their initial state*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   207
goal thy "sees lost A evs <= initState lost A Un sees lost Spy evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   208
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   209
by (event.induct_tac "a" 2);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   210
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD] 
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   211
                                addss (!simpset))));
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   212
qed "sees_agent_subset_sees_Spy";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   213
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   214
(*The Spy can see more than anybody else who's lost their key!*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   215
goal thy "A: lost --> A ~= Server --> sees lost A evs <= sees lost Spy evs";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   216
by (list.induct_tac "evs" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   217
by (event.induct_tac "a" 2);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   218
by (agent.induct_tac "A" 1);
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   219
by (auto_tac (!claset addDs [sees_Says_subset_insert RS subsetD], (!simpset)));
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   220
qed_spec_mp "sees_lost_agent_subset_sees_Spy";
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   221
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   222
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   223
(** Simplifying   parts (insert X (sees lost A evs))
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   224
      = parts {X} Un parts (sees lost A evs) -- since general case loops*)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   225
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   226
val parts_insert_sees = 
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   227
    parts_insert |> read_instantiate_sg (sign_of thy)
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   228
                                        [("H", "sees lost A evs")]
6d3f7c7f70b0 Public-key examples
paulson
parents:
diff changeset
   229
                 |> standard;