src/HOL/UNITY/Simple/NSP_Bad.thy
author paulson
Tue, 23 Sep 2003 15:49:17 +0200
changeset 14203 97df98601d23
parent 13812 91713a1915ee
child 15032 02aed07e01bf
permissions -rw-r--r--
conversion of NSP_Bad to Isar script
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/NSP_Bad
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     2
    ID:         $Id$
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     5
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
     6
ML{*add_path "$ISABELLE_HOME/src/HOL/Auth"*}
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     7
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     8
Original file is ../Auth/NS_Public_Bad
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
     9
*)
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    10
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    11
header{*Analyzing the Needham-Schroeder Public-Key Protocol in UNITY*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    12
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    13
theory NSP_Bad = Public + UNITY_Main:
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    14
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    15
text{*This is the flawed version, vulnerable to Lowe's attack.
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    16
From page 260 of
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    17
  Burrows, Abadi and Needham.  A Logic of Authentication.
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    18
  Proc. Royal Soc. 426 (1989).
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    19
*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    20
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    21
types state = "event list"
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    22
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    23
constdefs
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    24
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    25
  (*The spy MAY say anything he CAN say.  We do not expect him to
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    26
    invent new nonces here, but he can also use NS1.  Common to
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    27
    all similar protocols.*)
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    28
  Fake :: "(state*state) set"
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    29
    "Fake == {(s,s').
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    30
	      \<exists>B X. s' = Says Spy B X # s
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    31
		    & X \<in> synth (analz (spies s))}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    32
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    33
  (*The numeric suffixes on A identify the rule*)
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    34
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    35
  (*Alice initiates a protocol run, sending a nonce to Bob*)
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    36
  NS1 :: "(state*state) set"
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    37
    "NS1 == {(s1,s').
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    38
	     \<exists>A1 B NA.
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    39
	         s' = Says A1 B (Crypt (pubK B) {|Nonce NA, Agent A1|}) # s1
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    40
	       & Nonce NA \<notin> used s1}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    41
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    42
  (*Bob responds to Alice's message with a further nonce*)
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    43
  NS2 :: "(state*state) set"
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    44
    "NS2 == {(s2,s').
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    45
	     \<exists>A' A2 B NA NB.
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    46
	         s' = Says B A2 (Crypt (pubK A2) {|Nonce NA, Nonce NB|}) # s2
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    47
               & Says A' B (Crypt (pubK B) {|Nonce NA, Agent A2|}) \<in> set s2
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    48
	       & Nonce NB \<notin> used s2}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    49
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    50
  (*Alice proves her existence by sending NB back to Bob.*)
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    51
  NS3 :: "(state*state) set"
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    52
    "NS3 == {(s3,s').
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    53
	     \<exists>A3 B' B NA NB.
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
    54
	         s' = Says A3 B (Crypt (pubK B) (Nonce NB)) # s3
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    55
               & Says A3  B (Crypt (pubK B) {|Nonce NA, Agent A3|}) \<in> set s3
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    56
	       & Says B' A3 (Crypt (pubK A3) {|Nonce NA, Nonce NB|}) \<in> set s3}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    57
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    58
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    59
constdefs
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    60
  Nprg :: "state program"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    61
    (*Initial trace is empty*)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    62
    "Nprg == mk_total_program({[]}, {Fake, NS1, NS2, NS3}, UNIV)"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    63
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    64
declare spies_partsEs [elim]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    65
declare analz_into_parts [dest]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    66
declare Fake_parts_insert_in_Un  [dest]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    67
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    68
text{*For other theories, e.g. Mutex and Lift, using [iff] slows proofs down.
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    69
  Here, it facilitates re-use of the Auth proofs.*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    70
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    71
declare Fake_def [THEN def_act_simp, iff]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    72
declare NS1_def [THEN def_act_simp, iff]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    73
declare NS2_def [THEN def_act_simp, iff]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    74
declare NS3_def [THEN def_act_simp, iff]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    75
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    76
declare Nprg_def [THEN def_prg_Init, simp]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    77
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    78
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    79
text{*A "possibility property": there are traces that reach the end.
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    80
  Replace by LEADSTO proof!*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    81
lemma "A \<noteq> B ==>
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    82
       \<exists>NB. \<exists>s \<in> reachable Nprg. Says A B (Crypt (pubK B) (Nonce NB)) \<in> set s"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    83
apply (intro exI bexI)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    84
apply (rule_tac [2] act = "totalize_act NS3" in reachable.Acts)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    85
apply (rule_tac [3] act = "totalize_act NS2" in reachable.Acts)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    86
apply (rule_tac [4] act = "totalize_act NS1" in reachable.Acts)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    87
apply (rule_tac [5] reachable.Init)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    88
apply (simp_all (no_asm_simp) add: Nprg_def totalize_act_def)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    89
apply auto
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    90
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    91
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    92
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    93
subsection{*Inductive Proofs about @{term ns_public}*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    94
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    95
lemma ns_constrainsI:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    96
     "(!!act s s'. [| act \<in> {Id, Fake, NS1, NS2, NS3};
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    97
                      (s,s') \<in> act;  s \<in> A |] ==> s' \<in> A')
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    98
      ==> Nprg \<in> A co A'"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
    99
apply (simp add: Nprg_def mk_total_program_def)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   100
apply (rule constrainsI, auto)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   101
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   102
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   103
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   104
text{*This ML code does the inductions directly.*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   105
ML{*
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   106
val ns_constrainsI = thm "ns_constrainsI";
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   107
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   108
fun ns_constrains_tac(cs,ss) i =
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   109
   SELECT_GOAL
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   110
      (EVERY [REPEAT (etac Always_ConstrainsI 1),
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   111
	      REPEAT (resolve_tac [StableI, stableI,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   112
				   constrains_imp_Constrains] 1),
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   113
	      rtac ns_constrainsI 1,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   114
	      full_simp_tac ss 1,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   115
	      REPEAT (FIRSTGOAL (etac disjE)),
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   116
	      ALLGOALS (clarify_tac (cs delrules [impI,impCE])),
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   117
	      REPEAT (FIRSTGOAL analz_mono_contra_tac),
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   118
	      ALLGOALS (asm_simp_tac ss)]) i;
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   119
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   120
(*Tactic for proving secrecy theorems*)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   121
fun ns_induct_tac(cs,ss) =
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   122
  (SELECT_GOAL o EVERY)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   123
     [rtac AlwaysI 1,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   124
      force_tac (cs,ss) 1,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   125
      (*"reachable" gets in here*)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   126
      rtac (Always_reachable RS Always_ConstrainsI RS StableI) 1,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   127
      ns_constrains_tac(cs,ss) 1];
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   128
*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   129
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   130
method_setup ns_induct = {*
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   131
    Method.ctxt_args (fn ctxt =>
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   132
        Method.METHOD (fn facts =>
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   133
            ns_induct_tac (Classical.get_local_claset ctxt,
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   134
                               Simplifier.get_local_simpset ctxt) 1)) *}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   135
    "for inductive reasoning about the Needham-Schroeder protocol"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   136
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   137
text{*Converts invariants into statements about reachable states*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   138
lemmas Always_Collect_reachableD =
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   139
     Always_includes_reachable [THEN subsetD, THEN CollectD]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   140
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   141
text{*Spy never sees another agent's private key! (unless it's bad at start)*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   142
lemma Spy_see_priK:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   143
     "Nprg \<in> Always {s. (Key (priK A) \<in> parts (spies s)) = (A \<in> bad)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   144
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   145
apply blast
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   146
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   147
declare Spy_see_priK [THEN Always_Collect_reachableD, simp]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   148
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   149
lemma Spy_analz_priK:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   150
     "Nprg \<in> Always {s. (Key (priK A) \<in> analz (spies s)) = (A \<in> bad)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   151
by (rule Always_reachable [THEN Always_weaken], auto)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   152
declare Spy_analz_priK [THEN Always_Collect_reachableD, simp]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   153
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   154
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   155
subsection{*Authenticity properties obtained from NS2*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   156
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   157
text{*It is impossible to re-use a nonce in both NS1 and NS2 provided the
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   158
     nonce is secret.  (Honest users generate fresh nonces.)*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   159
lemma no_nonce_NS1_NS2:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   160
 "Nprg
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   161
  \<in> Always {s. Crypt (pubK C) {|NA', Nonce NA|} \<in> parts (spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   162
                Crypt (pubK B) {|Nonce NA, Agent A|} \<in> parts (spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   163
                Nonce NA \<in> analz (spies s)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   164
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   165
apply (blast intro: analz_insertI)+
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   166
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   167
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   168
text{*Adding it to the claset slows down proofs...*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   169
lemmas no_nonce_NS1_NS2_reachable =
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   170
       no_nonce_NS1_NS2 [THEN Always_Collect_reachableD, rule_format]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   171
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   172
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   173
text{*Unicity for NS1: nonce NA identifies agents A and B*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   174
lemma unique_NA_lemma:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   175
     "Nprg
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   176
  \<in> Always {s. Nonce NA \<notin> analz (spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   177
                Crypt(pubK B) {|Nonce NA, Agent A|} \<in> parts(spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   178
                Crypt(pubK B') {|Nonce NA, Agent A'|} \<in> parts(spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   179
                A=A' & B=B'}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   180
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   181
apply auto
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   182
txt{*Fake, NS1 are non-trivial*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   183
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   184
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   185
text{*Unicity for NS1: nonce NA identifies agents A and B*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   186
lemma unique_NA:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   187
     "[| Crypt(pubK B)  {|Nonce NA, Agent A|} \<in> parts(spies s);
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   188
         Crypt(pubK B') {|Nonce NA, Agent A'|} \<in> parts(spies s);
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   189
         Nonce NA \<notin> analz (spies s);
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   190
         s \<in> reachable Nprg |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   191
      ==> A=A' & B=B'"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   192
by (blast dest: unique_NA_lemma [THEN Always_Collect_reachableD])
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   193
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   194
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   195
text{*Secrecy: Spy does not see the nonce sent in msg NS1 if A and B are secure*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   196
lemma Spy_not_see_NA:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   197
     "[| A \<notin> bad;  B \<notin> bad |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   198
  ==> Nprg \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   199
              {s. Says A B (Crypt(pubK B) {|Nonce NA, Agent A|}) \<in> set s
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   200
                  --> Nonce NA \<notin> analz (spies s)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   201
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   202
txt{*NS3*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   203
prefer 4 apply (blast intro: no_nonce_NS1_NS2_reachable)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   204
txt{*NS2*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   205
prefer 3 apply (blast dest: unique_NA)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   206
txt{*NS1*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   207
prefer 2 apply blast
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   208
txt{*Fake*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   209
apply spy_analz
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   210
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   211
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   212
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   213
text{*Authentication for A: if she receives message 2 and has used NA
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   214
  to start a run, then B has sent message 2.*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   215
lemma A_trusts_NS2:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   216
 "[| A \<notin> bad;  B \<notin> bad |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   217
  ==> Nprg \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   218
              {s. Says A B (Crypt(pubK B) {|Nonce NA, Agent A|}) \<in> set s &
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   219
                  Crypt(pubK A) {|Nonce NA, Nonce NB|} \<in> parts (knows Spy s)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   220
         --> Says B A (Crypt(pubK A) {|Nonce NA, Nonce NB|}) \<in> set s}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   221
  (*insert an invariant for use in some of the subgoals*)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   222
apply (insert Spy_not_see_NA [of A B NA], simp, ns_induct)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   223
apply (auto dest: unique_NA)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   224
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   225
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   226
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   227
text{*If the encrypted message appears then it originated with Alice in NS1*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   228
lemma B_trusts_NS1:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   229
     "Nprg \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   230
              {s. Nonce NA \<notin> analz (spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   231
                  Crypt (pubK B) {|Nonce NA, Agent A|} \<in> parts (spies s)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   232
         --> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) \<in> set s}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   233
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   234
apply blast
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   235
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   236
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   237
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   238
subsection{*Authenticity properties obtained from NS2*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   239
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   240
text{*Unicity for NS2: nonce NB identifies nonce NA and agent A.
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   241
   Proof closely follows that of @{text unique_NA}.*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   242
lemma unique_NB_lemma:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   243
 "Nprg
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   244
  \<in> Always {s. Nonce NB \<notin> analz (spies s)  -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   245
                Crypt (pubK A) {|Nonce NA, Nonce NB|} \<in> parts (spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   246
                Crypt(pubK A'){|Nonce NA', Nonce NB|} \<in> parts(spies s) -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   247
                A=A' & NA=NA'}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   248
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   249
apply auto
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   250
txt{*Fake, NS2 are non-trivial*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   251
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   252
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   253
lemma unique_NB:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   254
     "[| Crypt(pubK A) {|Nonce NA, Nonce NB|} \<in> parts(spies s);
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   255
         Crypt(pubK A'){|Nonce NA', Nonce NB|} \<in> parts(spies s);
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   256
         Nonce NB \<notin> analz (spies s);
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   257
         s \<in> reachable Nprg |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   258
      ==> A=A' & NA=NA'"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   259
apply (blast dest: unique_NB_lemma [THEN Always_Collect_reachableD])
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   260
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   261
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   262
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   263
text{*NB remains secret PROVIDED Alice never responds with round 3*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   264
lemma Spy_not_see_NB:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   265
     "[| A \<notin> bad;  B \<notin> bad |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   266
  ==> Nprg \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   267
              {s. Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \<in> set s &
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   268
                  (ALL C. Says A C (Crypt (pubK C) (Nonce NB)) \<notin> set s)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   269
                  --> Nonce NB \<notin> analz (spies s)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   270
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   271
apply (simp_all (no_asm_simp) add: all_conj_distrib)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   272
txt{*NS3: because NB determines A*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   273
prefer 4 apply (blast dest: unique_NB)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   274
txt{*NS2: by freshness and unicity of NB*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   275
prefer 3 apply (blast intro: no_nonce_NS1_NS2_reachable)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   276
txt{*NS1: by freshness*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   277
prefer 2 apply blast
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   278
txt{*Fake*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   279
apply spy_analz
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   280
done
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
   281
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
   282
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
   283
14203
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   284
text{*Authentication for B: if he receives message 3 and has used NB
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   285
  in message 2, then A has sent message 3--to somebody....*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   286
lemma B_trusts_NS3:
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   287
     "[| A \<notin> bad;  B \<notin> bad |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   288
  ==> Nprg \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   289
              {s. Crypt (pubK B) (Nonce NB) \<in> parts (spies s) &
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   290
                  Says B A  (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \<in> set s
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   291
                  --> (\<exists>C. Says A C (Crypt (pubK C) (Nonce NB)) \<in> set s)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   292
  (*insert an invariant for use in some of the subgoals*)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   293
apply (insert Spy_not_see_NB [of A B NA NB], simp, ns_induct)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   294
apply (simp_all (no_asm_simp) add: ex_disj_distrib)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   295
apply auto
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   296
txt{*NS3: because NB determines A. This use of @{text unique_NB} is robust.*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   297
apply (blast intro: unique_NB [THEN conjunct1])
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   298
done
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   299
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   300
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   301
text{*Can we strengthen the secrecy theorem?  NO*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   302
lemma "[| A \<notin> bad;  B \<notin> bad |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   303
  ==> Nprg \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   304
              {s. Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \<in> set s
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   305
                  --> Nonce NB \<notin> analz (spies s)}"
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   306
apply ns_induct
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   307
apply auto
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   308
txt{*Fake*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   309
apply spy_analz
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   310
txt{*NS2: by freshness and unicity of NB*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   311
 apply (blast intro: no_nonce_NS1_NS2_reachable)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   312
txt{*NS3: unicity of NB identifies A and NA, but not B*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   313
apply (frule_tac A'=A in Says_imp_spies [THEN parts.Inj, THEN unique_NB])
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   314
apply (erule Says_imp_spies [THEN parts.Inj], auto)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   315
apply (rename_tac s B' C)
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   316
txt{*This is the attack!
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   317
@{subgoals[display,indent=0,margin=65]}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   318
*}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   319
oops
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   320
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   321
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   322
(*
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   323
THIS IS THE ATTACK!
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   324
[| A \<notin> bad; B \<notin> bad |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   325
==> Nprg
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   326
   \<in> Always
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   327
       {s. Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \<in> set s -->
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   328
           Nonce NB \<notin> analz (knows Spy s)}
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   329
 1. !!s B' C.
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   330
       [| A \<notin> bad; B \<notin> bad; s \<in> reachable Nprg
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   331
          Says A C (Crypt (pubK C) {|Nonce NA, Agent A|}) \<in> set s;
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   332
          Says B' A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \<in> set s;
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   333
          C \<in> bad; Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \<in> set s;
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   334
          Nonce NB \<notin> analz (knows Spy s) |]
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   335
       ==> False
97df98601d23 conversion of NSP_Bad to Isar script
paulson
parents: 13812
diff changeset
   336
*)
11195
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
   337
65ede8dfe304 reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
paulson
parents:
diff changeset
   338
end