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