src/HOL/MetisExamples/Message.thy
author paulson
Thu, 21 Jun 2007 13:23:33 +0200
changeset 23449 dd874e6a3282
child 23755 1c4672d130b1
permissions -rw-r--r--
integration of Metis prover
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23449
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     1
(*  Title:      HOL/MetisTest/Message.thy
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     2
    ID:         $Id$
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     4
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     5
Testing the metis method
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     6
*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     7
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     8
theory Message imports Main begin
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     9
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    10
(*Needed occasionally with spy_analz_tac, e.g. in analz_insert_Key_newK*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    11
lemma strange_Un_eq [simp]: "A \<union> (B \<union> A) = B \<union> A"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    12
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    13
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    14
types 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    15
  key = nat
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    16
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    17
consts
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    18
  all_symmetric :: bool        --{*true if all keys are symmetric*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    19
  invKey        :: "key=>key"  --{*inverse of a symmetric key*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    20
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    21
specification (invKey)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    22
  invKey [simp]: "invKey (invKey K) = K"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    23
  invKey_symmetric: "all_symmetric --> invKey = id"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    24
    by (rule exI [of _ id], auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    25
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    26
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    27
text{*The inverse of a symmetric key is itself; that of a public key
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    28
      is the private key and vice versa*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    29
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    30
constdefs
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    31
  symKeys :: "key set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    32
  "symKeys == {K. invKey K = K}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    33
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    34
datatype  --{*We allow any number of friendly agents*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    35
  agent = Server | Friend nat | Spy
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    36
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    37
datatype
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    38
     msg = Agent  agent	    --{*Agent names*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    39
         | Number nat       --{*Ordinary integers, timestamps, ...*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    40
         | Nonce  nat       --{*Unguessable nonces*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    41
         | Key    key       --{*Crypto keys*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    42
	 | Hash   msg       --{*Hashing*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    43
	 | MPair  msg msg   --{*Compound messages*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    44
	 | Crypt  key msg   --{*Encryption, public- or shared-key*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    45
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    46
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    47
text{*Concrete syntax: messages appear as {|A,B,NA|}, etc...*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    48
syntax
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    49
  "@MTuple"      :: "['a, args] => 'a * 'b"       ("(2{|_,/ _|})")
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    50
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    51
syntax (xsymbols)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    52
  "@MTuple"      :: "['a, args] => 'a * 'b"       ("(2\<lbrace>_,/ _\<rbrace>)")
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    53
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    54
translations
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    55
  "{|x, y, z|}"   == "{|x, {|y, z|}|}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    56
  "{|x, y|}"      == "MPair x y"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    57
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    58
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    59
constdefs
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    60
  HPair :: "[msg,msg] => msg"                       ("(4Hash[_] /_)" [0, 1000])
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    61
    --{*Message Y paired with a MAC computed with the help of X*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    62
    "Hash[X] Y == {| Hash{|X,Y|}, Y|}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    63
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    64
  keysFor :: "msg set => key set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    65
    --{*Keys useful to decrypt elements of a message set*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    66
  "keysFor H == invKey ` {K. \<exists>X. Crypt K X \<in> H}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    67
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    68
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    69
subsubsection{*Inductive Definition of All Parts" of a Message*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    70
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    71
consts  parts   :: "msg set => msg set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    72
inductive "parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    73
  intros 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    74
    Inj [intro]:               "X \<in> H ==> X \<in> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    75
    Fst:         "{|X,Y|}   \<in> parts H ==> X \<in> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    76
    Snd:         "{|X,Y|}   \<in> parts H ==> Y \<in> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    77
    Body:        "Crypt K X \<in> parts H ==> X \<in> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    78
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    79
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    80
ML{*ResAtp.problem_name := "Message__parts_mono"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    81
lemma parts_mono: "G \<subseteq> H ==> parts(G) \<subseteq> parts(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    82
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    83
apply (erule parts.induct) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    84
apply (metis Inj set_mp)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    85
apply (metis Fst)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    86
apply (metis Snd)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    87
apply (metis Body)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    88
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    89
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    90
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    91
text{*Equations hold because constructors are injective.*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    92
lemma Friend_image_eq [simp]: "(Friend x \<in> Friend`A) = (x:A)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    93
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    94
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    95
lemma Key_image_eq [simp]: "(Key x \<in> Key`A) = (x\<in>A)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    96
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    97
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    98
lemma Nonce_Key_image_eq [simp]: "(Nonce x \<notin> Key`A)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    99
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   100
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   101
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   102
subsubsection{*Inverse of keys *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   103
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   104
ML{*ResAtp.problem_name := "Message__invKey_eq"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   105
lemma invKey_eq [simp]: "(invKey K = invKey K') = (K=K')"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   106
by (metis invKey)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   107
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   108
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   109
subsection{*keysFor operator*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   110
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   111
lemma keysFor_empty [simp]: "keysFor {} = {}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   112
by (unfold keysFor_def, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   113
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   114
lemma keysFor_Un [simp]: "keysFor (H \<union> H') = keysFor H \<union> keysFor H'"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   115
by (unfold keysFor_def, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   116
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   117
lemma keysFor_UN [simp]: "keysFor (\<Union>i\<in>A. H i) = (\<Union>i\<in>A. keysFor (H i))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   118
by (unfold keysFor_def, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   119
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   120
text{*Monotonicity*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   121
lemma keysFor_mono: "G \<subseteq> H ==> keysFor(G) \<subseteq> keysFor(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   122
by (unfold keysFor_def, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   123
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   124
lemma keysFor_insert_Agent [simp]: "keysFor (insert (Agent A) H) = keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   125
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   126
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   127
lemma keysFor_insert_Nonce [simp]: "keysFor (insert (Nonce N) H) = keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   128
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   129
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   130
lemma keysFor_insert_Number [simp]: "keysFor (insert (Number N) H) = keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   131
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   132
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   133
lemma keysFor_insert_Key [simp]: "keysFor (insert (Key K) H) = keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   134
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   135
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   136
lemma keysFor_insert_Hash [simp]: "keysFor (insert (Hash X) H) = keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   137
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   138
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   139
lemma keysFor_insert_MPair [simp]: "keysFor (insert {|X,Y|} H) = keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   140
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   141
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   142
lemma keysFor_insert_Crypt [simp]: 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   143
    "keysFor (insert (Crypt K X) H) = insert (invKey K) (keysFor H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   144
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   145
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   146
lemma keysFor_image_Key [simp]: "keysFor (Key`E) = {}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   147
by (unfold keysFor_def, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   148
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   149
lemma Crypt_imp_invKey_keysFor: "Crypt K X \<in> H ==> invKey K \<in> keysFor H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   150
by (unfold keysFor_def, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   151
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   152
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   153
subsection{*Inductive relation "parts"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   154
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   155
lemma MPair_parts:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   156
     "[| {|X,Y|} \<in> parts H;        
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   157
         [| X \<in> parts H; Y \<in> parts H |] ==> P |] ==> P"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   158
by (blast dest: parts.Fst parts.Snd) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   159
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   160
    declare MPair_parts [elim!]  parts.Body [dest!]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   161
text{*NB These two rules are UNSAFE in the formal sense, as they discard the
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   162
     compound message.  They work well on THIS FILE.  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   163
  @{text MPair_parts} is left as SAFE because it speeds up proofs.
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   164
  The Crypt rule is normally kept UNSAFE to avoid breaking up certificates.*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   165
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   166
lemma parts_increasing: "H \<subseteq> parts(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   167
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   168
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   169
lemmas parts_insertI = subset_insertI [THEN parts_mono, THEN subsetD, standard]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   170
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   171
lemma parts_empty [simp]: "parts{} = {}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   172
apply safe
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   173
apply (erule parts.induct)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   174
apply blast+
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   175
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   176
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   177
lemma parts_emptyE [elim!]: "X\<in> parts{} ==> P"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   178
by simp
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   179
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   180
text{*WARNING: loops if H = {Y}, therefore must not be repeated!*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   181
lemma parts_singleton: "X\<in> parts H ==> \<exists>Y\<in>H. X\<in> parts {Y}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   182
apply (erule parts.induct)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   183
apply blast+
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   184
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   185
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   186
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   187
subsubsection{*Unions *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   188
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   189
lemma parts_Un_subset1: "parts(G) \<union> parts(H) \<subseteq> parts(G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   190
by (intro Un_least parts_mono Un_upper1 Un_upper2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   191
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   192
lemma parts_Un_subset2: "parts(G \<union> H) \<subseteq> parts(G) \<union> parts(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   193
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   194
apply (erule parts.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   195
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   196
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   197
lemma parts_Un [simp]: "parts(G \<union> H) = parts(G) \<union> parts(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   198
by (intro equalityI parts_Un_subset1 parts_Un_subset2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   199
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   200
lemma parts_insert: "parts (insert X H) = parts {X} \<union> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   201
apply (subst insert_is_Un [of _ H])
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   202
apply (simp only: parts_Un)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   203
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   204
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   205
ML{*ResAtp.problem_name := "Message__parts_insert_two"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   206
lemma parts_insert2:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   207
     "parts (insert X (insert Y H)) = parts {X} \<union> parts {Y} \<union> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   208
by (metis Un_commute Un_empty_left Un_empty_right Un_insert_left Un_insert_right insert_commute parts_Un)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   209
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   210
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   211
lemma parts_UN_subset1: "(\<Union>x\<in>A. parts(H x)) \<subseteq> parts(\<Union>x\<in>A. H x)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   212
by (intro UN_least parts_mono UN_upper)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   213
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   214
lemma parts_UN_subset2: "parts(\<Union>x\<in>A. H x) \<subseteq> (\<Union>x\<in>A. parts(H x))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   215
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   216
apply (erule parts.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   217
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   218
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   219
lemma parts_UN [simp]: "parts(\<Union>x\<in>A. H x) = (\<Union>x\<in>A. parts(H x))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   220
by (intro equalityI parts_UN_subset1 parts_UN_subset2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   221
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   222
text{*Added to simplify arguments to parts, analz and synth.
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   223
  NOTE: the UN versions are no longer used!*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   224
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   225
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   226
text{*This allows @{text blast} to simplify occurrences of 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   227
  @{term "parts(G\<union>H)"} in the assumption.*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   228
lemmas in_parts_UnE = parts_Un [THEN equalityD1, THEN subsetD, THEN UnE] 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   229
declare in_parts_UnE [elim!]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   230
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   231
lemma parts_insert_subset: "insert X (parts H) \<subseteq> parts(insert X H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   232
by (blast intro: parts_mono [THEN [2] rev_subsetD])
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   233
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   234
subsubsection{*Idempotence and transitivity *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   235
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   236
lemma parts_partsD [dest!]: "X\<in> parts (parts H) ==> X\<in> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   237
by (erule parts.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   238
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   239
lemma parts_idem [simp]: "parts (parts H) = parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   240
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   241
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   242
ML{*ResAtp.problem_name := "Message__parts_subset_iff"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   243
lemma parts_subset_iff [simp]: "(parts G \<subseteq> parts H) = (G \<subseteq> parts H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   244
apply (rule iffI) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   245
apply (metis Un_absorb1 Un_subset_iff parts_Un parts_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   246
apply (metis parts_Un parts_idem parts_increasing parts_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   247
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   248
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   249
lemma parts_trans: "[| X\<in> parts G;  G \<subseteq> parts H |] ==> X\<in> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   250
by (blast dest: parts_mono); 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   251
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   252
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   253
ML{*ResAtp.problem_name := "Message__parts_cut"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   254
lemma parts_cut: "[|Y\<in> parts(insert X G);  X\<in> parts H|] ==> Y\<in> parts(G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   255
by (metis Un_subset_iff Un_upper1 Un_upper2 insert_subset parts_Un parts_increasing parts_trans) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   256
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   257
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   258
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   259
subsubsection{*Rewrite rules for pulling out atomic messages *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   260
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   261
lemmas parts_insert_eq_I = equalityI [OF subsetI parts_insert_subset]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   262
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   263
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   264
lemma parts_insert_Agent [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   265
     "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   266
apply (rule parts_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   267
apply (erule parts.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   268
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   269
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   270
lemma parts_insert_Nonce [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   271
     "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   272
apply (rule parts_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   273
apply (erule parts.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   274
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   275
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   276
lemma parts_insert_Number [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   277
     "parts (insert (Number N) H) = insert (Number N) (parts H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   278
apply (rule parts_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   279
apply (erule parts.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   280
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   281
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   282
lemma parts_insert_Key [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   283
     "parts (insert (Key K) H) = insert (Key K) (parts H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   284
apply (rule parts_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   285
apply (erule parts.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   286
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   287
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   288
lemma parts_insert_Hash [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   289
     "parts (insert (Hash X) H) = insert (Hash X) (parts H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   290
apply (rule parts_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   291
apply (erule parts.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   292
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   293
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   294
lemma parts_insert_Crypt [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   295
     "parts (insert (Crypt K X) H) =  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   296
          insert (Crypt K X) (parts (insert X H))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   297
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   298
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   299
apply (erule parts.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   300
apply (blast intro: parts.Body)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   301
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   302
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   303
lemma parts_insert_MPair [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   304
     "parts (insert {|X,Y|} H) =  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   305
          insert {|X,Y|} (parts (insert X (insert Y H)))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   306
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   307
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   308
apply (erule parts.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   309
apply (blast intro: parts.Fst parts.Snd)+
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   310
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   311
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   312
lemma parts_image_Key [simp]: "parts (Key`N) = Key`N"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   313
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   314
apply (erule parts.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   315
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   316
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   317
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   318
ML{*ResAtp.problem_name := "Message__msg_Nonce_supply"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   319
lemma msg_Nonce_supply: "\<exists>N. \<forall>n. N\<le>n --> Nonce n \<notin> parts {msg}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   320
apply (induct_tac "msg") 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   321
apply (simp_all add: parts_insert2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   322
apply (metis Suc_n_not_le_n)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   323
apply (metis le_trans linorder_linear)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   324
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   325
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   326
subsection{*Inductive relation "analz"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   327
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   328
text{*Inductive definition of "analz" -- what can be broken down from a set of
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   329
    messages, including keys.  A form of downward closure.  Pairs can
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   330
    be taken apart; messages decrypted with known keys.  *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   331
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   332
consts  analz   :: "msg set => msg set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   333
inductive "analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   334
  intros 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   335
    Inj [intro,simp] :    "X \<in> H ==> X \<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   336
    Fst:     "{|X,Y|} \<in> analz H ==> X \<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   337
    Snd:     "{|X,Y|} \<in> analz H ==> Y \<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   338
    Decrypt [dest]: 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   339
             "[|Crypt K X \<in> analz H; Key(invKey K): analz H|] ==> X \<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   340
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   341
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   342
text{*Monotonicity; Lemma 1 of Lowe's paper*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   343
lemma analz_mono: "G\<subseteq>H ==> analz(G) \<subseteq> analz(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   344
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   345
apply (erule analz.induct) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   346
apply (auto dest: analz.Fst analz.Snd) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   347
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   348
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   349
text{*Making it safe speeds up proofs*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   350
lemma MPair_analz [elim!]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   351
     "[| {|X,Y|} \<in> analz H;        
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   352
             [| X \<in> analz H; Y \<in> analz H |] ==> P   
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   353
          |] ==> P"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   354
by (blast dest: analz.Fst analz.Snd)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   355
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   356
lemma analz_increasing: "H \<subseteq> analz(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   357
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   358
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   359
lemma analz_subset_parts: "analz H \<subseteq> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   360
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   361
apply (erule analz.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   362
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   363
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   364
lemmas analz_into_parts = analz_subset_parts [THEN subsetD, standard]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   365
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   366
lemmas not_parts_not_analz = analz_subset_parts [THEN contra_subsetD, standard]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   367
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   368
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   369
ML{*ResAtp.problem_name := "Message__parts_analz"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   370
lemma parts_analz [simp]: "parts (analz H) = parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   371
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   372
apply (metis analz_subset_parts parts_subset_iff)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   373
apply (metis analz_increasing parts_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   374
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   375
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   376
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   377
lemma analz_parts [simp]: "analz (parts H) = parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   378
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   379
apply (erule analz.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   380
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   381
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   382
lemmas analz_insertI = subset_insertI [THEN analz_mono, THEN [2] rev_subsetD, standard]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   383
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   384
subsubsection{*General equational properties *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   385
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   386
lemma analz_empty [simp]: "analz{} = {}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   387
apply safe
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   388
apply (erule analz.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   389
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   390
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   391
text{*Converse fails: we can analz more from the union than from the 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   392
  separate parts, as a key in one might decrypt a message in the other*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   393
lemma analz_Un: "analz(G) \<union> analz(H) \<subseteq> analz(G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   394
by (intro Un_least analz_mono Un_upper1 Un_upper2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   395
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   396
lemma analz_insert: "insert X (analz H) \<subseteq> analz(insert X H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   397
by (blast intro: analz_mono [THEN [2] rev_subsetD])
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   398
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   399
subsubsection{*Rewrite rules for pulling out atomic messages *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   400
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   401
lemmas analz_insert_eq_I = equalityI [OF subsetI analz_insert]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   402
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   403
lemma analz_insert_Agent [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   404
     "analz (insert (Agent agt) H) = insert (Agent agt) (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   405
apply (rule analz_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   406
apply (erule analz.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   407
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   408
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   409
lemma analz_insert_Nonce [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   410
     "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   411
apply (rule analz_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   412
apply (erule analz.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   413
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   414
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   415
lemma analz_insert_Number [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   416
     "analz (insert (Number N) H) = insert (Number N) (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   417
apply (rule analz_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   418
apply (erule analz.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   419
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   420
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   421
lemma analz_insert_Hash [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   422
     "analz (insert (Hash X) H) = insert (Hash X) (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   423
apply (rule analz_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   424
apply (erule analz.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   425
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   426
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   427
text{*Can only pull out Keys if they are not needed to decrypt the rest*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   428
lemma analz_insert_Key [simp]: 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   429
    "K \<notin> keysFor (analz H) ==>   
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   430
          analz (insert (Key K) H) = insert (Key K) (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   431
apply (unfold keysFor_def)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   432
apply (rule analz_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   433
apply (erule analz.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   434
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   435
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   436
lemma analz_insert_MPair [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   437
     "analz (insert {|X,Y|} H) =  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   438
          insert {|X,Y|} (analz (insert X (insert Y H)))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   439
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   440
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   441
apply (erule analz.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   442
apply (erule analz.induct)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   443
apply (blast intro: analz.Fst analz.Snd)+
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   444
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   445
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   446
text{*Can pull out enCrypted message if the Key is not known*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   447
lemma analz_insert_Crypt:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   448
     "Key (invKey K) \<notin> analz H 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   449
      ==> analz (insert (Crypt K X) H) = insert (Crypt K X) (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   450
apply (rule analz_insert_eq_I) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   451
apply (erule analz.induct, auto) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   452
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   453
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   454
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   455
lemma lemma1: "Key (invKey K) \<in> analz H ==>   
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   456
               analz (insert (Crypt K X) H) \<subseteq>  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   457
               insert (Crypt K X) (analz (insert X H))" 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   458
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   459
apply (erule_tac xa = x in analz.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   460
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   461
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   462
lemma lemma2: "Key (invKey K) \<in> analz H ==>   
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   463
               insert (Crypt K X) (analz (insert X H)) \<subseteq>  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   464
               analz (insert (Crypt K X) H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   465
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   466
apply (erule_tac xa = x in analz.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   467
apply (blast intro: analz_insertI analz.Decrypt)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   468
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   469
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   470
lemma analz_insert_Decrypt:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   471
     "Key (invKey K) \<in> analz H ==>   
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   472
               analz (insert (Crypt K X) H) =  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   473
               insert (Crypt K X) (analz (insert X H))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   474
by (intro equalityI lemma1 lemma2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   475
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   476
text{*Case analysis: either the message is secure, or it is not! Effective,
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   477
but can cause subgoals to blow up! Use with @{text "split_if"}; apparently
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   478
@{text "split_tac"} does not cope with patterns such as @{term"analz (insert
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   479
(Crypt K X) H)"} *} 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   480
lemma analz_Crypt_if [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   481
     "analz (insert (Crypt K X) H) =                 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   482
          (if (Key (invKey K) \<in> analz H)                 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   483
           then insert (Crypt K X) (analz (insert X H))  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   484
           else insert (Crypt K X) (analz H))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   485
by (simp add: analz_insert_Crypt analz_insert_Decrypt)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   486
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   487
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   488
text{*This rule supposes "for the sake of argument" that we have the key.*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   489
lemma analz_insert_Crypt_subset:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   490
     "analz (insert (Crypt K X) H) \<subseteq>   
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   491
           insert (Crypt K X) (analz (insert X H))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   492
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   493
apply (erule analz.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   494
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   495
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   496
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   497
lemma analz_image_Key [simp]: "analz (Key`N) = Key`N"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   498
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   499
apply (erule analz.induct, auto)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   500
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   501
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   502
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   503
subsubsection{*Idempotence and transitivity *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   504
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   505
lemma analz_analzD [dest!]: "X\<in> analz (analz H) ==> X\<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   506
by (erule analz.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   507
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   508
lemma analz_idem [simp]: "analz (analz H) = analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   509
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   510
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   511
lemma analz_subset_iff [simp]: "(analz G \<subseteq> analz H) = (G \<subseteq> analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   512
apply (rule iffI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   513
apply (iprover intro: subset_trans analz_increasing)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   514
apply (frule analz_mono, simp) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   515
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   516
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   517
lemma analz_trans: "[| X\<in> analz G;  G \<subseteq> analz H |] ==> X\<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   518
by (drule analz_mono, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   519
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   520
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   521
ML{*ResAtp.problem_name := "Message__analz_cut"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   522
    declare analz_trans[intro]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   523
lemma analz_cut: "[| Y\<in> analz (insert X H);  X\<in> analz H |] ==> Y\<in> analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   524
(*TOO SLOW
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   525
by (metis analz_idem analz_increasing analz_mono insert_absorb insert_mono insert_subset) --{*317s*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   526
??*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   527
by (erule analz_trans, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   528
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   529
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   530
text{*This rewrite rule helps in the simplification of messages that involve
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   531
  the forwarding of unknown components (X).  Without it, removing occurrences
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   532
  of X can be very complicated. *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   533
lemma analz_insert_eq: "X\<in> analz H ==> analz (insert X H) = analz H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   534
by (blast intro: analz_cut analz_insertI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   535
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   536
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   537
text{*A congruence rule for "analz" *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   538
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   539
ML{*ResAtp.problem_name := "Message__analz_subset_cong"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   540
lemma analz_subset_cong:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   541
     "[| analz G \<subseteq> analz G'; analz H \<subseteq> analz H' |] 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   542
      ==> analz (G \<union> H) \<subseteq> analz (G' \<union> H')"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   543
apply simp
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   544
apply (metis Un_absorb2 Un_commute Un_subset_iff Un_upper1 Un_upper2 analz_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   545
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   546
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   547
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   548
lemma analz_cong:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   549
     "[| analz G = analz G'; analz H = analz H'  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   550
               |] ==> analz (G \<union> H) = analz (G' \<union> H')"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   551
by (intro equalityI analz_subset_cong, simp_all) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   552
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   553
lemma analz_insert_cong:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   554
     "analz H = analz H' ==> analz(insert X H) = analz(insert X H')"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   555
by (force simp only: insert_def intro!: analz_cong)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   556
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   557
text{*If there are no pairs or encryptions then analz does nothing*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   558
lemma analz_trivial:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   559
     "[| \<forall>X Y. {|X,Y|} \<notin> H;  \<forall>X K. Crypt K X \<notin> H |] ==> analz H = H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   560
apply safe
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   561
apply (erule analz.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   562
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   563
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   564
text{*These two are obsolete (with a single Spy) but cost little to prove...*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   565
lemma analz_UN_analz_lemma:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   566
     "X\<in> analz (\<Union>i\<in>A. analz (H i)) ==> X\<in> analz (\<Union>i\<in>A. H i)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   567
apply (erule analz.induct)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   568
apply (blast intro: analz_mono [THEN [2] rev_subsetD])+
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   569
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   570
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   571
lemma analz_UN_analz [simp]: "analz (\<Union>i\<in>A. analz (H i)) = analz (\<Union>i\<in>A. H i)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   572
by (blast intro: analz_UN_analz_lemma analz_mono [THEN [2] rev_subsetD])
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   573
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   574
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   575
subsection{*Inductive relation "synth"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   576
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   577
text{*Inductive definition of "synth" -- what can be built up from a set of
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   578
    messages.  A form of upward closure.  Pairs can be built, messages
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   579
    encrypted with known keys.  Agent names are public domain.
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   580
    Numbers can be guessed, but Nonces cannot be.  *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   581
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   582
consts  synth   :: "msg set => msg set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   583
inductive "synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   584
  intros 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   585
    Inj    [intro]:   "X \<in> H ==> X \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   586
    Agent  [intro]:   "Agent agt \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   587
    Number [intro]:   "Number n  \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   588
    Hash   [intro]:   "X \<in> synth H ==> Hash X \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   589
    MPair  [intro]:   "[|X \<in> synth H;  Y \<in> synth H|] ==> {|X,Y|} \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   590
    Crypt  [intro]:   "[|X \<in> synth H;  Key(K) \<in> H|] ==> Crypt K X \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   591
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   592
text{*Monotonicity*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   593
lemma synth_mono: "G\<subseteq>H ==> synth(G) \<subseteq> synth(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   594
  by (auto, erule synth.induct, auto)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   595
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   596
text{*NO @{text Agent_synth}, as any Agent name can be synthesized.  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   597
  The same holds for @{term Number}*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   598
inductive_cases Nonce_synth [elim!]: "Nonce n \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   599
inductive_cases Key_synth   [elim!]: "Key K \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   600
inductive_cases Hash_synth  [elim!]: "Hash X \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   601
inductive_cases MPair_synth [elim!]: "{|X,Y|} \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   602
inductive_cases Crypt_synth [elim!]: "Crypt K X \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   603
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   604
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   605
lemma synth_increasing: "H \<subseteq> synth(H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   606
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   607
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   608
subsubsection{*Unions *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   609
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   610
text{*Converse fails: we can synth more from the union than from the 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   611
  separate parts, building a compound message using elements of each.*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   612
lemma synth_Un: "synth(G) \<union> synth(H) \<subseteq> synth(G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   613
by (intro Un_least synth_mono Un_upper1 Un_upper2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   614
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   615
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   616
ML{*ResAtp.problem_name := "Message__synth_insert"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   617
 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   618
lemma synth_insert: "insert X (synth H) \<subseteq> synth(insert X H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   619
by (metis insert_iff insert_subset subset_insertI synth.Inj synth_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   620
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   621
subsubsection{*Idempotence and transitivity *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   622
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   623
lemma synth_synthD [dest!]: "X\<in> synth (synth H) ==> X\<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   624
by (erule synth.induct, blast+)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   625
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   626
lemma synth_idem: "synth (synth H) = synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   627
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   628
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   629
lemma synth_subset_iff [simp]: "(synth G \<subseteq> synth H) = (G \<subseteq> synth H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   630
apply (rule iffI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   631
apply (iprover intro: subset_trans synth_increasing)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   632
apply (frule synth_mono, simp add: synth_idem) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   633
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   634
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   635
lemma synth_trans: "[| X\<in> synth G;  G \<subseteq> synth H |] ==> X\<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   636
by (drule synth_mono, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   637
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   638
ML{*ResAtp.problem_name := "Message__synth_cut"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   639
lemma synth_cut: "[| Y\<in> synth (insert X H);  X\<in> synth H |] ==> Y\<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   640
(*TOO SLOW
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   641
by (metis insert_absorb insert_mono insert_subset synth_idem synth_increasing synth_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   642
*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   643
by (erule synth_trans, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   644
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   645
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   646
lemma Agent_synth [simp]: "Agent A \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   647
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   648
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   649
lemma Number_synth [simp]: "Number n \<in> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   650
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   651
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   652
lemma Nonce_synth_eq [simp]: "(Nonce N \<in> synth H) = (Nonce N \<in> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   653
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   654
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   655
lemma Key_synth_eq [simp]: "(Key K \<in> synth H) = (Key K \<in> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   656
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   657
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   658
lemma Crypt_synth_eq [simp]:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   659
     "Key K \<notin> H ==> (Crypt K X \<in> synth H) = (Crypt K X \<in> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   660
by blast
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   661
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   662
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   663
lemma keysFor_synth [simp]: 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   664
    "keysFor (synth H) = keysFor H \<union> invKey`{K. Key K \<in> H}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   665
by (unfold keysFor_def, blast)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   666
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   667
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   668
subsubsection{*Combinations of parts, analz and synth *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   669
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   670
ML{*ResAtp.problem_name := "Message__parts_synth"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   671
lemma parts_synth [simp]: "parts (synth H) = parts H \<union> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   672
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   673
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   674
apply (erule parts.induct)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   675
apply (metis UnCI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   676
apply (metis MPair_synth UnCI UnE insert_absorb insert_subset parts.Fst parts_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   677
apply (metis MPair_synth UnCI UnE insert_absorb insert_subset parts.Snd parts_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   678
apply (metis Body Crypt_synth UnCI UnE insert_absorb insert_subset parts_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   679
apply (metis Un_subset_iff parts_increasing parts_mono synth_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   680
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   681
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   682
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   683
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   684
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   685
ML{*ResAtp.problem_name := "Message__analz_analz_Un"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   686
lemma analz_analz_Un [simp]: "analz (analz G \<union> H) = analz (G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   687
apply (rule equalityI);
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   688
apply (metis analz_idem analz_subset_cong order_eq_refl)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   689
apply (metis analz_increasing analz_subset_cong order_eq_refl)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   690
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   691
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   692
ML{*ResAtp.problem_name := "Message__analz_synth_Un"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   693
    declare analz_mono [intro] analz.Fst [intro] analz.Snd [intro] Un_least [intro]
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   694
lemma analz_synth_Un [simp]: "analz (synth G \<union> H) = analz (G \<union> H) \<union> synth G"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   695
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   696
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   697
apply (erule analz.induct)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   698
apply (metis UnCI UnE Un_commute analz.Inj)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   699
apply (metis MPair_synth UnCI UnE Un_commute Un_upper1 analz.Fst analz_increasing analz_mono insert_absorb insert_subset)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   700
apply (metis MPair_synth UnCI UnE Un_commute Un_upper1 analz.Snd analz_increasing analz_mono insert_absorb insert_subset)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   701
apply (blast intro: analz.Decrypt)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   702
apply (metis Diff_Int Diff_empty Diff_subset_conv Int_empty_right Un_commute Un_subset_iff Un_upper1 analz_increasing analz_mono synth_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   703
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   704
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   705
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   706
ML{*ResAtp.problem_name := "Message__analz_synth"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   707
lemma analz_synth [simp]: "analz (synth H) = analz H \<union> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   708
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   709
assume 0: "analz (synth H) \<noteq> analz H \<union> synth H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   710
have 1: "\<And>X1 X3. sup (analz (sup X3 X1)) (synth X3) = analz (sup (synth X3) X1)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   711
  by (metis analz_synth_Un sup_set_eq sup_set_eq sup_set_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   712
have 2: "sup (analz H) (synth H) \<noteq> analz (synth H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   713
  by (metis 0 sup_set_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   714
have 3: "\<And>X1 X3. sup (synth X3) (analz (sup X3 X1)) = analz (sup (synth X3) X1)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   715
  by (metis 1 Un_commute sup_set_eq sup_set_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   716
have 4: "\<And>X3. sup (synth X3) (analz X3) = analz (sup (synth X3) {})"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   717
  by (metis 3 Un_empty_right sup_set_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   718
have 5: "\<And>X3. sup (synth X3) (analz X3) = analz (synth X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   719
  by (metis 4 Un_empty_right sup_set_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   720
have 6: "\<And>X3. sup (analz X3) (synth X3) = analz (synth X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   721
  by (metis 5 Un_commute sup_set_eq sup_set_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   722
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   723
  by (metis 2 6)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   724
qed
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   725
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   726
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   727
subsubsection{*For reasoning about the Fake rule in traces *}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   728
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   729
ML{*ResAtp.problem_name := "Message__parts_insert_subset_Un"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   730
lemma parts_insert_subset_Un: "X\<in> G ==> parts(insert X H) \<subseteq> parts G \<union> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   731
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   732
assume 0: "X \<in> G"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   733
assume 1: "\<not> parts (insert X H) \<subseteq> parts G \<union> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   734
have 2: "\<not> parts (insert X H) \<subseteq> parts (G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   735
  by (metis 1 parts_Un)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   736
have 3: "\<not> insert X H \<subseteq> G \<union> H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   737
  by (metis 2 parts_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   738
have 4: "X \<notin> G \<union> H \<or> \<not> H \<subseteq> G \<union> H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   739
  by (metis 3 insert_subset)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   740
have 5: "X \<notin> G \<union> H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   741
  by (metis 4 Un_upper2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   742
have 6: "X \<notin> G"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   743
  by (metis 5 UnCI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   744
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   745
  by (metis 6 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   746
qed
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   747
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   748
ML{*ResAtp.problem_name := "Message__Fake_parts_insert"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   749
lemma Fake_parts_insert:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   750
     "X \<in> synth (analz H) ==>  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   751
      parts (insert X H) \<subseteq> synth (analz H) \<union> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   752
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   753
assume 0: "X \<in> synth (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   754
assume 1: "\<not> parts (insert X H) \<subseteq> synth (analz H) \<union> parts H"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   755
have 2: "\<And>X3. parts X3 \<union> synth (analz X3) = parts (synth (analz X3))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   756
  by (metis parts_synth parts_analz)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   757
have 3: "\<And>X3. analz X3 \<union> synth (analz X3) = analz (synth (analz X3))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   758
  by (metis analz_synth analz_idem)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   759
have 4: "\<And>X3. analz X3 \<subseteq> analz (synth X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   760
  by (metis Un_upper1 analz_synth)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   761
have 5: "\<not> parts (insert X H) \<subseteq> parts H \<union> synth (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   762
  by (metis 1 Un_commute)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   763
have 6: "\<not> parts (insert X H) \<subseteq> parts (synth (analz H))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   764
  by (metis 5 2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   765
have 7: "\<not> insert X H \<subseteq> synth (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   766
  by (metis 6 parts_mono)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   767
have 8: "X \<notin> synth (analz H) \<or> \<not> H \<subseteq> synth (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   768
  by (metis 7 insert_subset)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   769
have 9: "\<not> H \<subseteq> synth (analz H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   770
  by (metis 8 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   771
have 10: "\<And>X3. X3 \<subseteq> analz (synth X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   772
  by (metis analz_subset_iff 4)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   773
have 11: "\<And>X3. X3 \<subseteq> analz (synth (analz X3))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   774
  by (metis analz_subset_iff 10)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   775
have 12: "\<And>X3. analz (synth (analz X3)) = synth (analz X3) \<or>
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   776
     \<not> analz X3 \<subseteq> synth (analz X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   777
  by (metis Un_absorb1 3)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   778
have 13: "\<And>X3. analz (synth (analz X3)) = synth (analz X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   779
  by (metis 12 synth_increasing)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   780
have 14: "\<And>X3. X3 \<subseteq> synth (analz X3)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   781
  by (metis 11 13)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   782
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   783
  by (metis 9 14)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   784
qed
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   785
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   786
lemma Fake_parts_insert_in_Un:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   787
     "[|Z \<in> parts (insert X H);  X: synth (analz H)|] 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   788
      ==> Z \<in>  synth (analz H) \<union> parts H";
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   789
by (blast dest: Fake_parts_insert  [THEN subsetD, dest])
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   790
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   791
ML{*ResAtp.problem_name := "Message__Fake_analz_insert"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   792
    declare analz_mono [intro] synth_mono [intro] 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   793
lemma Fake_analz_insert:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   794
     "X\<in> synth (analz G) ==>  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   795
      analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   796
by (metis Un_commute Un_insert_left Un_insert_right Un_upper1 analz_analz_Un analz_mono analz_synth_Un equalityE insert_absorb order_le_less xt1(12))
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   797
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   798
ML{*ResAtp.problem_name := "Message__Fake_analz_insert_simpler"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   799
(*simpler problems?  BUT METIS CAN'T PROVE
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   800
lemma Fake_analz_insert_simpler:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   801
     "X\<in> synth (analz G) ==>  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   802
      analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   803
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   804
apply (subgoal_tac "x \<in> analz (synth (analz G) \<union> H) ")
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   805
apply (metis Un_commute analz_analz_Un analz_synth_Un)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   806
apply (metis Un_commute Un_upper1 Un_upper2 analz_cut analz_increasing analz_mono insert_absorb insert_mono insert_subset)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   807
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   808
*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   809
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   810
end