Max.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 11 Aug 2017 16:09:02 +0100
changeset 191 fdba35b422a0
parent 141 f70344294e99
child 197 ca4ddf26a7c7
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
theory Max
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
imports Main
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
begin
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
section {* Some generic facts about Max *}
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
lemma Max_insert:
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
  assumes "finite B"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
  and  "B \<noteq> {}"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
  shows "Max ({x} \<union> B) = max x (Max B)"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
using assms by (simp add: Lattices_Big.Max.insert)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
lemma Max_Union:
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
  assumes fc: "finite C"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
  and ne: "C \<noteq> {}"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
  and fa: "\<And> A. A \<in> C \<Longrightarrow> finite A \<and> A \<noteq> {}"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  shows "Max (\<Union>C) = Max (Max ` C)"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
using assms
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
proof(induct rule: finite_induct)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  case (insert x F)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
  assume ih: "\<lbrakk>F \<noteq> {}; \<And>A. A \<in> F \<Longrightarrow> finite A \<and> A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (\<Union>F) = Max (Max ` F)"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
    and h: "\<And> A. A \<in> insert x F \<Longrightarrow> finite A \<and> A \<noteq> {}"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
  show ?case (is "?L = ?R")
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
  proof(cases "F = {}")
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
    case False
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
    from Union_insert have "?L = Max (x \<union> (\<Union> F))" by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
    also have "\<dots> = max (Max x) (Max(\<Union> F))"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
    proof(rule Max_Un)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
      from h[of x] show "finite x" by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
    next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
      from h[of x] show "x \<noteq> {}" by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
    next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
      show "finite (\<Union>F)"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
        by (metis (full_types) finite_Union h insert.hyps(1) insertCI)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
    next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
      from False and h show "\<Union>F \<noteq> {}" by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
    qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
    also have "\<dots> = ?R"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
    proof -
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
      have "?R = Max (Max ` ({x} \<union> F))" by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
      also have "\<dots> = Max ({Max x} \<union> (Max ` F))" by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
      also have "\<dots> = max (Max x) (Max (\<Union>F))"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
      proof -
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
        have "Max ({Max x} \<union> Max ` F) = max (Max {Max x}) (Max (Max ` F))"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
        proof(rule Max_Un)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
          show "finite {Max x}" by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
        next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
          show "{Max x} \<noteq> {}" by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
        next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
          from insert show "finite (Max ` F)" by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
        next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
          from False show "Max ` F \<noteq> {}" by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
        qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
        moreover have "Max {Max x} = Max x" by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
        moreover have "Max (\<Union>F) = Max (Max ` F)"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
        proof(rule ih)
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
          show "F \<noteq> {}" by fact
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
        next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
          from h show "\<And>A. A \<in> F \<Longrightarrow> finite A \<and> A \<noteq> {}"
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
            by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
        qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
        ultimately show ?thesis by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
      qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
      finally show ?thesis by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
    qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
    finally show ?thesis by simp
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
  next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
    case True
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
    thus ?thesis by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
  qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
next
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
  case empty
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
  assume "{} \<noteq> {}" show ?case by auto
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    75
qed
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
92f61f6a0fe7 added a bit more text to the paper and separated a theory about Max
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
141
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    78
lemma Max_fg_mono:
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    79
  assumes "finite A"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    80
  and "\<forall> a \<in> A. f a \<le> g a"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    81
  shows "Max (f ` A) \<le> Max (g ` A)"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    82
proof(cases "A = {}")
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    83
  case True
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    84
  thus ?thesis by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    85
next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    86
  case False
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    87
  show ?thesis
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    88
  proof(rule Max.boundedI)
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    89
    from assms show "finite (f ` A)" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    90
  next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    91
    from False show "f ` A \<noteq> {}" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    92
  next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    93
    fix fa
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    94
    assume "fa \<in> f ` A"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    95
    then obtain a where h_fa: "a \<in> A" "fa = f a" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    96
    show "fa \<le> Max (g ` A)"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    97
    proof(rule Max_ge_iff[THEN iffD2])
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    98
      from assms show "finite (g ` A)" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
    99
    next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   100
      from False show "g ` A \<noteq> {}" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   101
    next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   102
      from h_fa have "g a \<in> g ` A" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   103
      moreover have "fa \<le> g a" using h_fa assms(2) by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   104
      ultimately show "\<exists>a\<in>g ` A. fa \<le> a" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   105
    qed
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   106
  qed
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   107
qed 
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   108
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   109
lemma Max_f_mono:
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   110
  assumes seq: "A \<subseteq> B"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   111
  and np: "A \<noteq> {}"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   112
  and fnt: "finite B"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   113
  shows "Max (f ` A) \<le> Max (f ` B)"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   114
proof(rule Max_mono)
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   115
  from seq show "f ` A \<subseteq> f ` B" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   116
next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   117
  from np show "f ` A \<noteq> {}" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   118
next
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   119
  from fnt and seq show "finite (f ` B)" by auto
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   120
qed
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   121
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   122
lemma Max_UNION: 
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   123
  assumes "finite A"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   124
  and "A \<noteq> {}"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   125
  and "\<forall> M \<in> f ` A. finite M"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   126
  and "\<forall> M \<in> f ` A. M \<noteq> {}"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   127
  shows "Max (\<Union>x\<in> A. f x) = Max (Max ` f ` A)" (is "?L = ?R")
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   128
  using assms[simp]
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   129
proof -
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   130
  have "?L = Max (\<Union>(f ` A))"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   131
    by (fold Union_image_eq, simp)
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   132
  also have "... = ?R"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   133
    by (subst Max_Union, simp+)
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   134
  finally show ?thesis .
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   135
qed
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   136
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   137
lemma max_Max_eq:
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   138
  assumes "finite A"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   139
    and "A \<noteq> {}"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   140
    and "x = y"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   141
  shows "max x (Max A) = Max ({y} \<union> A)" (is "?L = ?R")
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   142
proof -
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   143
  have "?R = Max (insert y A)" by simp
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   144
  also from assms have "... = ?L"
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   145
      by (subst Max.insert, simp+)
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   146
  finally show ?thesis by simp
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   147
qed
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   148
f70344294e99 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 127
diff changeset
   149
127
38c6acf03f68 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 35
diff changeset
   150
end