src/HOL/Auth/OtwayRees.ML
author nipkow
Mon, 28 Oct 1996 15:36:18 +0100
changeset 2134 04a71407089d
parent 2104 f5c9a91e4b50
child 2135 80477862ab33
permissions -rw-r--r--
Renamed and shuffled a few thms.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/OtwayRees
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     2
    ID:         $Id$
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     5
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     6
Inductive relation "otway" for the Otway-Rees protocol.
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     7
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
     8
Version that encrypts Nonce NB
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
     9
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    10
From page 244 of
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    11
  Burrows, Abadi and Needham.  A Logic of Authentication.
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    12
  Proc. Royal Soc. 426 (1989)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    13
*)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    14
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    15
open OtwayRees;
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    16
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    17
proof_timing:=true;
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    18
HOL_quantifiers := false;
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    19
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    20
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
    21
(*Weak liveness: there are traces that reach the end*)
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    22
goal thy 
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    23
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    24
\        ==> EX K. EX NA. EX evs: otway lost.          \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
    25
\               Says B A {|Nonce NA, Crypt {|Nonce NA, Key K|} (shrK A)|} \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
    26
\                 : set_of_list evs";
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    27
by (REPEAT (resolve_tac [exI,bexI] 1));
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    28
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    29
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    30
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
    31
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
    32
result();
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    33
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    34
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    35
(**** Inductive proofs about otway ****)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    36
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
    37
(*Monotonicity*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    38
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    39
by (rtac subsetI 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    40
by (etac otway.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    41
by (REPEAT_FIRST
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    42
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    43
                              :: otway.intrs))));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    44
qed "otway_mono";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    45
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    46
(*Nobody sends themselves messages*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    47
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    48
by (etac otway.induct 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    49
by (Auto_tac());
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    50
qed_spec_mp "not_Says_to_self";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    51
Addsimps [not_Says_to_self];
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    52
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    53
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    54
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    55
(** For reasoning about the encrypted portion of messages **)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    56
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    57
goal thy "!!evs. Says A' B {|N, Agent A, Agent B, X|} : set_of_list evs ==> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    58
\                X : analz (sees lost Spy evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    59
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    60
qed "OR2_analz_sees_Spy";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    61
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    62
goal thy "!!evs. Says S B {|N, X, X'|} : set_of_list evs ==> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    63
\                X : analz (sees lost Spy evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    64
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    65
qed "OR4_analz_sees_Spy";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    66
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
    67
goal thy "!!evs. Says B' A {|N, Crypt {|N,K|} K'|} : set_of_list evs ==> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    68
\                K : parts (sees lost Spy evs)";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    69
by (fast_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    70
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    71
qed "Reveal_parts_sees_Spy";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    72
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    73
(*OR2_analz... and OR4_analz... let us treat those cases using the same 
1964
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1945
diff changeset
    74
  argument as for the Fake case.  This is possible for most, but not all,
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1945
diff changeset
    75
  proofs: Fake does not invent new nonces (as in OR2), and of course Fake
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    76
  messages originate from the Spy. *)
1964
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1945
diff changeset
    77
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    78
bind_thm ("OR2_parts_sees_Spy",
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    79
          OR2_analz_sees_Spy RS (impOfSubs analz_subset_parts));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    80
bind_thm ("OR4_parts_sees_Spy",
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    81
          OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    82
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    83
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    84
  harder to complete, since simplification does less for us.*)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
    85
val parts_Fake_tac = 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    86
    let val tac = forw_inst_tac [("lost","lost")] 
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    87
    in  tac OR2_parts_sees_Spy 4 THEN 
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    88
        tac OR4_parts_sees_Spy 6 THEN
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    89
        tac Reveal_parts_sees_Spy 7
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    90
    end;
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    91
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    92
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    93
fun parts_induct_tac i = SELECT_GOAL
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    94
    (DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    95
	     (*Fake message*)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    96
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    97
					   impOfSubs Fake_parts_insert]
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    98
                                    addss (!simpset)) 2)) THEN
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
    99
     (*Base case*)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   100
     fast_tac (!claset addss (!simpset)) 1 THEN
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   101
     ALLGOALS Asm_simp_tac) i;
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   102
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   103
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   104
    sends messages containing X! **)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   105
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   106
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   107
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   108
 "!!evs. [| evs : otway lost;  A ~: lost |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   109
\        ==> Key (shrK A) ~: parts (sees lost Spy evs)";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   110
by (parts_induct_tac 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   111
by (Auto_tac());
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   112
qed "Spy_not_see_shrK";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   113
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   114
bind_thm ("Spy_not_analz_shrK",
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   115
          [analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   116
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   117
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK];
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   118
1964
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1945
diff changeset
   119
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1945
diff changeset
   120
  As usual fast_tac cannot be used because it uses the equalities too soon*)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   121
val major::prems = 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   122
goal thy  "[| Key (shrK A) : parts (sees lost Spy evs);       \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   123
\             evs : otway lost;                                 \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   124
\             A:lost ==> R                                  \
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   125
\           |] ==> R";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   126
by (rtac ccontr 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   127
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   128
by (swap_res_tac prems 2);
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1964
diff changeset
   129
by (ALLGOALS (fast_tac (!claset addIs prems)));
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   130
qed "Spy_see_shrK_E";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   131
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   132
bind_thm ("Spy_analz_shrK_E", 
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   133
          analz_subset_parts RS subsetD RS Spy_see_shrK_E);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   134
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   135
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E];
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   136
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   137
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   138
(*** Future keys can't be seen or used! ***)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   139
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   140
(*Nobody can have SEEN keys that will be generated in the future.
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   141
  This has to be proved anew for each protocol description,
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   142
  but should go by similar reasoning every time.  Hardest case is the
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   143
  standard Fake rule.  
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   144
      The Union over C is essential for the induction! *)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   145
goal thy "!!evs. evs : otway lost ==> \
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   146
\                length evs <= length evs' --> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   147
\                          Key (newK evs') ~: (UN C. parts (sees lost C evs))";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   148
by (parts_induct_tac 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   149
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   150
                                           impOfSubs parts_insert_subset_Un,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   151
                                           Suc_leD]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   152
                                    addss (!simpset))));
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   153
val lemma = result();
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   154
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   155
(*Variant needed for the main theorem below*)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   156
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   157
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   158
\        ==> Key (newK evs') ~: parts (sees lost C evs)";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   159
by (fast_tac (!claset addDs [lemma]) 1);
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   160
qed "new_keys_not_seen";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   161
Addsimps [new_keys_not_seen];
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   162
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   163
(*Another variant: old messages must contain old keys!*)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   164
goal thy 
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   165
 "!!evs. [| Says A B X : set_of_list evs;  \
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   166
\           Key (newK evt) : parts {X};    \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   167
\           evs : otway lost                 \
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   168
\        |] ==> length evt < length evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   169
by (rtac ccontr 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   170
by (dtac leI 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   171
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   172
                      addIs  [impOfSubs parts_mono]) 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   173
qed "Says_imp_old_keys";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   174
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   175
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   176
(*** Future nonces can't be seen or used! [proofs resemble those above] ***)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   177
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   178
goal thy "!!evs. evs : otway lost ==> \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   179
\                length evs <= length evt --> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   180
\                Nonce (newN evt) ~: (UN C. parts (sees lost C evs))";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   181
by (etac otway.induct 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   182
(*auto_tac does not work here, as it performs safe_tac first*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   183
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2]
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   184
                                     addcongs [disj_cong])));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   185
by (REPEAT_FIRST (fast_tac (!claset 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   186
                              addSEs partsEs
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   187
                              addSDs  [Says_imp_sees_Spy RS parts.Inj]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   188
                              addDs  [impOfSubs analz_subset_parts,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   189
                                      impOfSubs parts_insert_subset_Un,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   190
                                      Suc_leD]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   191
                              addss (!simpset))));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   192
val lemma = result();
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   193
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   194
(*Variant needed for the main theorem below*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   195
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   196
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   197
\        ==> Nonce (newN evs') ~: parts (sees lost C evs)";
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   198
by (fast_tac (!claset addDs [lemma]) 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   199
qed "new_nonces_not_seen";
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   200
Addsimps [new_nonces_not_seen];
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   201
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   202
(*Another variant: old messages must contain old nonces!*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   203
goal thy 
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   204
 "!!evs. [| Says A B X : set_of_list evs;  \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   205
\           Nonce (newN evt) : parts {X};    \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   206
\           evs : otway lost                 \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   207
\        |] ==> length evt < length evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   208
by (rtac ccontr 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   209
by (dtac leI 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   210
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   211
                      addIs  [impOfSubs parts_mono]) 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   212
qed "Says_imp_old_nonces";
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   213
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   214
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   215
(*Nobody can have USED keys that will be generated in the future.
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   216
  ...very like new_keys_not_seen*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   217
goal thy "!!evs. evs : otway lost ==> \
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   218
\                length evs <= length evs' --> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   219
\                newK evs' ~: keysFor (UN C. parts (sees lost C evs))";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   220
by (parts_induct_tac 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   221
(*OR1 and OR3*)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   222
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   223
(*Fake, OR2, OR4: these messages send unknown (X) components*)
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   224
by (REPEAT
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   225
    (best_tac
1996
33c42cae3dd0 Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents: 1967
diff changeset
   226
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   227
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   228
                      Suc_leD]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   229
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   230
               addss (!simpset)) 1));
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   231
val lemma = result();
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   232
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   233
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   234
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   235
\        ==> newK evs' ~: keysFor (parts (sees lost C evs))";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   236
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   237
qed "new_keys_not_used";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   238
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   239
bind_thm ("new_keys_not_analzd",
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   240
          [analz_subset_parts RS keysFor_mono,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   241
           new_keys_not_used] MRS contra_subsetD);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   242
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   243
Addsimps [new_keys_not_used, new_keys_not_analzd];
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   244
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   245
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   246
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   247
(*** Proofs involving analz ***)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   248
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   249
(*Describes the form of Key K when the following message is sent.  The use of
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   250
  "parts" strengthens the induction hyp for proving the Fake case.  The
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   251
  assumption A ~: lost prevents its being a Faked message.  (Based
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   252
  on NS_Shared/Says_S_message_form) *)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   253
goal thy
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   254
 "!!evs. evs: otway lost ==>                                           \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   255
\          Crypt {|N, Key K|} (shrK A) : parts (sees lost Spy evs) &   \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   256
\          A ~: lost -->                                               \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   257
\        (EX evt: otway lost. K = newK evt)";
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   258
by (parts_induct_tac 1);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   259
by (Auto_tac());
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   260
qed_spec_mp "Reveal_message_lemma";
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   261
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   262
(*EITHER describes the form of Key K when the following message is sent, 
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   263
  OR     reduces it to the Fake case.*)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   264
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   265
goal thy 
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   266
 "!!evs. [| Says B' A {|N, Crypt {|N, Key K|} (shrK A)|} : set_of_list evs;  \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   267
\           evs : otway lost |]                      \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   268
\        ==> (EX evt: otway lost. K = newK evt)          \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   269
\          | Key K : analz (sees lost Spy evs)";
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   270
br (Reveal_message_lemma RS disjCI) 1;
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   271
ba 1;
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   272
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   273
                      addDs [impOfSubs analz_subset_parts]
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   274
                      addss (!simpset)) 1);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   275
qed "Reveal_message_form";
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   276
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   277
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   278
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   279
val analz_Fake_tac = 
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   280
    dres_inst_tac [("lost","lost")] OR2_analz_sees_Spy 4 THEN 
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   281
    dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   282
    forw_inst_tac [("lost","lost")] Reveal_message_form 7;
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   283
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   284
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   285
(****
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   286
 The following is to prove theorems of the form
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   287
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   288
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   289
          Key K : analz (sees lost Spy evs)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   290
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   291
 A more general formula must be proved inductively.
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   292
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   293
****)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   294
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   295
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   296
(** Session keys are not used to encrypt other session keys **)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   297
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   298
(*The equality makes the induction hypothesis easier to apply*)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   299
goal thy  
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   300
 "!!evs. evs : otway lost ==> \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   301
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   302
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   303
by (etac otway.induct 1);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   304
by analz_Fake_tac;
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   305
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   306
by (REPEAT ((eresolve_tac [bexE, disjE] ORELSE' hyp_subst_tac) 7));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   307
by (ALLGOALS (*Takes 28 secs*)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   308
    (asm_simp_tac 
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   309
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   310
                         @ pushes)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   311
               setloop split_tac [expand_if])));
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   312
(** LEVEL 5 **)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   313
(*Reveal case 2, OR4, OR2, Fake*) 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   314
by (EVERY (map spy_analz_tac [7,5,3,2]));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   315
(*Reveal case 1, OR3, Base*)
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   316
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   317
qed_spec_mp "analz_image_newK";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   318
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   319
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   320
goal thy
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   321
 "!!evs. evs : otway lost ==>                               \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   322
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   323
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   324
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   325
                                   insert_Key_singleton]) 1);
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   326
by (Fast_tac 1);
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   327
qed "analz_insert_Key_newK";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   328
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   329
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   330
(*** The Key K uniquely identifies the Server's  message. **)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   331
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   332
fun ex_strip_tac i = REPEAT (ares_tac [exI, conjI] i) THEN assume_tac (i+1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   333
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   334
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   335
 "!!evs. evs : otway lost ==>                      \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   336
\      EX A' B' NA' NB'. ALL A B NA NB.                    \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   337
\       Says Server B \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   338
\            {|NA, Crypt {|NA, K|} (shrK A),                      \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   339
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs --> \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   340
\       A=A' & B=B' & NA=NA' & NB=NB'";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   341
by (etac otway.induct 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   342
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   343
by (Step_tac 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   344
(*Remaining cases: OR3 and OR4*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   345
by (ex_strip_tac 2);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   346
by (Fast_tac 2);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   347
by (expand_case_tac "K = ?y" 1);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   348
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   349
(*...we assume X is a very new message, and handle this case by contradiction*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   350
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   351
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   352
                      addss (!simpset addsimps [parts_insertI])) 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   353
val lemma = result();
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   354
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   355
goal thy 
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   356
 "!!evs. [| Says Server B                                          \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   357
\              {|NA, Crypt {|NA, K|} (shrK A),                     \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   358
\                    Crypt {|NB, K|} (shrK B)|}                    \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   359
\            : set_of_list evs;                                    \ 
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   360
\           Says Server B'                                         \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   361
\              {|NA', Crypt {|NA', K|} (shrK A'),                  \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   362
\                     Crypt {|NB', K|} (shrK B')|}                 \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   363
\            : set_of_list evs;                                    \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   364
\           evs : otway lost |]                                         \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   365
\        ==> A=A' & B=B' & NA=NA' & NB=NB'";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   366
by (dtac lemma 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   367
by (REPEAT (etac exE 1));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   368
(*Duplicate the assumption*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   369
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   370
by (fast_tac (!claset addSDs [spec]) 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   371
qed "unique_session_keys";
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   372
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   373
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   374
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   375
(**** Authenticity properties relating to NA ****)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   376
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   377
(*Only OR1 can have caused such a part of a message to appear.*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   378
goal thy 
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   379
 "!!evs. [| A ~: lost;  evs : otway lost |]                        \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   380
\        ==> Crypt {|NA, Agent A, Agent B|} (shrK A)               \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   381
\             : parts (sees lost Spy evs) -->                      \
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   382
\            Says A B {|NA, Agent A, Agent B,                      \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   383
\                       Crypt {|NA, Agent A, Agent B|} (shrK A)|}  \
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   384
\             : set_of_list evs";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   385
by (parts_induct_tac 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   386
qed_spec_mp "Crypt_imp_OR1";
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   387
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   388
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   389
(** The Nonce NA uniquely identifies A's message. **)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   390
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   391
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   392
 "!!evs. [| evs : otway lost; A ~: lost |]               \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   393
\ ==> EX B'. ALL B.    \
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   394
\        Crypt {|NA, Agent A, Agent B|} (shrK A) : parts (sees lost Spy evs) \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   395
\        --> B = B'";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   396
by (parts_induct_tac 1);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   397
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1); 
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   398
(*OR1: creation of new Nonce.  Move assertion into global context*)
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   399
by (expand_case_tac "NA = ?y" 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   400
by (best_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   401
                      addEs  [new_nonces_not_seen RSN(2,rev_notE)]) 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   402
val lemma = result();
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   403
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   404
goal thy 
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   405
 "!!evs.[| Crypt {|NA, Agent A, Agent B|} (shrK A): parts(sees lost Spy evs); \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   406
\          Crypt {|NA, Agent A, Agent C|} (shrK A): parts(sees lost Spy evs); \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   407
\          evs : otway lost;  A ~: lost |]                                    \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   408
\        ==> B = C";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   409
by (dtac lemma 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   410
by (assume_tac 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   411
by (etac exE 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   412
(*Duplicate the assumption*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   413
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   414
by (fast_tac (!claset addSDs [spec]) 1);
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   415
qed "unique_NA";
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   416
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   417
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   418
val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   419
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   420
(*It is impossible to re-use a nonce in both OR1 and OR2.  This holds because
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   421
  OR2 encrypts Nonce NB.  It prevents the attack that can occur in the
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   422
  over-simplified version of this protocol: see OtwayRees_Bad.*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   423
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   424
 "!!evs. [| A ~: lost;  evs : otway lost |]                            \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   425
\        ==> Crypt {|NA, Agent A, Agent B|} (shrK A)             \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   426
\             : parts (sees lost Spy evs) -->                       \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   427
\            Crypt {|NA', NA, Agent A', Agent A|} (shrK A)       \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   428
\             ~: parts (sees lost Spy evs)";
2071
0debdc018d26 Put in a simpler and *much* faster proof of no_nonce_OR1_OR2
paulson
parents: 2064
diff changeset
   429
by (parts_induct_tac 1);
0debdc018d26 Put in a simpler and *much* faster proof of no_nonce_OR1_OR2
paulson
parents: 2064
diff changeset
   430
by (REPEAT (fast_tac (!claset addSEs (partsEs@[nonce_not_seen_now])
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   431
                              addSDs  [impOfSubs parts_insert_subset_Un]
2071
0debdc018d26 Put in a simpler and *much* faster proof of no_nonce_OR1_OR2
paulson
parents: 2064
diff changeset
   432
                              addss (!simpset)) 1));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   433
qed_spec_mp"no_nonce_OR1_OR2";
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   434
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   435
2053
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   436
(*Crucial property: If the encrypted message appears, and A has used NA
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   437
  to start a run, then it originated with the Server!*)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   438
goal thy 
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   439
 "!!evs. [| A ~: lost;  A ~= Spy;  evs : otway lost |]                 \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   440
\    ==> Crypt {|NA, Key K|} (shrK A) : parts (sees lost Spy evs)      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   441
\        --> Says A B {|NA, Agent A, Agent B,                          \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   442
\                       Crypt {|NA, Agent A, Agent B|} (shrK A)|}      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   443
\             : set_of_list evs -->                                    \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   444
\            (EX NB. Says Server B                                     \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   445
\                 {|NA,                                                \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   446
\                   Crypt {|NA, Key K|} (shrK A),                      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   447
\                   Crypt {|NB, Key K|} (shrK B)|}                     \
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   448
\                   : set_of_list evs)";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   449
by (parts_induct_tac 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   450
(*OR1: it cannot be a new Nonce, contradiction.*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   451
by (fast_tac (!claset addSIs [parts_insertI]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   452
                      addSEs partsEs
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   453
                      addEs [Says_imp_old_nonces RS less_irrefl]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   454
                      addss (!simpset)) 1);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   455
(*OR3 and OR4*) 
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   456
(*OR4*)
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   457
by (REPEAT (Safe_step_tac 2));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   458
by (REPEAT (best_tac (!claset addSDs [parts_cut]) 3));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   459
by (fast_tac (!claset addSIs [Crypt_imp_OR1]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   460
                      addEs  partsEs
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   461
                      addDs [Says_imp_sees_Spy RS parts.Inj]) 2);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   462
(*OR3*)  (** LEVEL 5 **)
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   463
by (asm_simp_tac (!simpset addsimps [ex_disj_distrib]) 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   464
by (step_tac (!claset delrules [disjCI, impCE]) 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   465
by (fast_tac (!claset addSEs [MPair_parts]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   466
                      addSDs [Says_imp_sees_Spy RS parts.Inj]
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   467
                      addEs  [no_nonce_OR1_OR2 RSN (2, rev_notE)]
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   468
                      delrules [conjI] (*stop split-up into 4 subgoals*)) 2);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   469
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   470
                      addSEs [MPair_parts]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   471
                      addEs  [unique_NA]) 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   472
qed_spec_mp "NA_Crypt_imp_Server_msg";
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   473
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   474
2053
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   475
(*Corollary: if A receives B's OR4 message and the nonce NA agrees
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   476
  then the key really did come from the Server!  CANNOT prove this of the
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   477
  bad form of this protocol, even though we can prove
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   478
  Spy_not_see_encrypted_key*)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   479
goal thy 
2053
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   480
 "!!evs. [| Says B' A {|NA, Crypt {|NA, Key K|} (shrK A)|}         \
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   481
\            : set_of_list evs;                                    \
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   482
\           Says A B {|NA, Agent A, Agent B,                       \
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   483
\                      Crypt {|NA, Agent A, Agent B|} (shrK A)|}   \
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   484
\            : set_of_list evs;                                    \
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   485
\           A ~: lost;  A ~= Spy;  evs : otway lost |]             \
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   486
\        ==> EX NB. Says Server B                                  \
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   487
\                     {|NA,                                        \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   488
\                       Crypt {|NA, Key K|} (shrK A),              \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   489
\                       Crypt {|NB, Key K|} (shrK B)|}             \
2053
6c0594bfa726 Greatly simplified the proof of A_can_trust
paulson
parents: 2048
diff changeset
   490
\                       : set_of_list evs";
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   491
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   492
                      addEs  partsEs
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   493
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   494
qed "A_trust_OR4";
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   495
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   496
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   497
(*Describes the form of K and NA when the Server sends this message.*)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   498
goal thy 
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   499
 "!!evs. [| Says Server B \
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   500
\            {|NA, Crypt {|NA, K|} (shrK A),                      \
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   501
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;  \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   502
\           evs : otway lost |]                                        \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   503
\        ==> (EX evt: otway lost. K = Key(newK evt)) &                  \
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   504
\            (EX i. NA = Nonce i) &                  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   505
\            (EX j. NB = Nonce j)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   506
by (etac rev_mp 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   507
by (etac otway.induct 1);
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   508
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   509
qed "Says_Server_message_form";
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   510
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   511
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   512
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   513
    Does not in itself guarantee security: an attack could violate 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   514
    the premises, e.g. by having A=Spy **)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   515
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   516
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   517
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway lost;  evt : otway lost |] \
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   518
\        ==> Says Server B                                                 \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   519
\              {|NA, Crypt {|NA, Key K|} (shrK A),                         \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   520
\                Crypt {|NB, Key K|} (shrK B)|} : set_of_list evs -->      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   521
\            Says A Spy {|NA, Key K|} ~: set_of_list evs -->               \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   522
\            Key K ~: analz (sees lost Spy evs)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   523
by (etac otway.induct 1);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   524
by analz_Fake_tac;
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   525
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac));
1964
d551e68b7a36 Stronger proofs; work for Otway-Rees
paulson
parents: 1945
diff changeset
   526
by (ALLGOALS
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   527
    (asm_full_simp_tac 
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   528
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   529
                          analz_insert_Key_newK] @ pushes)
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   530
               setloop split_tac [expand_if])));
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   531
(*OR3*)
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   532
by (fast_tac (!claset addSIs [parts_insertI]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   533
                      addEs [Says_imp_old_keys RS less_irrefl]
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   534
                      addss (!simpset addsimps [parts_insert2])) 3);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   535
(*Reveal case 2, OR4, OR2, Fake*) 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   536
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   537
(*Reveal case 1*) (** LEVEL 6 **)
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   538
by (case_tac "Aa : lost" 1);
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   539
(*But this contradicts Key K ~: analz (sees lost Spy evsa) *)
2104
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   540
by (dtac (Says_imp_sees_Spy RS analz.Inj) 1);
f5c9a91e4b50 Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents: 2071
diff changeset
   541
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   542
(*So now we have  Aa ~: lost *)
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   543
by (dtac A_trust_OR4 1);
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   544
by (REPEAT (assume_tac 1));
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   545
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   546
val lemma = result() RS mp RS mp RSN(2,rev_notE);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   547
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   548
goal thy 
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   549
 "!!evs. [| Says Server B \
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   550
\            {|NA, Crypt {|NA, K|} (shrK A),                             \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   551
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;         \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   552
\           Says A Spy {|NA, K|} ~: set_of_list evs;                     \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   553
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   554
\        ==> K ~: analz (sees lost Spy evs)";
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   555
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   556
by (fast_tac (!claset addSEs [lemma]) 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   557
qed "Spy_not_see_encrypted_key";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   558
1945
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   559
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   560
goal thy 
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   561
 "!!evs. [| C ~: {A,B,Server};                                           \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   562
\           Says Server B                                                \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   563
\            {|NA, Crypt {|NA, K|} (shrK A),                             \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   564
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;         \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   565
\           Says A Spy {|NA, K|} ~: set_of_list evs;                     \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   566
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   567
\        ==> K ~: analz (sees lost C evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   568
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   569
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   570
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   571
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   572
qed "Agent_not_see_encrypted_key";
1945
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   573
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   574
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   575
(**** Authenticity properties relating to NB ****)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   576
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   577
(*Only OR2 can have caused such a part of a message to appear.  We do not
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   578
  know anything about X'.*)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   579
goal thy 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   580
 "!!evs. [| B ~: lost;  evs : otway lost |]                    \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   581
\        ==> Crypt {|NA, NB, Agent A, Agent B|} (shrK B)       \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   582
\             : parts (sees lost Spy evs) -->                  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   583
\            (EX X'. Says B Server                             \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   584
\             {|NA, Agent A, Agent B, X',                      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   585
\               Crypt {|NA, NB, Agent A, Agent B|} (shrK B)|}  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   586
\             : set_of_list evs)";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   587
by (parts_induct_tac 1);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   588
by (auto_tac (!claset, !simpset addcongs [conj_cong]));
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   589
qed_spec_mp "Crypt_imp_OR2";
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   590
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   591
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   592
(** The Nonce NB uniquely identifies B's  message. **)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   593
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   594
goal thy 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   595
 "!!evs. [| evs : otway lost; B ~: lost |]               \
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   596
\ ==> EX NA' A'. ALL NA A.                               \
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   597
\      Crypt {|NA, NB, Agent A, Agent B|} (shrK B) : parts(sees lost Spy evs) \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   598
\      --> NA = NA' & A = A'";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   599
by (parts_induct_tac 1);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   600
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1); 
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   601
(*OR2: creation of new Nonce.  Move assertion into global context*)
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   602
by (expand_case_tac "NB = ?y" 1);
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   603
by (fast_tac (!claset addSEs (nonce_not_seen_now::partsEs)) 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   604
val lemma = result();
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   605
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   606
goal thy 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   607
 "!!evs.[| Crypt {|NA, NB, Agent A, Agent B|} (shrK B) \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   608
\                  : parts(sees lost Spy evs);         \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   609
\          Crypt {|NC, NB, Agent C, Agent B|} (shrK B) \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   610
\                  : parts(sees lost Spy evs);         \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   611
\          evs : otway lost;  B ~: lost |]             \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   612
\        ==> NC = NA & C = A";
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   613
by (dtac lemma 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   614
by (assume_tac 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   615
by (REPEAT (etac exE 1));
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   616
(*Duplicate the assumption*)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   617
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   618
by (fast_tac (!claset addSDs [spec]) 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   619
qed "unique_NB";
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   620
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   621
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   622
(*If the encrypted message appears, and B has used Nonce NB,
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   623
  then it originated with the Server!*)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   624
goal thy 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   625
 "!!evs. [| B ~: lost;  B ~= Spy;  evs : otway lost |]                   \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   626
\    ==> Crypt {|NB, Key K|} (shrK B) : parts (sees lost Spy evs)        \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   627
\        --> (ALL X'. Says B Server                                      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   628
\                       {|NA, Agent A, Agent B, X',                      \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   629
\                         Crypt {|NA, NB, Agent A, Agent B|} (shrK B)|}  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   630
\             : set_of_list evs                                          \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   631
\             --> Says Server B                                          \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   632
\                  {|NA, Crypt {|NA, Key K|} (shrK A),                   \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   633
\                        Crypt {|NB, Key K|} (shrK B)|}                  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   634
\                   : set_of_list evs)";
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   635
by (parts_induct_tac 1);
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   636
(*OR1: it cannot be a new Nonce, contradiction.*)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   637
by (fast_tac (!claset addSIs [parts_insertI]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   638
                      addSEs partsEs
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   639
                      addEs [Says_imp_old_nonces RS less_irrefl]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   640
                      addss (!simpset)) 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   641
(*OR3 and OR4*)  (** LEVEL 5 **)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   642
(*OR4*)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   643
by (REPEAT (Safe_step_tac 2));
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   644
br (Crypt_imp_OR2 RS exE) 2;
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   645
by (REPEAT (fast_tac (!claset addEs partsEs) 2));
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   646
(*OR3*)  (** LEVEL 8 **)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   647
by (step_tac (!claset delrules [disjCI, impCE]) 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   648
by (fast_tac (!claset delrules [conjI] (*stop split-up*)) 3); 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   649
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   650
                      addSEs [MPair_parts]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   651
                      addDs  [unique_NB]) 2);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   652
by (fast_tac (!claset addSEs [MPair_parts]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   653
                      addSDs [Says_imp_sees_Spy RS parts.Inj]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   654
                      addSEs  [no_nonce_OR1_OR2 RSN (2, rev_notE)]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   655
                      delrules [conjI, impCE] (*stop split-up*)) 1);
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   656
qed_spec_mp "NB_Crypt_imp_Server_msg";
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   657
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   658
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   659
(*Guarantee for B: if it gets a message with matching NB then the Server
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   660
  has sent the correct message.*)
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   661
goal thy 
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   662
 "!!evs. [| B ~: lost;  B ~= Spy;  evs : otway lost;               \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   663
\           Says S B {|NA, X, Crypt {|NB, Key K|} (shrK B)|}       \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   664
\            : set_of_list evs;                                    \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   665
\           Says B Server {|NA, Agent A, Agent B, X',              \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   666
\                           Crypt {|NA, NB, Agent A, Agent B|}     \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   667
\                                 (shrK B)|}                       \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   668
\            : set_of_list evs |]                                  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   669
\        ==> Says Server B                                         \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   670
\                 {|NA,                                            \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   671
\                   Crypt {|NA, Key K|} (shrK A),                  \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   672
\                   Crypt {|NB, Key K|} (shrK B)|}                 \
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   673
\                   : set_of_list evs";
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   674
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   675
                      addEs  partsEs
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   676
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   677
qed "B_trust_OR3";
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   678
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   679
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   680
B_trust_OR3 RS Spy_not_see_encrypted_key;
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   681
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   682
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   683
(** A session key uniquely identifies a pair of senders in the message
2048
bb54fbba0071 Added new guarantees for A and B
paulson
parents: 2045
diff changeset
   684
    encrypted by a good agent C.  NEEDED?  INTERESTING?**)
1945
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   685
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   686
 "!!evs. evs : otway lost ==>                                           \
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   687
\      EX A B. ALL C N.                                            \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   688
\         C ~: lost -->                                             \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   689
\         Crypt {|N, Key K|} (shrK C) : parts (sees lost Spy evs) --> \
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   690
\         C=A | C=B";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   691
by (Simp_tac 1);        (*Miniscoping*)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   692
by (etac otway.induct 1);
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   693
by analz_Fake_tac;
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   694
(*spy_analz_tac just does not work here: it is an entirely different proof!*)
1945
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   695
by (ALLGOALS 
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   696
    (asm_simp_tac (!simpset addsimps [all_conj_distrib, ex_disj_distrib,
2134
04a71407089d Renamed and shuffled a few thms.
nipkow
parents: 2104
diff changeset
   697
                                      imp_conjR, parts_insert_sees,
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   698
                                      parts_insert2])));
1945
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   699
by (REPEAT_FIRST (etac exE));
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   700
(*OR3: extraction of K = newK evsa to global context...*) (** LEVEL 6 **)
2064
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   701
by (expand_case_tac "K = ?y" 4);
5a5e508e2a2b Simple tidying
paulson
parents: 2053
diff changeset
   702
by (REPEAT (ares_tac [exI] 5));
1945
20ca9cf90e69 A further tidying
paulson
parents: 1941
diff changeset
   703
(*...we prove this case by contradiction: the key is too new!*)
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   704
by (fast_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   705
                      addEs [Says_imp_old_keys RS less_irrefl]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   706
                      addss (!simpset)) 4);
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   707
(*Base, Fake, OR2, OR4*)
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   708
by (REPEAT_FIRST ex_strip_tac);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   709
by (dtac synth.Inj 4);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   710
by (dtac synth.Inj 3);
2026
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   711
(*Now in effect there are three Fake cases*)
0df5a96bf77e Last working version prior to introduction of "lost"
paulson
parents: 2014
diff changeset
   712
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs Fake_parts_insert]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   713
                                    delrules [disjCI, disjE]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   714
                                    addss (!simpset))));
2014
5be4c8ca7b25 Correction of protocol; addition of Reveal message; proofs of
paulson
parents: 1999
diff changeset
   715
qed "key_identifies_senders";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   716
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   717