src/HOL/Auth/Event.thy
author paulson
Sat, 26 Apr 2003 12:38:42 +0200
changeset 13926 6e62e5357a10
parent 13922 75ae4244a596
child 13935 4822d9597d1e
permissions -rw-r--r--
converting more HOL-Auth to new-style theories
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Event
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     2
    ID:         $Id$
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     5
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     6
Theory of events for security protocols
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
     7
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3678
diff changeset
     8
Datatype of events; function "spies"; freshness
3678
414e04d7c2d6 Spy can see Notes of the compromised agents
paulson
parents: 3519
diff changeset
     9
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3678
diff changeset
    10
"bad" agents have been broken by the Spy; their private keys and internal
3678
414e04d7c2d6 Spy can see Notes of the compromised agents
paulson
parents: 3519
diff changeset
    11
    stores are visible to him
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    12
*)
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    13
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    14
theory Event = Message:
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    15
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    16
consts  (*Initial states of agents -- parameter of the construction*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    17
  initState :: "agent => msg set"
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    18
6399
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    19
datatype
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    20
  event = Says  agent agent msg
6399
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    21
        | Gets  agent       msg
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    22
        | Notes agent       msg
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    23
       
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    24
consts 
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    25
  bad    :: "agent set"				(*compromised agents*)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    26
  knows  :: "agent => event list => msg set"
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    27
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    28
11310
51e70b7bc315 spelling check
paulson
parents: 11192
diff changeset
    29
(*"spies" is retained for compatibility's sake*)
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    30
syntax
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    31
  spies  :: "event list => msg set"
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3512
diff changeset
    32
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    33
translations
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    34
  "spies"   => "knows Spy"
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    35
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    36
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    37
axioms
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3512
diff changeset
    38
  (*Spy has access to his own key for spoof messages, but Server is secure*)
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
    39
  Spy_in_bad     [iff] :    "Spy \<in> bad"
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
    40
  Server_not_bad [iff] : "Server \<notin> bad"
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    41
5183
89f162de39cf Adapted to new datatype package.
berghofe
parents: 3683
diff changeset
    42
primrec
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    43
  knows_Nil:   "knows A [] = initState A"
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    44
  knows_Cons:
6399
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    45
    "knows A (ev # evs) =
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    46
       (if A = Spy then 
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    47
	(case ev of
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    48
	   Says A' B X => insert X (knows Spy evs)
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    49
	 | Gets A' X => knows Spy evs
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    50
	 | Notes A' X  => 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
    51
	     if A' \<in> bad then insert X (knows Spy evs) else knows Spy evs)
6399
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    52
	else
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    53
	(case ev of
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    54
	   Says A' B X => 
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    55
	     if A'=A then insert X (knows A evs) else knows A evs
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    56
	 | Gets A' X    => 
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    57
	     if A'=A then insert X (knows A evs) else knows A evs
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    58
	 | Notes A' X    => 
4a9040b85e2e exchanged the order of Gets and Notes in datatype event
paulson
parents: 6308
diff changeset
    59
	     if A'=A then insert X (knows A evs) else knows A evs))"
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    60
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    61
(*
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    62
  Case A=Spy on the Gets event
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    63
  enforces the fact that if a message is received then it must have been sent,
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    64
  therefore the oops case must use Notes
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    65
*)
3678
414e04d7c2d6 Spy can see Notes of the compromised agents
paulson
parents: 3519
diff changeset
    66
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3678
diff changeset
    67
consts
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3678
diff changeset
    68
  (*Set of items that might be visible to somebody:
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3678
diff changeset
    69
    complement of the set of fresh items*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    70
  used :: "event list => msg set"
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
    71
5183
89f162de39cf Adapted to new datatype package.
berghofe
parents: 3683
diff changeset
    72
primrec
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    73
  used_Nil:   "used []         = (UN B. parts (initState B))"
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    74
  used_Cons:  "used (ev # evs) =
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    75
		     (case ev of
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    76
			Says A B X => parts {X} \<union> (used evs)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
    77
		      | Gets A X   => used evs
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    78
		      | Notes A X  => parts {X} \<union> (used evs))"
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    79
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5183
diff changeset
    80
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    81
lemma Notes_imp_used [rule_format]: "Notes A X \<in> set evs --> X \<in> used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    82
apply (induct_tac evs)
11463
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    83
apply (auto split: event.split) 
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    84
done
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    85
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    86
lemma Says_imp_used [rule_format]: "Says A B X \<in> set evs --> X \<in> used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    87
apply (induct_tac evs)
11463
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    88
apply (auto split: event.split) 
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    89
done
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    90
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    91
lemma MPair_used [rule_format]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    92
     "MPair X Y \<in> used evs --> X \<in> used evs & Y \<in> used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    93
apply (induct_tac evs)
11463
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    94
apply (auto split: event.split) 
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    95
done
96b5b27da55c three new theorems
paulson
parents: 11310
diff changeset
    96
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    97
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    98
subsection{*Function @{term knows}*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    99
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   100
text{*Simplifying   @term{"parts (insert X (knows Spy evs))
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   101
      = parts {X} \<union> parts (knows Spy evs)"}.  The general case loops.*)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   102
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   103
text{*This version won't loop with the simplifier.*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   104
lemmas parts_insert_knows_Spy = parts_insert [of _ "knows Spy evs", standard]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   105
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   106
lemma knows_Spy_Says [simp]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   107
     "knows Spy (Says A B X # evs) = insert X (knows Spy evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   108
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   109
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   110
text{*The point of letting the Spy see "bad" agents' notes is to prevent
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   111
  redundant case-splits on whether A=Spy and whether A:bad*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   112
lemma knows_Spy_Notes [simp]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   113
     "knows Spy (Notes A X # evs) =  
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   114
          (if A:bad then insert X (knows Spy evs) else knows Spy evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   115
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   116
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   117
lemma knows_Spy_Gets [simp]: "knows Spy (Gets A X # evs) = knows Spy evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   118
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   119
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   120
lemma knows_Spy_subset_knows_Spy_Says:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   121
     "knows Spy evs <= knows Spy (Says A B X # evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   122
by (simp add: subset_insertI)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   123
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   124
lemma knows_Spy_subset_knows_Spy_Notes:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   125
     "knows Spy evs <= knows Spy (Notes A X # evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   126
by force
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   127
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   128
lemma knows_Spy_subset_knows_Spy_Gets:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   129
     "knows Spy evs <= knows Spy (Gets A X # evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   130
by (simp add: subset_insertI)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   131
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   132
text{*Spy sees what is sent on the traffic*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   133
lemma Says_imp_knows_Spy [rule_format]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   134
     "Says A B X \<in> set evs --> X \<in> knows Spy evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   135
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   136
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   137
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   138
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   139
lemma Notes_imp_knows_Spy [rule_format]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   140
     "Notes A X \<in> set evs --> A: bad --> X \<in> knows Spy evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   141
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   142
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   143
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   144
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   145
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   146
text{*Elimination rules: derive contradictions from old Says events containing
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   147
  items known to be fresh*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   148
lemmas knows_Spy_partsEs =
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   149
     Says_imp_knows_Spy [THEN parts.Inj, THEN revcut_rl, standard] 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   150
     parts.Body [THEN revcut_rl, standard]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   151
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   152
text{*Compatibility for the old "spies" function*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   153
lemmas spies_partsEs = knows_Spy_partsEs
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   154
lemmas Says_imp_spies = Says_imp_knows_Spy
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   155
lemmas parts_insert_spies = parts_insert_knows_Spy
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   156
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   157
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   158
subsection{*Knowledge of Agents*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   159
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   160
lemma knows_Says: "knows A (Says A B X # evs) = insert X (knows A evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   161
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   162
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   163
lemma knows_Notes: "knows A (Notes A X # evs) = insert X (knows A evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   164
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   165
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   166
lemma knows_Gets:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   167
     "A \<noteq> Spy --> knows A (Gets A X # evs) = insert X (knows A evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   168
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   169
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   170
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   171
lemma knows_subset_knows_Says: "knows A evs <= knows A (Says A' B X # evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   172
apply (simp add: subset_insertI)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   173
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   174
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   175
lemma knows_subset_knows_Notes: "knows A evs <= knows A (Notes A' X # evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   176
apply (simp add: subset_insertI)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   177
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   178
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   179
lemma knows_subset_knows_Gets: "knows A evs <= knows A (Gets A' X # evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   180
apply (simp add: subset_insertI)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   181
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   182
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   183
text{*Agents know what they say*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   184
lemma Says_imp_knows [rule_format]: "Says A B X \<in> set evs --> X \<in> knows A evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   185
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   186
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   187
apply blast
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   188
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   189
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   190
text{*Agents know what they note*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   191
lemma Notes_imp_knows [rule_format]: "Notes A X \<in> set evs --> X \<in> knows A evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   192
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   193
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   194
apply blast
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   195
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   196
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   197
text{*Agents know what they receive*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   198
lemma Gets_imp_knows_agents [rule_format]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   199
     "A \<noteq> Spy --> Gets A X \<in> set evs --> X \<in> knows A evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   200
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   201
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   202
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   203
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   204
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   205
text{*What agents DIFFERENT FROM Spy know 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   206
  was either said, or noted, or got, or known initially*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   207
lemma knows_imp_Says_Gets_Notes_initState [rule_format]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   208
     "[| X \<in> knows A evs; A \<noteq> Spy |] ==> EX B.  
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   209
  Says A B X \<in> set evs | Gets A X \<in> set evs | Notes A X \<in> set evs | X \<in> initState A"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   210
apply (erule rev_mp)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   211
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   212
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   213
apply blast
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   214
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   215
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   216
text{*What the Spy knows -- for the time being --
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   217
  was either said or noted, or known initially*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   218
lemma knows_Spy_imp_Says_Notes_initState [rule_format]:
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   219
     "[| X \<in> knows Spy evs |] ==> EX A B.  
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   220
  Says A B X \<in> set evs | Notes A X \<in> set evs | X \<in> initState Spy"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   221
apply (erule rev_mp)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   222
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   223
apply (simp_all (no_asm_simp) split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   224
apply blast
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   225
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   226
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   227
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   228
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   229
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   230
text{*NOTE REMOVAL--laws above are cleaner, as they don't involve "case"*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   231
declare knows_Cons [simp del]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   232
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   233
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   234
subsection{*Fresh Nonces*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   235
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   236
lemma parts_knows_Spy_subset_used: "parts (knows Spy evs) <= used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   237
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   238
apply (simp_all (no_asm_simp) add: parts_insert_knows_Spy split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   239
apply blast+
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   240
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   241
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   242
lemmas usedI = parts_knows_Spy_subset_used [THEN subsetD, intro]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   243
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   244
lemma initState_into_used: "X \<in> parts (initState B) ==> X \<in> used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   245
apply (induct_tac "evs")
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   246
apply (simp_all (no_asm_simp) add: parts_insert_knows_Spy split add: event.split)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   247
apply blast
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   248
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   249
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   250
lemma used_Says [simp]: "used (Says A B X # evs) = parts{X} \<union> used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   251
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   252
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   253
lemma used_Notes [simp]: "used (Notes A X # evs) = parts{X} \<union> used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   254
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   255
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   256
lemma used_Gets [simp]: "used (Gets A X # evs) = used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   257
by simp
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   258
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   259
lemma used_nil_subset: "used [] <= used evs"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   260
apply (simp)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   261
apply (blast intro: initState_into_used)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   262
done
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   263
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   264
text{*NOTE REMOVAL--laws above are cleaner, as they don't involve "case"*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   265
declare used_Nil [simp del] used_Cons [simp del]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   266
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   267
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   268
text{*For proving theorems of the form @{term "X \<notin> analz (knows Spy evs) --> P"}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   269
  New events added by induction to "evs" are discarded.  Provided 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   270
  this information isn't needed, the proof will be much shorter, since
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   271
  it will omit complicated reasoning about @{term analz}.*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   272
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   273
lemmas analz_mono_contra =
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   274
       knows_Spy_subset_knows_Spy_Says [THEN analz_mono, THEN contra_subsetD]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   275
       knows_Spy_subset_knows_Spy_Notes [THEN analz_mono, THEN contra_subsetD]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   276
       knows_Spy_subset_knows_Spy_Gets [THEN analz_mono, THEN contra_subsetD]
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   277
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   278
ML
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   279
{*
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   280
val analz_mono_contra_tac = 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   281
  let val analz_impI = inst "P" "?Y \<notin> analz (knows Spy ?evs)" impI
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   282
  in
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   283
    rtac analz_impI THEN' 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   284
    REPEAT1 o 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   285
      (dresolve_tac (thms"analz_mono_contra"))
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   286
    THEN' mp_tac
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   287
  end
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   288
*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   289
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
   290
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   291
lemma knows_subset_knows_Cons: "knows A evs \<subseteq> knows A (e # evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   292
by (induct e, auto simp: knows_Cons)
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   293
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   294
lemma initState_subset_knows: "initState A <= knows A evs"
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   295
apply (induct_tac evs, simp) 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   296
apply (blast intro: knows_subset_knows_Cons [THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   297
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   298
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   299
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   300
text{*For proving @{text new_keys_not_used}*}
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   301
lemma keysFor_parts_insert:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   302
     "[| K \<in> keysFor (parts (insert X G));  X \<in> synth (analz H) |] 
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   303
      ==> K \<in> keysFor (parts (G \<union> H)) | Key (invKey K) \<in> parts H"; 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   304
by (force 
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   305
    dest!: parts_insert_subset_Un [THEN keysFor_mono, THEN [2] rev_subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   306
           analz_subset_parts [THEN keysFor_mono, THEN [2] rev_subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   307
    intro: analz_subset_parts [THEN subsetD] parts_mono [THEN [2] rev_subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   308
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
   309
method_setup analz_mono_contra = {*
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
   310
    Method.no_args
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 6399
diff changeset
   311
      (Method.METHOD (fn facts => REPEAT_FIRST analz_mono_contra_tac)) *}
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   312
    "for proving theorems of the form X \<notin> analz (knows Spy evs) --> P"
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   313
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   314
subsubsection{*Useful for case analysis on whether a hash is a spoof or not*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   315
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   316
ML
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   317
{*
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   318
val knows_Cons     = thm "knows_Cons"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   319
val used_Nil       = thm "used_Nil"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   320
val used_Cons      = thm "used_Cons"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   321
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   322
val Notes_imp_used = thm "Notes_imp_used";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   323
val Says_imp_used = thm "Says_imp_used";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   324
val MPair_used = thm "MPair_used";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   325
val parts_insert_knows_Spy = thm "parts_insert_knows_Spy";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   326
val knows_Spy_Says = thm "knows_Spy_Says";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   327
val knows_Spy_Notes = thm "knows_Spy_Notes";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   328
val knows_Spy_Gets = thm "knows_Spy_Gets";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   329
val knows_Spy_subset_knows_Spy_Says = thm "knows_Spy_subset_knows_Spy_Says";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   330
val knows_Spy_subset_knows_Spy_Notes = thm "knows_Spy_subset_knows_Spy_Notes";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   331
val knows_Spy_subset_knows_Spy_Gets = thm "knows_Spy_subset_knows_Spy_Gets";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   332
val Says_imp_knows_Spy = thm "Says_imp_knows_Spy";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   333
val Notes_imp_knows_Spy = thm "Notes_imp_knows_Spy";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   334
val knows_Spy_partsEs = thms "knows_Spy_partsEs";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   335
val spies_partsEs = thms "spies_partsEs";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   336
val Says_imp_spies = thm "Says_imp_spies";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   337
val parts_insert_spies = thm "parts_insert_spies";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   338
val knows_Says = thm "knows_Says";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   339
val knows_Notes = thm "knows_Notes";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   340
val knows_Gets = thm "knows_Gets";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   341
val knows_subset_knows_Says = thm "knows_subset_knows_Says";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   342
val knows_subset_knows_Notes = thm "knows_subset_knows_Notes";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   343
val knows_subset_knows_Gets = thm "knows_subset_knows_Gets";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   344
val Says_imp_knows = thm "Says_imp_knows";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   345
val Notes_imp_knows = thm "Notes_imp_knows";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   346
val Gets_imp_knows_agents = thm "Gets_imp_knows_agents";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   347
val knows_imp_Says_Gets_Notes_initState = thm "knows_imp_Says_Gets_Notes_initState";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   348
val knows_Spy_imp_Says_Notes_initState = thm "knows_Spy_imp_Says_Notes_initState";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   349
val parts_knows_Spy_subset_used = thm "parts_knows_Spy_subset_used";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   350
val usedI = thm "usedI";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   351
val initState_into_used = thm "initState_into_used";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   352
val used_Says = thm "used_Says";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   353
val used_Notes = thm "used_Notes";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   354
val used_Gets = thm "used_Gets";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   355
val used_nil_subset = thm "used_nil_subset";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   356
val analz_mono_contra = thms "analz_mono_contra";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   357
val knows_subset_knows_Cons = thm "knows_subset_knows_Cons";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   358
val initState_subset_knows = thm "initState_subset_knows";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   359
val keysFor_parts_insert = thm "keysFor_parts_insert";
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   360
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   361
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   362
val synth_analz_mono = thm "synth_analz_mono";
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   363
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   364
val synth_analz_mono_contra_tac = 
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   365
  let val syan_impI = inst "P" "?Y \<notin> synth (analz (knows Spy ?evs))" impI
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   366
  in
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   367
    rtac syan_impI THEN' 
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   368
    REPEAT1 o 
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   369
      (dresolve_tac 
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   370
       [knows_Spy_subset_knows_Spy_Says RS synth_analz_mono RS contra_subsetD,
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   371
        knows_Spy_subset_knows_Spy_Notes RS synth_analz_mono RS contra_subsetD,
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   372
	knows_Spy_subset_knows_Spy_Gets RS synth_analz_mono RS contra_subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   373
    THEN'
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   374
    mp_tac
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   375
  end;
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   376
*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   377
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   378
method_setup synth_analz_mono_contra = {*
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   379
    Method.no_args
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   380
      (Method.METHOD (fn facts => REPEAT_FIRST synth_analz_mono_contra_tac)) *}
75ae4244a596 Changes required by the certified email protocol
paulson
parents: 11463
diff changeset
   381
    "for proving theorems of the form X \<notin> synth (analz (knows Spy evs)) --> P"
3512
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
   382
9dcb4daa15e8 Moving common declarations and proofs from theories "Shared"
paulson
parents:
diff changeset
   383
end