src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy
author huffman
Thu, 20 Mar 2014 09:21:39 -0700
changeset 56226 29fd6bd9228e
parent 56188 0268784f60da
child 56273 def3bbe6f2a5
permissions -rw-r--r--
generalize some theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
     1
(*  Author:     John Harrison
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
     2
    Author:     Robert Himmelmann, TU Muenchen (Translation from HOL light)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
     3
*)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     4
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     5
(* ========================================================================= *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     6
(* Results connected with topological dimension.                             *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     7
(*                                                                           *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     8
(* At the moment this is just Brouwer's fixpoint theorem. The proof is from  *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
     9
(* Kuhn: "some combinatorial lemmas in topology", IBM J. v4. (1960) p. 518   *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    10
(* See "http://www.research.ibm.com/journal/rd/045/ibmrd0405K.pdf".          *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    11
(*                                                                           *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    12
(* The script below is quite messy, but at least we avoid formalizing any    *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    13
(* topological machinery; we don't even use barycentric subdivision; this is *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    14
(* the big advantage of Kuhn's proof over the usual Sperner's lemma one.     *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    15
(*                                                                           *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    16
(*              (c) Copyright, John Harrison 1998-2008                       *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    17
(* ========================================================================= *)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    18
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    19
header {* Results connected with topological dimension. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    20
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    21
theory Brouwer_Fixpoint
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    22
imports Convex_Euclidean_Space
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    23
begin
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    24
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    25
(** move this **)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    26
lemma divide_nonneg_nonneg:
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
    27
  fixes a b :: real
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    28
  assumes "a \<ge> 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    29
    and "b \<ge> 0"
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
    30
  shows "0 \<le> a / b"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    31
proof (cases "b = 0")
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    32
  case True
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    33
  then show ?thesis by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    34
next
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    35
  case False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    36
  show ?thesis
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    37
    apply (rule divide_nonneg_pos)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    38
    using assms False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    39
    apply auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    40
    done
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    41
qed
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    42
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    43
lemma brouwer_compactness_lemma:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56188
diff changeset
    44
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    45
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    46
    and "continuous_on s f"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
    47
    and "\<not> (\<exists>x\<in>s. f x = 0)"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    48
  obtains d where "0 < d" and "\<forall>x\<in>s. d \<le> norm (f x)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    49
proof (cases "s = {}")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    50
  case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
    51
  show thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
    52
    by (rule that [of 1]) (auto simp: True)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    53
next
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    54
  case False
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    55
  have "continuous_on s (norm \<circ> f)"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    56
    by (rule continuous_on_intros continuous_on_norm assms(2))+
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    57
  with False obtain x where x: "x \<in> s" "\<forall>y\<in>s. (norm \<circ> f) x \<le> (norm \<circ> f) y"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    58
    using continuous_attains_inf[OF assms(1), of "norm \<circ> f"]
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    59
    unfolding o_def
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    60
    by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    61
  have "(norm \<circ> f) x > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    62
    using assms(3) and x(1)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    63
    by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    64
  then show ?thesis
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    65
    by (rule that) (insert x(2), auto simp: o_def)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    66
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    67
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    68
lemma kuhn_labelling_lemma:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    69
  fixes P Q :: "'a::euclidean_space \<Rightarrow> bool"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    70
  assumes "(\<forall>x. P x \<longrightarrow> P (f x))"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    71
    and "\<forall>x. P x \<longrightarrow> (\<forall>i\<in>Basis. Q i \<longrightarrow> 0 \<le> x\<bullet>i \<and> x\<bullet>i \<le> 1)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    72
  shows "\<exists>l. (\<forall>x.\<forall>i\<in>Basis. l x i \<le> (1::nat)) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    73
             (\<forall>x.\<forall>i\<in>Basis. P x \<and> Q i \<and> (x\<bullet>i = 0) \<longrightarrow> (l x i = 0)) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    74
             (\<forall>x.\<forall>i\<in>Basis. P x \<and> Q i \<and> (x\<bullet>i = 1) \<longrightarrow> (l x i = 1)) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    75
             (\<forall>x.\<forall>i\<in>Basis. P x \<and> Q i \<and> (l x i = 0) \<longrightarrow> x\<bullet>i \<le> f(x)\<bullet>i) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    76
             (\<forall>x.\<forall>i\<in>Basis. P x \<and> Q i \<and> (l x i = 1) \<longrightarrow> f(x)\<bullet>i \<le> x\<bullet>i)"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    77
proof -
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    78
  have and_forall_thm:"\<And>P Q. (\<forall>x. P x) \<and> (\<forall>x. Q x) \<longleftrightarrow> (\<forall>x. P x \<and> Q x)"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    79
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    80
  have *: "\<forall>x y::real. 0 \<le> x \<and> x \<le> 1 \<and> 0 \<le> y \<and> y \<le> 1 \<longrightarrow> (x \<noteq> 1 \<and> x \<le> y \<or> x \<noteq> 0 \<and> y \<le> x)"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    81
    by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    82
  show ?thesis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    83
    unfolding and_forall_thm Ball_def
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    84
    apply (subst choice_iff[symmetric])+
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    85
    apply rule
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    86
    apply rule
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    87
  proof -
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    88
    case (goal1 x)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    89
    let ?R = "\<lambda>y. (P x \<and> Q xa \<and> x \<bullet> xa = 0 \<longrightarrow> y = (0::nat)) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    90
        (P x \<and> Q xa \<and> x \<bullet> xa = 1 \<longrightarrow> y = 1) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    91
        (P x \<and> Q xa \<and> y = 0 \<longrightarrow> x \<bullet> xa \<le> f x \<bullet> xa) \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    92
        (P x \<and> Q xa \<and> y = 1 \<longrightarrow> f x \<bullet> xa \<le> x \<bullet> xa)"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    93
    {
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
    94
      assume "P x" "Q xa" "xa \<in> Basis"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
    95
      then have "0 \<le> f x \<bullet> xa \<and> f x \<bullet> xa \<le> 1"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    96
        using assms(2)[rule_format,of "f x" xa]
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    97
        apply (drule_tac assms(1)[rule_format])
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    98
        apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    99
        done
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   100
    }
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   101
    then have "xa \<in> Basis \<Longrightarrow> ?R 0 \<or> ?R 1" by auto
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   102
    then show ?case by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   103
  qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   104
qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   105
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   106
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   107
subsection {* The key "counting" observation, somewhat abstracted. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   108
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   109
lemma setsum_Un_disjoint':
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   110
  assumes "finite A"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   111
    and "finite B"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   112
    and "A \<inter> B = {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   113
    and "A \<union> B = C"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   114
  shows "setsum g C = setsum g A + setsum g B"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   115
  using setsum_Un_disjoint[OF assms(1-3)] and assms(4) by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   116
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   117
lemma kuhn_counting_lemma:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   118
  assumes "finite faces"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   119
    and "finite simplices"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   120
    and "\<forall>f\<in>faces. bnd f \<longrightarrow> (card {s \<in> simplices. face f s} = 1)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   121
    and "\<forall>f\<in>faces. \<not> bnd f \<longrightarrow> (card {s \<in> simplices. face f s} = 2)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   122
    and "\<forall>s\<in>simplices. compo s \<longrightarrow> (card {f \<in> faces. face f s \<and> compo' f} = 1)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   123
    and "\<forall>s\<in>simplices. \<not> compo s \<longrightarrow>
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   124
      (card {f \<in> faces. face f s \<and> compo' f} = 0) \<or> (card {f \<in> faces. face f s \<and> compo' f} = 2)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   125
    and "odd(card {f \<in> faces. compo' f \<and> bnd f})"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   126
  shows "odd(card {s \<in> simplices. compo s})"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   127
proof -
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   128
  have "\<And>x. {f\<in>faces. compo' f \<and> bnd f \<and> face f x} \<union> {f\<in>faces. compo' f \<and> \<not>bnd f \<and> face f x} =
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   129
      {f\<in>faces. compo' f \<and> face f x}"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   130
    "\<And>x. {f \<in> faces. compo' f \<and> bnd f \<and> face f x} \<inter> {f \<in> faces. compo' f \<and> \<not> bnd f \<and> face f x} = {}"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   131
    by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   132
  then have lem1: "setsum (\<lambda>s. (card {f \<in> faces. face f s \<and> compo' f})) simplices =
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   133
      setsum (\<lambda>s. card {f \<in> {f \<in> faces. compo' f \<and> bnd f}. face f s}) simplices +
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   134
      setsum (\<lambda>s. card {f \<in> {f \<in> faces. compo' f \<and> \<not> (bnd f)}. face f s}) simplices"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   135
    unfolding setsum_addf[symmetric]
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   136
    apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   137
    apply (rule setsum_cong2)
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   138
    using assms(1)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   139
    apply (auto simp add: card_Un_Int, auto simp add:conj_commute)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   140
    done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   141
  have lem2:
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   142
    "setsum (\<lambda>j. card {f \<in> {f \<in> faces. compo' f \<and> bnd f}. face f j}) simplices =
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   143
      1 * card {f \<in> faces. compo' f \<and> bnd f}"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   144
    "setsum (\<lambda>j. card {f \<in> {f \<in> faces. compo' f \<and> \<not> bnd f}. face f j}) simplices =
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   145
      2 * card {f \<in> faces. compo' f \<and> \<not> bnd f}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   146
    apply (rule_tac[!] setsum_multicount)
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   147
    using assms
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   148
    apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   149
    done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   150
  have lem3:
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   151
    "setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f}) simplices =
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   152
      setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f}) {s \<in> simplices.   compo s}+
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   153
      setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f}) {s \<in> simplices. \<not> compo s}"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   154
    apply (rule setsum_Un_disjoint')
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   155
    using assms(2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   156
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   157
    done
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   158
  have lem4: "setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f}) {s \<in> simplices. compo s} =
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   159
    setsum (\<lambda>s. 1) {s \<in> simplices. compo s}"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   160
    apply (rule setsum_cong2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   161
    using assms(5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   162
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   163
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   164
  have lem5: "setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f}) {s \<in> simplices. \<not> compo s} =
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   165
    setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f})
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   166
           {s \<in> simplices. (\<not> compo s) \<and> (card {f \<in> faces. face f s \<and> compo' f} = 0)} +
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   167
    setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f})
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   168
           {s \<in> simplices. (\<not> compo s) \<and> (card {f \<in> faces. face f s \<and> compo' f} = 2)}"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   169
    apply (rule setsum_Un_disjoint')
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   170
    using assms(2,6)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   171
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   172
    done
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   173
  have *: "int (\<Sum>s\<in>{s \<in> simplices. compo s}. card {f \<in> faces. face f s \<and> compo' f}) =
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   174
    int (card {f \<in> faces. compo' f \<and> bnd f} + 2 * card {f \<in> faces. compo' f \<and> \<not> bnd f}) -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   175
    int (card {s \<in> simplices. \<not> compo s \<and> card {f \<in> faces. face f s \<and> compo' f} = 2} * 2)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   176
    using lem1[unfolded lem3 lem2 lem5] by auto
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   177
  have even_minus_odd:"\<And>x y. even x \<Longrightarrow> odd (y::int) \<Longrightarrow> odd (x - y)"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   178
    using assms by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   179
  have odd_minus_even:"\<And>x y. odd x \<Longrightarrow> even (y::int) \<Longrightarrow> odd (x - y)"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   180
    using assms by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   181
  show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   182
    unfolding even_nat_def card_eq_setsum and lem4[symmetric] and *[unfolded card_eq_setsum]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   183
    unfolding card_eq_setsum[symmetric]
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   184
    apply (rule odd_minus_even)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   185
    unfolding of_nat_add
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   186
    apply(rule odd_plus_even)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   187
    apply(rule assms(7)[unfolded even_nat_def])
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   188
    unfolding int_mult
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   189
    apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   190
    done
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   191
qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   192
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   193
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   194
subsection {* The odd/even result for faces of complete vertices, generalized. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   195
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   196
lemma card_1_exists: "card s = 1 \<longleftrightarrow> (\<exists>!x. x \<in> s)"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   197
  unfolding One_nat_def
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   198
  apply rule
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   199
  apply (drule card_eq_SucD)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   200
  defer
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   201
  apply (erule ex1E)
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   202
proof -
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   203
  fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   204
  assume as: "x \<in> s" "\<forall>y. y \<in> s \<longrightarrow> y = x"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   205
  have *: "s = insert x {}"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   206
    apply (rule set_eqI, rule) unfolding singleton_iff
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   207
    apply (rule as(2)[rule_format]) using as(1)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   208
    apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   209
    done
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   210
  show "card s = Suc 0"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   211
    unfolding * using card_insert by auto
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   212
qed auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   213
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   214
lemma card_2_exists: "card s = 2 \<longleftrightarrow> (\<exists>x\<in>s. \<exists>y\<in>s. x \<noteq> y \<and> (\<forall>z\<in>s. z = x \<or> z = y))"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   215
proof
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   216
  assume "card s = 2"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   217
  then obtain x y where s: "s = {x, y}" "x \<noteq> y"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   218
    unfolding numeral_2_eq_2
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   219
    apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   220
    apply (erule exE conjE | drule card_eq_SucD)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   221
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   222
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   223
  show "\<exists>x\<in>s. \<exists>y\<in>s. x \<noteq> y \<and> (\<forall>z\<in>s. z = x \<or> z = y)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   224
    using s by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   225
next
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   226
  assume "\<exists>x\<in>s. \<exists>y\<in>s. x \<noteq> y \<and> (\<forall>z\<in>s. z = x \<or> z = y)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   227
  then obtain x y where "x \<in> s" "y \<in> s" "x \<noteq> y" "\<forall>z\<in>s. z = x \<or> z = y"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   228
    by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   229
  then have "s = {x, y}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   230
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   231
  with `x \<noteq> y` show "card s = 2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   232
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   233
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   234
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   235
lemma image_lemma_0:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   236
  assumes "card {a\<in>s. f ` (s - {a}) = t - {b}} = n"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   237
  shows "card {s'. \<exists>a\<in>s. (s' = s - {a}) \<and> (f ` s' = t - {b})} = n"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   238
proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   239
  have *: "{s'. \<exists>a\<in>s. (s' = s - {a}) \<and> (f ` s' = t - {b})} =
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   240
    (\<lambda>a. s - {a}) ` {a\<in>s. f ` (s - {a}) = t - {b}}"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   241
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   242
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   243
    unfolding *
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   244
    unfolding assms[symmetric]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   245
    apply (rule card_image)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   246
    unfolding inj_on_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   247
    apply (rule, rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   248
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   249
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   250
    done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   251
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   252
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   253
lemma image_lemma_1:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   254
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   255
    and "finite t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   256
    and "card s = card t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   257
    and "f ` s = t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   258
    and "b \<in> t"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   259
  shows "card {s'. \<exists>a\<in>s. s' = s - {a} \<and>  f ` s' = t - {b}} = 1"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   260
proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   261
  obtain a where a: "b = f a" "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   262
    using assms(4-5) by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   263
  have inj: "inj_on f s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   264
    apply (rule eq_card_imp_inj_on)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   265
    using assms(1-4)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   266
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   267
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   268
  have *: "{a \<in> s. f ` (s - {a}) = t - {b}} = {a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   269
    apply (rule set_eqI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   270
    unfolding singleton_iff
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   271
    apply (rule, rule inj[unfolded inj_on_def, rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   272
    unfolding a
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   273
    using a(2) and assms and inj[unfolded inj_on_def]
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   274
    apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   275
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   276
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   277
    apply (rule image_lemma_0)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   278
    unfolding *
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   279
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   280
    done
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   281
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   282
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   283
lemma image_lemma_2:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   284
  assumes "finite s" "finite t" "card s = card t" "f ` s \<subseteq> t" "f ` s \<noteq> t" "b \<in> t"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   285
  shows "card {s'. \<exists>a\<in>s. (s' = s - {a}) \<and> f ` s' = t - {b}} = 0 \<or>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   286
         card {s'. \<exists>a\<in>s. (s' = s - {a}) \<and> f ` s' = t - {b}} = 2"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   287
proof (cases "{a\<in>s. f ` (s - {a}) = t - {b}} = {}")
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   288
  case True
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   289
  then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   290
    apply -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   291
    apply (rule disjI1, rule image_lemma_0)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   292
    using assms(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   293
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   294
    done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   295
next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   296
  let ?M = "{a\<in>s. f ` (s - {a}) = t - {b}}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   297
  case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   298
  then obtain a where "a \<in> ?M"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   299
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   300
  then have a: "a \<in> s" "f ` (s - {a}) = t - {b}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   301
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   302
  have "f a \<in> t - {b}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   303
    using a and assms by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   304
  then have "\<exists>c \<in> s - {a}. f a = f c"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   305
    unfolding image_iff[symmetric] and a
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   306
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   307
  then obtain c where c: "c \<in> s" "a \<noteq> c" "f a = f c"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   308
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   309
  then have *: "f ` (s - {c}) = f ` (s - {a})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   310
    apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   311
    apply (rule set_eqI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   312
    apply rule
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   313
  proof -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   314
    fix x
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   315
    assume "x \<in> f ` (s - {a})"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   316
    then obtain y where y: "f y = x" "y \<in> s - {a}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   317
      by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   318
    then show "x \<in> f ` (s - {c})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   319
      unfolding image_iff
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   320
      apply (rule_tac x = "if y = c then a else y" in bexI)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   321
      using c a
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   322
      apply auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   323
      done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   324
  qed auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   325
  have "c \<in> ?M"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   326
    unfolding mem_Collect_eq and *
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   327
    using a and c(1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   328
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   329
  show ?thesis
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   330
    apply (rule disjI2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   331
    apply (rule image_lemma_0)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   332
    unfolding card_2_exists
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   333
    apply (rule bexI[OF _ `a\<in>?M`])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   334
    apply (rule bexI[OF _ `c\<in>?M`])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   335
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   336
    apply (rule `a \<noteq> c`)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   337
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   338
    apply (unfold mem_Collect_eq)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   339
    apply (erule conjE)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   340
  proof -
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   341
    fix z
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   342
    assume as: "z \<in> s" "f ` (s - {z}) = t - {b}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   343
    have inj: "inj_on f (s - {z})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   344
      apply (rule eq_card_imp_inj_on)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   345
      unfolding as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   346
      using as(1) and assms
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   347
      apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   348
      done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   349
    show "z = a \<or> z = c"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   350
    proof (rule ccontr)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   351
      assume "\<not> ?thesis"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   352
      then show False
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   353
        using inj[unfolded inj_on_def, THEN bspec[where x=a], THEN bspec[where x=c]]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   354
        using `a \<in> s` `c \<in> s` `f a = f c` `a \<noteq> c`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   355
        apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   356
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   357
    qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   358
  qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   359
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   360
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   361
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   362
subsection {* Combine this with the basic counting lemma. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   363
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   364
lemma kuhn_complete_lemma:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   365
  assumes "finite simplices"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   366
    and "\<forall>f s. face f s \<longleftrightarrow> (\<exists>a\<in>s. f = s - {a})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   367
    and "\<forall>s\<in>simplices. card s = n + 2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   368
    and "\<forall>s\<in>simplices. (rl ` s) \<subseteq> {0..n+1}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   369
    and "\<forall>f\<in>{f. \<exists>s\<in>simplices. face f s}. bnd f  \<longrightarrow> card {s\<in>simplices. face f s} = 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   370
    and "\<forall>f\<in>{f. \<exists>s\<in>simplices. face f s}. \<not> bnd f \<longrightarrow> card {s\<in>simplices. face f s} = 2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   371
    and "odd (card {f\<in>{f. \<exists>s\<in>simplices. face f s}. rl ` f = {0..n} \<and> bnd f})"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   372
  shows "odd (card {s\<in>simplices. (rl ` s = {0..n+1})})"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   373
  apply (rule kuhn_counting_lemma)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   374
  defer
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   375
  apply (rule assms)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   376
  prefer 3
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   377
  apply (rule assms)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   378
  apply (rule_tac[1-2] ballI impI)+
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   379
proof -
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   380
  have *: "{f. \<exists>s\<in>simplices. \<exists>a\<in>s. f = s - {a}} = (\<Union>s\<in>simplices. {f. \<exists>a\<in>s. (f = s - {a})})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   381
    by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   382
  have **: "\<forall>s\<in>simplices. card s = n + 2 \<and> finite s"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   383
    using assms(3) by (auto intro: card_ge_0_finite)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   384
  show "finite {f. \<exists>s\<in>simplices. face f s}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   385
    unfolding assms(2)[rule_format] and *
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   386
    apply (rule finite_UN_I[OF assms(1)])
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   387
    using **
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   388
    apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   389
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   390
  have *: "\<And>P f s. s\<in>simplices \<Longrightarrow> (f \<in> {f. \<exists>s\<in>simplices. \<exists>a\<in>s. f = s - {a}}) \<and>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   391
    (\<exists>a\<in>s. (f = s - {a})) \<and> P f \<longleftrightarrow> (\<exists>a\<in>s. (f = s - {a}) \<and> P f)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   392
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   393
  fix s
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   394
  assume s: "s \<in> simplices"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   395
  let ?S = "{f \<in> {f. \<exists>s\<in>simplices. face f s}. face f s \<and> rl ` f = {0..n}}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   396
  have "{0..n + 1} - {n + 1} = {0..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   397
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   398
  then have S: "?S = {s'. \<exists>a\<in>s. s' = s - {a} \<and> rl ` s' = {0..n + 1} - {n + 1}}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   399
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   400
    apply (rule set_eqI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   401
    unfolding assms(2)[rule_format] mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   402
    unfolding *[OF s, unfolded mem_Collect_eq, where P="\<lambda>x. rl ` x = {0..n}"]
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   403
    apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   404
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   405
  show "rl ` s = {0..n+1} \<Longrightarrow> card ?S = 1" and "rl ` s \<noteq> {0..n+1} \<Longrightarrow> card ?S = 0 \<or> card ?S = 2"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   406
    unfolding S
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   407
    apply (rule_tac[!] image_lemma_1 image_lemma_2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   408
    using ** assms(4) and s
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   409
    apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   410
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   411
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   412
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   413
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   414
subsection {*We use the following notion of ordering rather than pointwise indexing. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   415
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   416
definition "kle n x y \<longleftrightarrow> (\<exists>k\<subseteq>{1..n::nat}. \<forall>j. y j = x j + (if j \<in> k then (1::nat) else 0))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   417
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   418
lemma kle_refl [intro]: "kle n x x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   419
  unfolding kle_def by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   420
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   421
lemma kle_antisym: "kle n x y \<and> kle n y x \<longleftrightarrow> x = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   422
  unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   423
  apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   424
  apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   425
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   426
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   427
lemma pointwise_minimal_pointwise_maximal:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   428
  fixes s :: "(nat \<Rightarrow> nat) set"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   429
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   430
    and "s \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   431
    and "\<forall>x\<in>s. \<forall>y\<in>s. (\<forall>j. x j \<le> y j) \<or> (\<forall>j. y j \<le> x j)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   432
  shows "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. a j \<le> x j"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   433
    and "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. x j \<le> a j"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   434
  using assms
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   435
  unfolding atomize_conj
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   436
proof (induct s rule: finite_induct)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   437
  fix x
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   438
  fix F :: "(nat \<Rightarrow> nat) set"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   439
  assume as: "finite F" "x \<notin> F"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   440
    "\<lbrakk>F \<noteq> {}; \<forall>x\<in>F. \<forall>y\<in>F. (\<forall>j. x j \<le> y j) \<or> (\<forall>j. y j \<le> x j)\<rbrakk>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   441
        \<Longrightarrow> (\<exists>a\<in>F. \<forall>x\<in>F. \<forall>j. a j \<le> x j) \<and> (\<exists>a\<in>F. \<forall>x\<in>F. \<forall>j. x j \<le> a j)" "insert x F \<noteq> {}"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   442
    "\<forall>xa\<in>insert x F. \<forall>y\<in>insert x F. (\<forall>j. xa j \<le> y j) \<or> (\<forall>j. y j \<le> xa j)"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   443
  show "(\<exists>a\<in>insert x F. \<forall>x\<in>insert x F. \<forall>j. a j \<le> x j) \<and> (\<exists>a\<in>insert x F. \<forall>x\<in>insert x F. \<forall>j. x j \<le> a j)"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   444
  proof (cases "F = {}")
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   445
    case True
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   446
    then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   447
      apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   448
      apply (rule, rule_tac[!] x=x in bexI)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   449
      apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   450
      done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   451
  next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   452
    case False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   453
    obtain a b where a: "a\<in>insert x F" "\<forall>x\<in>F. \<forall>j. a j \<le> x j"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   454
      and b: "b \<in> insert x F" "\<forall>x\<in>F. \<forall>j. x j \<le> b j"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   455
      using as(3)[OF False] using as(5) by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   456
    have "\<exists>a \<in> insert x F. \<forall>x \<in> insert x F. \<forall>j. a j \<le> x j"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   457
      using as(5)[rule_format,OF a(1) insertI1]
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   458
      apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   459
    proof (erule disjE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   460
      assume "\<forall>j. a j \<le> x j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   461
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   462
        apply (rule_tac x=a in bexI)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   463
        using a
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   464
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   465
        done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   466
    next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   467
      assume "\<forall>j. x j \<le> a j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   468
      then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   469
        apply (rule_tac x=x in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   470
        apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   471
        apply (insert a)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   472
        apply (erule_tac x=xa in ballE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   473
        apply (erule_tac x=j in allE)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   474
        apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   475
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   476
    qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   477
    moreover
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   478
    have "\<exists>b\<in>insert x F. \<forall>x\<in>insert x F. \<forall>j. x j \<le> b j"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   479
      using as(5)[rule_format,OF b(1) insertI1]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   480
      apply -
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   481
    proof (erule disjE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   482
      assume "\<forall>j. x j \<le> b j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   483
      then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   484
        apply(rule_tac x=b in bexI) using b
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   485
        apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   486
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   487
    next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   488
      assume "\<forall>j. b j \<le> x j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   489
      then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   490
        apply (rule_tac x=x in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   491
        apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   492
        apply (insert b)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   493
        apply (erule_tac x=xa in ballE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   494
        apply (erule_tac x=j in allE)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   495
        apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   496
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   497
    qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   498
    ultimately show ?thesis by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   499
  qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   500
qed auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   501
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   502
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   503
lemma kle_imp_pointwise: "kle n x y \<Longrightarrow> \<forall>j. x j \<le> y j"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   504
  unfolding kle_def by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   505
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   506
lemma pointwise_antisym:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   507
  fixes x :: "nat \<Rightarrow> nat"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   508
  shows "(\<forall>j. x j \<le> y j) \<and> (\<forall>j. y j \<le> x j) \<longleftrightarrow> x = y"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   509
  apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   510
  apply (rule ext)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   511
  apply (erule conjE)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   512
  apply (erule_tac x = xa in allE)+
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   513
  apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   514
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   515
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   516
lemma kle_trans:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   517
  assumes "kle n x y"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   518
    and "kle n y z"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   519
    and "kle n x z \<or> kle n z x"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   520
  shows "kle n x z"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   521
  using assms
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   522
  apply -
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   523
  apply (erule disjE)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   524
  apply assumption
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   525
proof -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   526
  case goal1
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   527
  then have "x = z"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   528
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   529
    apply (rule ext)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   530
    apply (drule kle_imp_pointwise)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   531
    apply (erule_tac x=xa in allE)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   532
    apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   533
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   534
  then show ?case by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   535
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   536
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   537
lemma kle_strict:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   538
  assumes "kle n x y"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   539
    and "x \<noteq> y"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   540
  shows "\<forall>j. x j \<le> y j"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   541
    and "\<exists>k. 1 \<le> k \<and> k \<le> n \<and> x k < y k"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   542
  apply (rule kle_imp_pointwise[OF assms(1)])
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   543
proof -
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   544
  obtain k where k: "k \<subseteq> {1..n} \<and> (\<forall>j. y j = x j + (if j \<in> k then 1 else 0))"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   545
    using assms(1)[unfolded kle_def] ..
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   546
  show "\<exists>k. 1 \<le> k \<and> k \<le> n \<and> x k < y k"
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   547
  proof (cases "k = {}")
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   548
    case True
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   549
    then have "x = y"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   550
      apply -
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   551
      apply (rule ext)
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   552
      using k
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   553
      apply auto
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   554
      done
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   555
    then show ?thesis
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   556
      using assms(2) by auto
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   557
  next
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   558
    case False
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   559
    then have "(SOME k'. k' \<in> k) \<in> k"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   560
      apply -
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   561
      apply (rule someI_ex)
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   562
      apply auto
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   563
      done
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   564
    then show ?thesis
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   565
      apply (rule_tac x = "SOME k'. k' \<in> k" in exI)
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   566
      using k
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   567
      apply auto
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   568
      done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   569
  qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   570
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   571
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   572
lemma kle_minimal:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   573
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   574
    and "s \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   575
    and "\<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   576
  shows "\<exists>a\<in>s. \<forall>x\<in>s. kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   577
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   578
  have "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. a j \<le> x j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   579
    apply (rule pointwise_minimal_pointwise_maximal(1)[OF assms(1-2)])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   580
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   581
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   582
    apply (drule_tac assms(3)[rule_format])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   583
    apply assumption
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   584
    using kle_imp_pointwise
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   585
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   586
    done
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   587
  then obtain a where a: "a \<in> s" "\<forall>x\<in>s. \<forall>j. a j \<le> x j" ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   588
  show ?thesis
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   589
    apply (rule_tac x = a in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   590
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   591
    fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   592
    assume "x \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   593
    show "kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   594
      using assms(3)[rule_format,OF a(1) `x\<in>s`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   595
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   596
    proof (erule disjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   597
      assume "kle n x a"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   598
      then have "x = a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   599
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   600
        unfolding pointwise_antisym[symmetric]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   601
        apply (drule kle_imp_pointwise)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   602
        using a(2)[rule_format,OF `x\<in>s`]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   603
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   604
        done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   605
      then show ?thesis using kle_refl by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   606
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   607
  qed (insert a, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   608
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   609
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   610
lemma kle_maximal:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   611
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   612
    and "s \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   613
    and "\<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   614
  shows "\<exists>a\<in>s. \<forall>x\<in>s. kle n x a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   615
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   616
  have "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. a j \<ge> x j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   617
    apply (rule pointwise_minimal_pointwise_maximal(2)[OF assms(1-2)])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   618
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   619
    apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   620
    apply (drule_tac assms(3)[rule_format],assumption)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   621
    using kle_imp_pointwise
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   622
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   623
    done
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   624
  then obtain a where a: "a \<in> s" "\<forall>x\<in>s. \<forall>j. x j \<le> a j" ..
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
   625
  show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   626
    apply (rule_tac x = a in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   627
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   628
    fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   629
    assume "x \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   630
    show "kle n x a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   631
      using assms(3)[rule_format,OF a(1) `x\<in>s`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   632
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   633
    proof (erule disjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   634
      assume "kle n a x"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   635
      then have "x = a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   636
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   637
        unfolding pointwise_antisym[symmetric]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   638
        apply (drule kle_imp_pointwise)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   639
        using a(2)[rule_format,OF `x\<in>s`]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   640
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   641
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   642
      then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   643
        using kle_refl by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   644
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   645
  qed (insert a, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   646
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   647
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   648
lemma kle_strict_set:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   649
  assumes "kle n x y"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   650
    and "x \<noteq> y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   651
  shows "1 \<le> card {k\<in>{1..n}. x k < y k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   652
proof -
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   653
  obtain i where "1 \<le> i" "i \<le> n" "x i < y i"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   654
    using kle_strict(2)[OF assms] by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   655
  then have "card {i} \<le> card {k\<in>{1..n}. x k < y k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   656
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   657
    apply (rule card_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   658
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   659
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   660
  then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   661
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   662
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   663
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   664
lemma kle_range_combine:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   665
  assumes "kle n x y"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   666
    and "kle n y z"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   667
    and "kle n x z \<or> kle n z x"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   668
    and "m1 \<le> card {k\<in>{1..n}. x k < y k}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   669
    and "m2 \<le> card {k\<in>{1..n}. y k < z k}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   670
  shows "kle n x z \<and> m1 + m2 \<le> card {k\<in>{1..n}. x k < z k}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   671
  apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   672
  apply (rule kle_trans[OF assms(1-3)])
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   673
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   674
  have "\<And>j. x j < y j \<Longrightarrow> x j < z j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   675
    apply (rule less_le_trans)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   676
    using kle_imp_pointwise[OF assms(2)]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   677
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   678
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   679
  moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   680
  have "\<And>j. y j < z j \<Longrightarrow> x j < z j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   681
    apply (rule le_less_trans)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   682
    using kle_imp_pointwise[OF assms(1)]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   683
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   684
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   685
  ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   686
  have *: "{k\<in>{1..n}. x k < y k} \<union> {k\<in>{1..n}. y k < z k} = {k\<in>{1..n}. x k < z k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   687
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   688
  have **: "{k \<in> {1..n}. x k < y k} \<inter> {k \<in> {1..n}. y k < z k} = {}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   689
    unfolding disjoint_iff_not_equal
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   690
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   691
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   692
    apply (unfold mem_Collect_eq)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   693
    apply (rule notI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   694
    apply (erule conjE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   695
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   696
    fix i j
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   697
    assume as: "i \<in> {1..n}" "x i < y i" "j \<in> {1..n}" "y j < z j" "i = j"
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   698
    obtain kx where kx: "kx \<subseteq> {1..n} \<and> (\<forall>j. y j = x j + (if j \<in> kx then 1 else 0))"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   699
      using assms(1)[unfolded kle_def] ..
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   700
    have "x i < y i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   701
      using as by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   702
    then have "i \<in> kx"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   703
      using as(1) kx
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   704
      apply -
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   705
      apply (rule ccontr)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   706
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   707
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   708
    then have "x i + 1 = y i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   709
      using kx by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   710
    moreover
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   711
    obtain ky where ky: "ky \<subseteq> {1..n} \<and> (\<forall>j. z j = y j + (if j \<in> ky then 1 else 0))"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   712
      using assms(2)[unfolded kle_def] ..
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   713
    have "y i < z i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   714
      using as by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   715
    then have "i \<in> ky"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   716
      using as(1) ky
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   717
      apply -
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   718
      apply (rule ccontr)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   719
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   720
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   721
    then have "y i + 1 = z i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   722
      using ky by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   723
    ultimately
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   724
    have "z i = x i + 2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   725
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   726
    then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   727
      using assms(3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   728
      unfolding kle_def
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   729
      by (auto simp add: split_if_eq1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   730
  qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   731
  have fin: "\<And>P. finite {x\<in>{1..n::nat}. P x}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   732
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   733
  have "m1 + m2 \<le> card {k\<in>{1..n}. x k < y k} + card {k\<in>{1..n}. y k < z k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   734
    using assms(4-5) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   735
  also have "\<dots> \<le> card {k\<in>{1..n}. x k < z k}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   736
    unfolding card_Un_Int[OF fin fin]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   737
    unfolding * **
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   738
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   739
  finally show "m1 + m2 \<le> card {k \<in> {1..n}. x k < z k}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   740
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   741
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   742
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   743
lemma kle_range_combine_l:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   744
  assumes "kle n x y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   745
    and "kle n y z"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   746
    and "kle n x z \<or> kle n z x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   747
    and "m \<le> card {k\<in>{1..n}. y(k) < z(k)}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   748
  shows "kle n x z \<and> m \<le> card {k\<in>{1..n}. x(k) < z(k)}"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   749
  using kle_range_combine[OF assms(1-3) _ assms(4), of 0] by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   750
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   751
lemma kle_range_combine_r:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   752
  assumes "kle n x y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   753
    and "kle n y z"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   754
    and "kle n x z \<or> kle n z x" "m \<le> card {k\<in>{1..n}. x k < y k}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   755
  shows "kle n x z \<and> m \<le> card {k\<in>{1..n}. x(k) < z(k)}"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   756
  using kle_range_combine[OF assms(1-3) assms(4), of 0] by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   757
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   758
lemma kle_range_induct:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   759
  assumes "card s = Suc m"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   760
    and "\<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   761
  shows "\<exists>x\<in>s. \<exists>y\<in>s. kle n x y \<and> m \<le> card {k\<in>{1..n}. x k < y k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   762
proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   763
  have "finite s" and "s \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   764
    using assms(1)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   765
    by (auto intro: card_ge_0_finite)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   766
  then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   767
    using assms
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   768
  proof (induct m arbitrary: s)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   769
    case 0
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   770
    then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   771
      using kle_refl by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   772
  next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   773
    case (Suc m)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   774
    then obtain a where a: "a \<in> s" "\<forall>x\<in>s. kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   775
      using kle_minimal[of s n] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   776
    show ?case
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   777
    proof (cases "s \<subseteq> {a}")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   778
      case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   779
      then have "card (s - {a}) = Suc m" and "s - {a} \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   780
        using card_Diff_singleton[OF _ a(1)] Suc(4) `finite s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   781
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   782
      then obtain x b where xb:
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   783
        "x \<in> s - {a}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   784
        "b \<in> s - {a}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   785
        "kle n x b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   786
        "m \<le> card {k \<in> {1..n}. x k < b k}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   787
        using Suc(1)[of "s - {a}"]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   788
        using Suc(5) `finite s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   789
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   790
      have "1 \<le> card {k \<in> {1..n}. a k < x k}" and "m \<le> card {k \<in> {1..n}. x k < b k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   791
        apply (rule kle_strict_set)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   792
        apply (rule a(2)[rule_format])
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   793
        using a and xb
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   794
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   795
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   796
      then show ?thesis
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   797
        apply (rule_tac x=a in bexI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   798
        apply (rule_tac x=b in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   799
        using kle_range_combine[OF a(2)[rule_format] xb(3) Suc(5)[rule_format], of 1 "m"]
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   800
        using a(1) xb(1-2)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   801
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   802
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   803
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   804
      case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   805
      then have "s = {a}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   806
        using Suc(3) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   807
      then have "card s = 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   808
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   809
      then have False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   810
        using Suc(4) `finite s` by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   811
      then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   812
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   813
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   814
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   815
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   816
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   817
lemma kle_Suc: "kle n x y \<Longrightarrow> kle (n + 1) x y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   818
  unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   819
  apply (erule exE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   820
  apply (rule_tac x=k in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   821
  apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   822
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   823
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   824
lemma kle_trans_1:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   825
  assumes "kle n x y"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   826
  shows "x j \<le> y j"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   827
    and "y j \<le> x j + 1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   828
  using assms[unfolded kle_def] by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   829
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   830
lemma kle_trans_2:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   831
  assumes "kle n a b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   832
    and "kle n b c"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   833
    and "\<forall>j. c j \<le> a j + 1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   834
  shows "kle n a c"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   835
proof -
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   836
  obtain kk1 where kk1: "kk1 \<subseteq> {1..n} \<and> (\<forall>j. b j = a j + (if j \<in> kk1 then 1 else 0))"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   837
    using assms(1)[unfolded kle_def] ..
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   838
  obtain kk2 where kk2: "kk2 \<subseteq> {1..n} \<and> (\<forall>j. c j = b j + (if j \<in> kk2 then 1 else 0))"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
   839
    using assms(2)[unfolded kle_def] ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   840
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   841
    unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   842
    apply (rule_tac x="kk1 \<union> kk2" in exI)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   843
    apply rule
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   844
    defer
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   845
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   846
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   847
    show "c i = a i + (if i \<in> kk1 \<union> kk2 then 1 else 0)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   848
    proof (cases "i \<in> kk1 \<union> kk2")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   849
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   850
      then have "c i \<ge> a i + (if i \<in> kk1 \<union> kk2 then 1 else 0)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   851
        unfolding kk1[THEN conjunct2,rule_format,of i] kk2[THEN conjunct2,rule_format,of i]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   852
        by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   853
      moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   854
      have "c i \<le> a i + (if i \<in> kk1 \<union> kk2 then 1 else 0)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   855
        using True assms(3) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   856
      ultimately show ?thesis by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   857
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   858
      case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   859
      then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   860
        using kk1 kk2 by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   861
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   862
  qed (insert kk1 kk2, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   863
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   864
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   865
lemma kle_between_r:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   866
  assumes "kle n a b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   867
    and "kle n b c"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   868
    and "kle n a x"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   869
    and "kle n c x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   870
  shows "kle n b x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   871
  apply (rule kle_trans_2[OF assms(2,4)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   872
proof
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   873
  have *: "\<And>c b x::nat. x \<le> c + 1 \<Longrightarrow> c \<le> b \<Longrightarrow> x \<le> b + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   874
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   875
  fix j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   876
  show "x j \<le> b j + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   877
    apply (rule *)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   878
    using kle_trans_1[OF assms(1),of j] kle_trans_1[OF assms(3), of j]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   879
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   880
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   881
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   882
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   883
lemma kle_between_l:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   884
  assumes "kle n a b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   885
    and "kle n b c"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   886
    and "kle n x a"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   887
    and "kle n x c"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   888
  shows "kle n x b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   889
  apply (rule kle_trans_2[OF assms(3,1)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   890
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   891
  have *: "\<And>c b x::nat. c \<le> x + 1 \<Longrightarrow> b \<le> c \<Longrightarrow> b \<le> x + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   892
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   893
  fix j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   894
  show "b j \<le> x j + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   895
    apply (rule *)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   896
    using kle_trans_1[OF assms(2),of j] kle_trans_1[OF assms(4), of j]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   897
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   898
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   899
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   900
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   901
lemma kle_adjacent:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   902
  assumes "\<forall>j. b j = (if j = k then a(j) + 1 else a j)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   903
    and "kle n a x"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   904
    and "kle n x b"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   905
  shows "x = a \<or> x = b"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   906
proof (cases "x k = a k")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   907
  case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   908
  show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   909
    apply (rule disjI1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   910
    apply (rule ext)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   911
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   912
    fix j
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   913
    have "x j \<le> a j"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   914
      using kle_imp_pointwise[OF assms(3),THEN spec[where x=j]]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   915
      unfolding assms(1)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   916
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   917
      apply(cases "j = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   918
      using True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   919
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   920
      done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   921
    then show "x j = a j"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   922
      using kle_imp_pointwise[OF assms(2),THEN spec[where x=j]]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   923
      by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   924
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   925
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   926
  case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   927
  show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   928
    apply (rule disjI2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   929
    apply (rule ext)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   930
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   931
    fix j
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   932
    have "x j \<ge> b j"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   933
      using kle_imp_pointwise[OF assms(2),THEN spec[where x=j]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   934
      unfolding assms(1)[rule_format]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   935
      apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   936
      apply (cases "j = k")
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   937
      using False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   938
      apply auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   939
      done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   940
    then show "x j = b j"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   941
      using kle_imp_pointwise[OF assms(3),THEN spec[where x=j]]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   942
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   943
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   944
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   945
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   946
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   947
subsection {* Kuhn's notion of a simplex (a reformulation to avoid so much indexing) *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   948
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   949
definition "ksimplex p n (s::(nat \<Rightarrow> nat) set) \<longleftrightarrow>
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   950
  card s = n + 1 \<and>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   951
  (\<forall>x\<in>s. \<forall>j. x j \<le> p) \<and>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   952
  (\<forall>x\<in>s. \<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p) \<and>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   953
  (\<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   954
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   955
lemma ksimplexI:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   956
  "card s = n + 1 \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   957
  \<forall>x\<in>s. \<forall>j. x j \<le> p \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   958
  \<forall>x\<in>s. \<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   959
  \<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   960
  ksimplex p n s"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   961
  unfolding ksimplex_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   962
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   963
lemma ksimplex_eq:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   964
  "ksimplex p n (s::(nat \<Rightarrow> nat) set) \<longleftrightarrow>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   965
    card s = n + 1 \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   966
    finite s \<and>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   967
    (\<forall>x\<in>s. \<forall>j. x(j) \<le> p) \<and>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   968
    (\<forall>x\<in>s. \<forall>j. j\<notin>{1..n} \<longrightarrow> x j = p) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   969
    (\<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   970
  unfolding ksimplex_def by (auto intro: card_ge_0_finite)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   971
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   972
lemma ksimplex_extrema:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   973
  assumes "ksimplex p n s"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   974
  obtains a b where "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   975
    and "b \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   976
    and "\<forall>x\<in>s. kle n a x \<and> kle n x b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   977
    and "\<forall>i. b i = (if i \<in> {1..n} then a i + 1 else a i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   978
proof (cases "n = 0")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   979
  case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   980
  obtain x where *: "s = {x}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   981
    using assms[unfolded ksimplex_eq True,THEN conjunct1]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   982
    unfolding add_0_left card_1_exists
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   983
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   984
  show ?thesis
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   985
    apply (rule that[of x x])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   986
    unfolding * True
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   987
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   988
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   989
next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   990
  note assm = assms[unfolded ksimplex_eq]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   991
  case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   992
  have "s \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   993
    using assm by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   994
  obtain a where a: "a \<in> s" "\<forall>x\<in>s. kle n a x"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   995
    using `s \<noteq> {}` assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   996
    using kle_minimal[of s n]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   997
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   998
  obtain b where b: "b \<in> s" "\<forall>x\<in>s. kle n x b"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   999
    using `s \<noteq> {}` assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1000
    using kle_maximal[of s n]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1001
    by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1002
  obtain c d where c_d: "c \<in> s" "d \<in> s" "kle n c d" "n \<le> card {k \<in> {1..n}. c k < d k}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1003
    using kle_range_induct[of s n n]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1004
    using assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1005
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1006
  have "kle n c b \<and> n \<le> card {k \<in> {1..n}. c k < b k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1007
    apply (rule kle_range_combine_r[where y=d])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1008
    using c_d a b
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1009
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1010
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1011
  then have "kle n a b \<and> n \<le> card {k\<in>{1..n}. a(k) < b(k)}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1012
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1013
    apply (rule kle_range_combine_l[where y=c])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1014
    using a `c \<in> s` `b \<in> s`
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1015
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1016
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1017
  moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1018
  have "card {1..n} \<ge> card {k\<in>{1..n}. a(k) < b(k)}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1019
    by (rule card_mono) auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1020
  ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1021
  have *: "{k\<in>{1 .. n}. a k < b k} = {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1022
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1023
    apply (rule card_subset_eq)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1024
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1025
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1026
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1027
    apply (rule that[OF a(1) b(1)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1028
    defer
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1029
    apply (subst *[symmetric])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1030
    unfolding mem_Collect_eq
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1031
  proof
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1032
    obtain k where k: "k \<subseteq> {1..n} \<and> (\<forall>j. b j = a j + (if j \<in> k then 1 else 0))"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1033
      using a(2)[rule_format, OF b(1), unfolded kle_def] ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1034
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1035
    show "b i = (if i \<in> {1..n} \<and> a i < b i then a i + 1 else a i)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1036
    proof (cases "i \<in> {1..n}")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1037
      case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1038
      then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1039
        unfolding k[THEN conjunct2,rule_format] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1040
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1041
      case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1042
      have "a i = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1043
        using assm and False `a\<in>s` by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1044
      moreover have "b i = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1045
        using assm and False `b\<in>s` by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1046
      ultimately show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1047
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1048
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1049
  qed (insert a(2) b(2) assm, auto)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1050
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1051
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1052
lemma ksimplex_extrema_strong:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1053
  assumes "ksimplex p n s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1054
    and "n \<noteq> 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1055
  obtains a b where "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1056
    and "b \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1057
    and "a \<noteq> b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1058
    and "\<forall>x\<in>s. kle n a x \<and> kle n x b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1059
    and "\<forall>i. b i = (if i \<in> {1..n} then a(i) + 1 else a i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1060
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1061
  obtain a b where ab: "a \<in> s" "b \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1062
    "\<forall>x\<in>s. kle n a x \<and> kle n x b" "\<forall>i. b(i) = (if i \<in> {1..n} then a(i) + 1 else a(i))"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1063
    apply (rule ksimplex_extrema[OF assms(1)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1064
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1065
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1066
  have "a \<noteq> b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1067
    apply (rule notI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1068
    apply (drule cong[of _ _ 1 1])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1069
    using ab(4) assms(2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1070
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1071
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1072
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1073
    apply (rule_tac that[of a b])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1074
    using ab
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1075
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1076
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1077
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1078
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1079
lemma ksimplexD:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1080
  assumes "ksimplex p n s"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1081
  shows "card s = n + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1082
    and "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1083
    and "card s = n + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1084
    and "\<forall>x\<in>s. \<forall>j. x j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1085
    and "\<forall>x\<in>s. \<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1086
    and "\<forall>x\<in>s. \<forall>y\<in>s. kle n x y \<or> kle n y x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1087
  using assms unfolding ksimplex_eq by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1088
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1089
lemma ksimplex_successor:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1090
  assumes "ksimplex p n s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1091
    and "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1092
  shows "(\<forall>x\<in>s. kle n x a) \<or> (\<exists>y\<in>s. \<exists>k\<in>{1..n}. \<forall>j. y j = (if j = k then a j + 1 else a j))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1093
proof (cases "\<forall>x\<in>s. kle n x a")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1094
  case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1095
  then show ?thesis by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1096
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1097
  note assm = ksimplexD[OF assms(1)]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1098
  case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1099
  then obtain b where b: "b \<in> s" "\<not> kle n b a" "\<forall>x\<in>{x \<in> s. \<not> kle n x a}. kle n b x"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1100
    using kle_minimal[of "{x\<in>s. \<not> kle n x a}" n] and assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1101
    by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1102
  then have **: "1 \<le> card {k\<in>{1..n}. a k < b k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1103
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1104
    apply (rule kle_strict_set)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1105
    using assm(6) and `a\<in>s`
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1106
    apply (auto simp add: kle_refl)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1107
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1108
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1109
  let ?kle1 = "{x \<in> s. \<not> kle n x a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1110
  have "card ?kle1 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1111
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1112
    using assm(2) and False
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1113
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1114
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1115
  then have sizekle1: "card ?kle1 = Suc (card ?kle1 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1116
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1117
  obtain c d where c_d: "c \<in> s" "\<not> kle n c a" "d \<in> s" "\<not> kle n d a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1118
    "kle n c d" "card ?kle1 - 1 \<le> card {k \<in> {1..n}. c k < d k}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1119
    using kle_range_induct[OF sizekle1, of n] using assm by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1120
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1121
  let ?kle2 = "{x \<in> s. kle n x a}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1122
  have "card ?kle2 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1123
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1124
    using assm(6)[rule_format,of a a] and `a\<in>s` and assm(2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1125
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1126
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1127
  then have sizekle2: "card ?kle2 = Suc (card ?kle2 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1128
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1129
  obtain e f where e_f: "e \<in> s" "kle n e a" "f \<in> s" "kle n f a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1130
    "kle n e f" "card ?kle2 - 1 \<le> card {k \<in> {1..n}. e k < f k}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1131
    using kle_range_induct[OF sizekle2, of n]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1132
    using assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1133
    by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1134
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1135
  have "card {k\<in>{1..n}. a k < b k} = 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1136
  proof (rule ccontr)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1137
    assume "\<not> ?thesis"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1138
    then have as: "card {k\<in>{1..n}. a k < b k} \<ge> 2"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1139
      using ** by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1140
    have *: "finite ?kle2" "finite ?kle1" "?kle2 \<union> ?kle1 = s" "?kle2 \<inter> ?kle1 = {}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1141
      using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1142
    have "(card ?kle2 - 1) + 2 + (card ?kle1 - 1) = card ?kle2 + card ?kle1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1143
      using sizekle1 sizekle2 by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1144
    also have "\<dots> = n + 1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1145
      unfolding card_Un_Int[OF *(1-2)] *(3-)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1146
      using assm(3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1147
      by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1148
    finally have n: "(card ?kle2 - 1) + (2 + (card ?kle1 - 1)) = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1149
      by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1150
    have "kle n e a \<and> card {x \<in> s. kle n x a} - 1 \<le> card {k \<in> {1..n}. e k < a k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1151
      apply (rule kle_range_combine_r[where y=f])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1152
      using e_f using `a \<in> s` assm(6)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1153
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1154
      done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1155
    moreover have "kle n b d \<and> card {x \<in> s. \<not> kle n x a} - 1 \<le> card {k \<in> {1..n}. b k < d k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1156
      apply (rule kle_range_combine_l[where y=c])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1157
      using c_d using assm(6) and b
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1158
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1159
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1160
    then have "kle n a d \<and> 2 + (card {x \<in> s. \<not> kle n x a} - 1) \<le> card {k \<in> {1..n}. a k < d k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1161
      apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1162
      apply (rule kle_range_combine[where y=b]) using as and b assm(6) `a \<in> s` `d \<in> s`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1163
      apply blast+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1164
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1165
    ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1166
    have "kle n e d \<and> (card ?kle2 - 1) + (2 + (card ?kle1 - 1)) \<le> card {k\<in>{1..n}. e k < d k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1167
      apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1168
      apply (rule kle_range_combine[where y=a]) using assm(6)[rule_format, OF `e \<in> s` `d \<in> s`]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1169
      apply blast+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1170
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1171
    moreover have "card {k \<in> {1..n}. e k < d k} \<le> card {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1172
      by (rule card_mono) auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1173
    ultimately show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1174
      unfolding n by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1175
  qed
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1176
  then obtain k where k:
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1177
      "k \<in> {1..n} \<and> a k < b k"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1178
      "\<And>y y'. (y \<in> {1..n} \<and> a y < b y) \<and> y' \<in> {1..n} \<and> a y' < b y' \<Longrightarrow> y = y'"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1179
    unfolding card_1_exists by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1180
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1181
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1182
    apply (rule disjI2)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1183
    apply (rule_tac x=b in bexI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1184
    apply (rule_tac x=k in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1185
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1186
    fix j :: nat
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1187
    have "kle n a b"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1188
      using b and assm(6)[rule_format, OF `a\<in>s` `b\<in>s`]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1189
      by auto
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1190
    then obtain kk where kk: "kk \<subseteq> {1..n}" "\<And>j. b j = a j + (if j \<in> kk then 1 else 0)"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1191
      unfolding kle_def by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1192
    have kkk: "k \<in> kk"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1193
      apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1194
      using k(1)
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1195
      unfolding kk(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1196
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1197
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1198
    show "b j = (if j = k then a j + 1 else a j)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1199
    proof (cases "j \<in> kk")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1200
      case True
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1201
      then have "j = k"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1202
        apply -
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1203
        apply (rule k(2))
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1204
        using kk kkk
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1205
        apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1206
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1207
      then show ?thesis
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1208
        unfolding kk(2) using kkk by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1209
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1210
      case False
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1211
      then have "j \<noteq> k"
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1212
        using k(2)[of j k] and kkk
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1213
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1214
      then show ?thesis
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1215
        unfolding kk(2)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1216
        using kkk and False
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1217
        by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1218
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1219
  qed (insert k(1) `b \<in> s`, auto)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1220
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1221
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1222
lemma ksimplex_predecessor:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1223
  assumes "ksimplex p n s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1224
    and "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1225
  shows "(\<forall>x\<in>s. kle n a x) \<or> (\<exists>y\<in>s. \<exists>k\<in>{1..n}. \<forall>j. a j = (if j = k then y j + 1 else y j))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1226
proof (cases "\<forall>x\<in>s. kle n a x")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1227
  case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1228
  then show ?thesis by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1229
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1230
  note assm = ksimplexD[OF assms(1)]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1231
  case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1232
  then obtain b where b: "b \<in> s" "\<not> kle n a b" "\<forall>x\<in>{x \<in> s. \<not> kle n a x}. kle n x b"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1233
    using kle_maximal[of "{x\<in>s. \<not> kle n a x}" n] and assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1234
    by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1235
  then have **: "1 \<le> card {k\<in>{1..n}. a k > b k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1236
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1237
    apply (rule kle_strict_set)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1238
    using assm(6) and `a \<in> s`
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1239
    apply (auto simp add: kle_refl)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1240
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1241
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1242
  let ?kle1 = "{x \<in> s. \<not> kle n a x}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1243
  have "card ?kle1 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1244
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1245
    using assm(2) and False
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1246
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1247
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1248
  then have sizekle1: "card ?kle1 = Suc (card ?kle1 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1249
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1250
  obtain c d where c_d: "c \<in> s" "\<not> kle n a c" "d \<in> s" "\<not> kle n a d"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1251
    "kle n d c" "card ?kle1 - 1 \<le> card {k \<in> {1..n}. c k > d k}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1252
    using kle_range_induct[OF sizekle1, of n]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1253
    using assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1254
    by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1255
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1256
  let ?kle2 = "{x \<in> s. kle n a x}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1257
  have "card ?kle2 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1258
    apply (rule ccontr)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1259
    using assm(6)[rule_format,of a a] and `a \<in> s` and assm(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1260
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1261
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1262
  then have sizekle2: "card ?kle2 = Suc (card ?kle2 - 1)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1263
    using assm(2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1264
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1265
  obtain e f where e_f: "e \<in> s" "kle n a e" "f \<in> s" "kle n a f"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1266
    "kle n f e" "card ?kle2 - 1 \<le> card {k \<in> {1..n}. e k > f k}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1267
    using kle_range_induct[OF sizekle2, of n]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1268
    using assm
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1269
    by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1270
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1271
  have "card {k\<in>{1..n}. a k > b k} = 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1272
  proof (rule ccontr)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1273
    assume "\<not> ?thesis"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1274
    then have as: "card {k\<in>{1..n}. a k > b k} \<ge> 2"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1275
      using ** by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1276
    have *: "finite ?kle2" "finite ?kle1" "?kle2 \<union> ?kle1 = s" "?kle2 \<inter> ?kle1 = {}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1277
      using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1278
    have "(card ?kle2 - 1) + 2 + (card ?kle1 - 1) = card ?kle2 + card ?kle1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1279
      using sizekle1 sizekle2 by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1280
    also have "\<dots> = n + 1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1281
      unfolding card_Un_Int[OF *(1-2)] *(3-)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1282
      using assm(3) by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1283
    finally have n: "(card ?kle1 - 1) + 2 + (card ?kle2 - 1) = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1284
      by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1285
    have "kle n a e \<and> card {x \<in> s. kle n a x} - 1 \<le> card {k \<in> {1..n}. e k > a k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1286
      apply (rule kle_range_combine_l[where y=f])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1287
      using e_f and `a\<in>s` assm(6)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1288
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1289
      done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1290
    moreover have "kle n d b \<and> card {x \<in> s. \<not> kle n a x} - 1 \<le> card {k \<in> {1..n}. b k > d k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1291
      apply (rule kle_range_combine_r[where y=c])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1292
      using c_d and assm(6) and b
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1293
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1294
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1295
    then have "kle n d a \<and> (card {x \<in> s. \<not> kle n a x} - 1) + 2 \<le> card {k \<in> {1..n}. a k > d k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1296
      apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1297
      apply (rule kle_range_combine[where y=b]) using as and b assm(6) `a \<in> s` `d \<in> s`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1298
      apply blast+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1299
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1300
    ultimately have "kle n d e \<and> (card ?kle1 - 1 + 2) + (card ?kle2 - 1) \<le> card {k\<in>{1..n}. e k > d k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1301
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1302
      apply (rule kle_range_combine[where y=a])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1303
      using assm(6)[rule_format,OF `e\<in>s` `d\<in>s`]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1304
      apply blast+
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1305
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1306
    moreover have "card {k \<in> {1..n}. e k > d k} \<le> card {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1307
      by (rule card_mono) auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1308
    ultimately show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1309
      unfolding n by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1310
  qed
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1311
  then obtain k where k:
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1312
    "k \<in> {1..n} \<and> b k < a k"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1313
    "\<And>y y'. (y \<in> {1..n} \<and> b y < a y) \<and> y' \<in> {1..n} \<and> b y' < a y' \<Longrightarrow> y = y'"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1314
    unfolding card_1_exists by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1315
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1316
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1317
    apply (rule disjI2)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1318
    apply (rule_tac x=b in bexI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1319
    apply (rule_tac x=k in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1320
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1321
    fix j :: nat
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1322
    have "kle n b a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1323
      using b and assm(6)[rule_format, OF `a\<in>s` `b\<in>s`] by auto
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1324
    then obtain kk where kk: "kk \<subseteq> {1..n}" "\<And>j. a j = b j + (if j \<in> kk then 1 else 0)"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1325
      unfolding kle_def by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1326
    have kkk: "k \<in> kk"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1327
      apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1328
      using k(1)
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1329
      unfolding kk(2)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1330
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1331
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1332
    show "a j = (if j = k then b j + 1 else b j)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1333
    proof (cases "j \<in> kk")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1334
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1335
      then have "j = k"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1336
        apply -
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1337
        apply (rule k(2))
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1338
        using kk kkk
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1339
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1340
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1341
      then show ?thesis
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1342
        unfolding kk(2) using kkk by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1343
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1344
      case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1345
      then have "j \<noteq> k"
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1346
        using k(2)[of j k]
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1347
        using kkk
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1348
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1349
      then show ?thesis
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1350
        unfolding kk(2)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1351
        using kkk and False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1352
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1353
    qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1354
  qed (insert k(1) `b\<in>s`, auto)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1355
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1356
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1357
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1358
subsection {* The lemmas about simplices that we need. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1359
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1360
(* FIXME: These are clones of lemmas in Library/FuncSet *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1361
lemma card_funspace':
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1362
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1363
    and "finite t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1364
    and "card s = m"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1365
    and "card t = n"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1366
  shows "card {f. (\<forall>x\<in>s. f x \<in> t) \<and> (\<forall>x\<in>UNIV - s. f x = d)} = n ^ m"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1367
    (is "card (?M s) = _")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1368
  using assms
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1369
proof (induct m arbitrary: s)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1370
  case 0
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1371
  have [simp]: "{f. \<forall>x. f x = d} = {\<lambda>x. d}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1372
    apply (rule set_eqI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1373
    apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1374
    unfolding mem_Collect_eq
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1375
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1376
    apply (rule ext)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1377
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1378
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1379
  from 0 show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1380
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1381
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1382
  case (Suc m)
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1383
  obtain a s0 where as0:
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1384
    "s = insert a s0"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1385
    "a \<notin> s0"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1386
    "card s0 = m"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1387
    "m = 0 \<longrightarrow> s0 = {}"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1388
    using card_eq_SucD[OF Suc(4)] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1389
  have **: "card s0 = m"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1390
    using as0 using Suc(2) Suc(4)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1391
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1392
  let ?l = "(\<lambda>(b, g) x. if x = a then b else g x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1393
  have *: "?M (insert a s0) = ?l ` {(b,g). b\<in>t \<and> g\<in>?M s0}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1394
    apply (rule set_eqI, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1395
    unfolding mem_Collect_eq image_iff
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1396
    apply (erule conjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1397
    apply (rule_tac x="(x a, \<lambda>y. if y\<in>s0 then x y else d)" in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1398
    apply (rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1399
    prefer 3
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1400
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1401
    defer
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1402
    apply (erule bexE)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1403
    apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1404
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1405
    apply (erule splitE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1406
    apply (erule conjE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1407
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1408
    fix x xa xb xc y
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1409
    assume as:
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1410
      "x = (\<lambda>(b, g) x. if x = a then b else g x) xa"
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  1411
      "xb \<in> UNIV - insert a s0"
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  1412
      "xa = (xc, y)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1413
      "xc \<in> t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1414
      "\<forall>x\<in>s0. y x \<in> t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1415
      "\<forall>x\<in>UNIV - s0. y x = d"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1416
    then show "x xb = d"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1417
      unfolding as by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1418
  qed auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1419
  have inj: "inj_on ?l {(b,g). b\<in>t \<and> g\<in>?M s0}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1420
    unfolding inj_on_def
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1421
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1422
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1423
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1424
    unfolding mem_Collect_eq
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1425
    apply (erule splitE conjE)+
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1426
  proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1427
    case goal1 note as = this(1,4-)[unfolded goal1 split_conv]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1428
    have "xa = xb"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1429
      using as(1)[THEN cong[of _ _ a]] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1430
    moreover have "ya = yb"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1431
    proof (rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1432
      fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1433
      show "ya x = yb x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1434
      proof (cases "x = a")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1435
        case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1436
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1437
          using as(1)[THEN cong[of _ _ x x]] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1438
      next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1439
        case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1440
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1441
          using as(5,7) using as0(2) by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1442
      qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1443
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1444
    ultimately show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1445
      unfolding goal1 by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1446
  qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1447
  have "finite s0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1448
    using `finite s` unfolding as0 by simp
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1449
  show ?case
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1450
    unfolding as0 * card_image[OF inj]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1451
    using assms
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1452
    unfolding SetCompr_Sigma_eq
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1453
    unfolding card_cartesian_product
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1454
    using Suc(1)[OF `finite s0` `finite t` ** `card t = n`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1455
    by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1456
qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1457
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1458
lemma card_funspace:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1459
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1460
    and "finite t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1461
  shows "card {f. (\<forall>x\<in>s. f x \<in> t) \<and> (\<forall>x\<in>UNIV - s. f x = d)} = card t ^ card s"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1462
  using assms by (auto intro: card_funspace')
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1463
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1464
lemma finite_funspace:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1465
  assumes "finite s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1466
    and "finite t"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1467
  shows "finite {f. (\<forall>x\<in>s. f x \<in> t) \<and> (\<forall>x\<in>UNIV - s. f x = d)}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1468
    (is "finite ?S")
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1469
proof (cases "card t > 0")
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1470
  case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1471
  have "card ?S = card t ^ card s"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1472
    using assms by (auto intro!: card_funspace)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1473
  then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1474
    using True by (rule_tac card_ge_0_finite) simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1475
next
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1476
  case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1477
  then have "t = {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1478
    using `finite t` by auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1479
  show ?thesis
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1480
  proof (cases "s = {}")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1481
    case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1482
    have *: "{f. \<forall>x. f x = d} = {\<lambda>x. d}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1483
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1484
    from True show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1485
      using `t = {}` by (auto simp: *)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1486
  next
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1487
    case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1488
    then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1489
      using `t = {}` by simp
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1490
  qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1491
qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1492
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1493
lemma finite_simplices: "finite {s. ksimplex p n s}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1494
  apply (rule finite_subset[of _ "{s. s\<subseteq>{f. (\<forall>i\<in>{1..n}. f i \<in> {0..p}) \<and> (\<forall>i\<in>UNIV-{1..n}. f i = p)}}"])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1495
  unfolding ksimplex_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1496
  defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1497
  apply (rule finite_Collect_subsets)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1498
  apply (rule finite_funspace)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1499
  apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1500
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1501
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1502
lemma simplex_top_face:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1503
  assumes "0 < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1504
    and "\<forall>x\<in>f. x (n + 1) = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1505
  shows "(\<exists>s a. ksimplex p (n + 1) s \<and> a \<in> s \<and> (f = s - {a})) \<longleftrightarrow> ksimplex p n f"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1506
    (is "?ls = ?rs")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1507
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1508
  assume ?ls
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1509
  then obtain s a where sa:
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1510
    "ksimplex p (n + 1) s"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1511
    "a \<in> s"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1512
    "f = s - {a}"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1513
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1514
  show ?rs
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1515
    unfolding ksimplex_def sa(3)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1516
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1517
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1518
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1519
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1520
    apply (rule, rule, rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1521
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1522
    apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1523
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1524
    fix x y
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1525
    assume as: "x \<in>s - {a}" "y \<in>s - {a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1526
    have xyp: "x (n + 1) = y (n + 1)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1527
      using as(1)[unfolded sa(3)[symmetric], THEN assms(2)[rule_format]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1528
      using as(2)[unfolded sa(3)[symmetric], THEN assms(2)[rule_format]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1529
      by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1530
    show "kle n x y \<or> kle n y x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1531
    proof (cases "kle (n + 1) x y")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1532
      case True
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1533
      then obtain k where k: "k \<subseteq> {1..n + 1}" "\<And>j. y j = x j + (if j \<in> k then 1 else 0)"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1534
        unfolding kle_def by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1535
      then have *: "n + 1 \<notin> k" using xyp by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1536
      have "\<not> (\<exists>x\<in>k. x \<notin> {1..n})"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1537
        apply (rule notI)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1538
        apply (erule bexE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1539
      proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1540
        fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1541
        assume as: "x \<in> k" "x \<notin> {1..n}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1542
        have "x \<noteq> n + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1543
          using as and * by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1544
        then show False
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1545
          using as and k(1) by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1546
      qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1547
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1548
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1549
        apply (rule disjI1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1550
        unfolding kle_def
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1551
        using k(2)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1552
        apply (rule_tac x=k in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1553
        apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1554
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1555
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1556
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1557
      then have "kle (n + 1) y x"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1558
        using ksimplexD(6)[OF sa(1),rule_format, of x y] and as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1559
        by auto
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1560
      then obtain k where k: "k \<subseteq> {1..n + 1}" "\<And>j. x j = y j + (if j \<in> k then 1 else 0)"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1561
        unfolding kle_def by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1562
      then have *: "n + 1 \<notin> k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1563
        using xyp by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1564
      then have "\<not> (\<exists>x\<in>k. x \<notin> {1..n})"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1565
        apply -
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1566
        apply (rule notI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1567
        apply (erule bexE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1568
      proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1569
        fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1570
        assume as: "x \<in> k" "x \<notin> {1..n}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1571
        have "x \<noteq> n + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1572
          using as and * by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1573
        then show False
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1574
          using as and k(1)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1575
          by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1576
      qed
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1577
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1578
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1579
        apply (rule disjI2)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1580
        unfolding kle_def
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1581
        using k(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1582
        apply (rule_tac x = k in exI)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1583
        apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1584
        done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1585
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1586
  next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1587
    fix x j
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1588
    assume as: "x \<in> s - {a}" "j \<notin> {1..n}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1589
    then show "x j = p"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1590
      using as(1)[unfolded sa(3)[symmetric], THEN assms(2)[rule_format]]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1591
      apply (cases "j = n + 1")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1592
      using sa(1)[unfolded ksimplex_def]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1593
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1594
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1595
  qed (insert sa ksimplexD[OF sa(1)], auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1596
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1597
  assume ?rs note rs=ksimplexD[OF this]
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1598
  obtain a b where ab:
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1599
    "a \<in> f"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1600
    "b \<in> f"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1601
    "\<forall>x\<in>f. kle n a x \<and> kle n x b"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1602
    "\<forall>i. b i = (if i \<in> {1..n} then a i + 1 else a i)"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1603
    by (rule ksimplex_extrema[OF `?rs`])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1604
  def c \<equiv> "\<lambda>i. if i = (n + 1) then p - 1 else a i"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1605
  have "c \<notin> f"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1606
    apply (rule notI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1607
    apply (drule assms(2)[rule_format])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1608
    unfolding c_def
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1609
    using assms(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1610
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1611
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1612
  then show ?ls
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1613
    apply (rule_tac x = "insert c f" in exI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1614
    apply (rule_tac x = c in exI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1615
    unfolding ksimplex_def conj_assoc
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1616
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1617
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1618
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1619
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1620
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1621
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1622
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1623
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1624
  proof (rule_tac[3-5] ballI allI)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1625
    fix x j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1626
    assume x: "x \<in> insert c f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1627
    then show "x j \<le> p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1628
    proof (cases "x = c")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1629
      case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1630
      show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1631
        unfolding True c_def
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1632
        apply (cases "j = n + 1")
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1633
        using ab(1) and rs(4)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1634
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1635
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1636
    next
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1637
      case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1638
      with insert x rs(4) show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1639
        by (auto simp add: c_def)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1640
    qed
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1641
    show "j \<notin> {1..n + 1} \<longrightarrow> x j = p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1642
      apply (cases "x = c")
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1643
      using x ab(1) rs(5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1644
      unfolding c_def
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1645
      apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1646
      done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1647
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1648
      fix z
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1649
      assume z: "z \<in> insert c f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1650
      then have "kle (n + 1) c z"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1651
      proof (cases "z = c")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1652
        case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1653
        then have "z \<in> f"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1654
          using z by auto
55493
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1655
        with ab(3) have "kle n a z" by blast
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1656
        then obtain k where "k \<subseteq> {1..n}" "\<And>j. z j = a j + (if j \<in> k then 1 else 0)"
47cac23e3d22 tuned proofs;
wenzelm
parents: 54775
diff changeset
  1657
          unfolding kle_def by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1658
        then show "kle (n + 1) c z"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1659
          unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1660
          apply (rule_tac x="insert (n + 1) k" in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1661
          unfolding c_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1662
          using ab
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1663
          using rs(5)[rule_format,OF ab(1),of "n + 1"] assms(1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1664
          apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1665
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1666
      next
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1667
        case True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1668
        then show ?thesis by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1669
      qed
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1670
    } note * = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1671
    fix y
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1672
    assume y: "y \<in> insert c f"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1673
    show "kle (n + 1) x y \<or> kle (n + 1) y x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1674
    proof (cases "x = c \<or> y = c")
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1675
      case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1676
      then have **: "x \<in> f" "y \<in> f"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1677
        using x y by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1678
      show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1679
        using rs(6)[rule_format,OF **]
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1680
        by (auto dest: kle_Suc)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1681
    qed (insert * x y, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1682
  qed (insert rs, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1683
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1684
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1685
lemma ksimplex_fix_plane:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1686
  fixes a a0 a1 :: "nat \<Rightarrow> nat"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1687
  assumes "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1688
    and "j \<in> {1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1689
    and "\<forall>x\<in>s - {a}. x j = q"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1690
    and "a0 \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1691
    and "a1 \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1692
    and "\<forall>i. a1 i = (if i \<in> {1..n} then a0 i + 1 else a0 i)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1693
  shows "a = a0 \<or> a = a1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1694
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1695
  have *: "\<And>P A x y. \<forall>x\<in>A. P x \<Longrightarrow> x\<in>A \<Longrightarrow> y\<in>A \<Longrightarrow> P x \<and> P y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1696
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1697
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1698
    apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1699
    using *[OF assms(3), of a0 a1]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1700
    unfolding assms(6)[THEN spec[where x=j]]
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1701
    using assms(1-2,4-5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1702
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1703
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1704
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1705
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1706
lemma ksimplex_fix_plane_0:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1707
  fixes a a0 a1 :: "nat \<Rightarrow> nat"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1708
  assumes "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1709
    and "j \<in> {1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1710
    and "\<forall>x\<in>s - {a}. x j = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1711
    and "a0 \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1712
    and "a1 \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1713
    and "\<forall>i. a1 i = (if i\<in>{1..n} then a0 i + 1 else a0 i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1714
  shows "a = a1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1715
    apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1716
    using ksimplex_fix_plane[OF assms]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1717
    using assms(3)[THEN bspec[where x=a1]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1718
    using assms(2,5)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1719
    unfolding assms(6)[THEN spec[where x=j]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1720
    apply simp
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1721
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1722
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1723
lemma ksimplex_fix_plane_p:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1724
  assumes "ksimplex p n s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1725
    and "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1726
    and "j \<in> {1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1727
    and "\<forall>x\<in>s - {a}. x j = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1728
    and "a0 \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1729
    and "a1 \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1730
    and "\<forall>i. a1 i = (if i\<in>{1..n} then a0 i + 1 else a0 i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1731
  shows "a = a0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1732
proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1733
  note s = ksimplexD[OF assms(1),rule_format]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1734
  assume as: "\<not> ?thesis"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1735
  then have *: "a0 \<in> s - {a}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1736
    using assms(5) by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1737
  then have "a1 = a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1738
    using ksimplex_fix_plane[OF assms(2-)] by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1739
  then show False
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1740
    using as and assms(3,5) and assms(7)[rule_format,of j]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1741
    unfolding assms(4)[rule_format,OF *]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1742
    using s(4)[OF assms(6), of j]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1743
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1744
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1745
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1746
lemma ksimplex_replace_0:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1747
  assumes "ksimplex p n s" "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1748
    and "n \<noteq> 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1749
    and "j \<in> {1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1750
    and "\<forall>x\<in>s - {a}. x j = 0"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1751
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1752
proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1753
  have *: "\<And>s' a a'. s' - {a'} = s - {a} \<Longrightarrow> a' = a \<Longrightarrow> a' \<in> s' \<Longrightarrow> a \<in> s \<Longrightarrow> s' = s"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1754
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1755
  have **: "\<And>s' a'. ksimplex p n s' \<Longrightarrow> a' \<in> s' \<Longrightarrow> s' - {a'} = s - {a} \<Longrightarrow> s' = s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1756
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1757
    case goal1
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1758
    obtain a0 a1 where exta:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1759
        "a0 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1760
        "a1 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1761
        "a0 \<noteq> a1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1762
        "\<And>x. x \<in> s \<Longrightarrow> kle n a0 x \<and> kle n x a1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1763
        "\<And>i. a1 i = (if i \<in> {1..n} then a0 i + 1 else a0 i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1764
      by (rule ksimplex_extrema_strong[OF assms(1,3)]) blast
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1765
    have a: "a = a1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1766
      apply (rule ksimplex_fix_plane_0[OF assms(2,4-5)])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1767
      using exta(1-2,5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1768
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1769
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1770
    moreover
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1771
    obtain b0 b1 where extb:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1772
        "b0 \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1773
        "b1 \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1774
        "b0 \<noteq> b1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1775
        "\<And>x. x \<in> s' \<Longrightarrow> kle n b0 x \<and> kle n x b1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1776
        "\<And>i. b1 i = (if i \<in> {1..n} then b0 i + 1 else b0 i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1777
      by (rule ksimplex_extrema_strong[OF goal1(1) assms(3)]) blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1778
    have a': "a' = b1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1779
      apply (rule ksimplex_fix_plane_0[OF goal1(2) assms(4), of b0])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1780
      unfolding goal1(3)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1781
      using assms extb goal1
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1782
      apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1783
      done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1784
    moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1785
    have "b0 = a0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1786
      unfolding kle_antisym[symmetric, of b0 a0 n]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1787
      using exta extb and goal1(3)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1788
      unfolding a a' by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1789
    then have "b1 = a1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1790
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1791
      apply (rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1792
      unfolding exta(5) extb(5)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1793
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1794
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1795
    ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1796
    show "s' = s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1797
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1798
      apply (rule *[of _ a1 b1])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1799
      using exta(1-2) extb(1-2) goal1
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1800
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1801
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1802
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1803
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1804
    unfolding card_1_exists
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1805
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1806
    apply(rule ex1I[of _ s])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1807
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1808
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1809
    apply (erule conjE bexE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1810
    apply (rule_tac a'=b in **)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1811
    using assms(1,2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1812
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1813
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1814
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1815
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1816
lemma ksimplex_replace_1:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1817
  assumes "ksimplex p n s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1818
    and "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1819
    and "n \<noteq> 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1820
    and "j \<in> {1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1821
    and "\<forall>x\<in>s - {a}. x j = p"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1822
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1823
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1824
  have lem: "\<And>a a' s'. s' - {a'} = s - {a} \<Longrightarrow> a' = a \<Longrightarrow> a' \<in> s' \<Longrightarrow> a \<in> s \<Longrightarrow> s' = s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1825
    by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1826
  have lem: "\<And>s' a'. ksimplex p n s' \<Longrightarrow> a'\<in>s' \<Longrightarrow> s' - {a'} = s - {a} \<Longrightarrow> s' = s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1827
  proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1828
    case goal1
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1829
    obtain a0 a1 where exta:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1830
        "a0 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1831
        "a1 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1832
        "a0 \<noteq> a1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1833
        "\<And>x. x \<in> s \<Longrightarrow> kle n a0 x \<and> kle n x a1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1834
        "\<And>i. a1 i = (if i \<in> {1..n} then a0 i + 1 else a0 i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1835
      by (rule ksimplex_extrema_strong[OF assms(1,3)]) blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1836
    have a: "a = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1837
      apply (rule ksimplex_fix_plane_p[OF assms(1-2,4-5) exta(1,2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1838
      unfolding exta
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1839
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1840
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1841
    moreover
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1842
    obtain b0 b1 where extb:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1843
        "b0 \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1844
        "b1 \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1845
        "b0 \<noteq> b1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1846
        "\<And>x. x \<in> s' \<Longrightarrow> kle n b0 x \<and> kle n x b1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1847
        "\<And>i. b1 i = (if i \<in> {1..n} then b0 i + 1 else b0 i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1848
      by (rule ksimplex_extrema_strong[OF goal1(1) assms(3)]) blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1849
    have a': "a' = b0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1850
      apply (rule ksimplex_fix_plane_p[OF goal1(1-2) assms(4), of _ b1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1851
      unfolding goal1 extb
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1852
      using extb(1,2) assms(5)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1853
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1854
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1855
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1856
    have *: "b1 = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1857
      unfolding kle_antisym[symmetric, of b1 a1 n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1858
      using exta extb
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1859
      using goal1(3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1860
      unfolding a a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1861
      by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1862
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1863
    have "a0 = b0"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1864
    proof (rule ext)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1865
      fix x
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1866
      show "a0 x = b0 x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1867
        using *[THEN cong, of x x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1868
        unfolding exta extb
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1869
        by (cases "x \<in> {1..n}") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1870
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1871
    ultimately
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1872
    show "s' = s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1873
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1874
      apply (rule lem[OF goal1(3) _ goal1(2) assms(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1875
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1876
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1877
  qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1878
  show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1879
    unfolding card_1_exists
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1880
    apply (rule ex1I[of _ s])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1881
    unfolding mem_Collect_eq
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1882
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1883
    apply (rule assms(1))
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1884
    apply (rule_tac x = a in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1885
    prefer 3
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1886
    apply (erule conjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1887
    apply (rule_tac a'=b in lem)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1888
    using assms(1-2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1889
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1890
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1891
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1892
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1893
lemma ksimplex_replace_2:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1894
  assumes "ksimplex p n s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1895
    and "a \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1896
    and "n \<noteq> 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1897
    and "\<not> (\<exists>j\<in>{1..n}. \<forall>x\<in>s - {a}. x j = 0)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1898
    and "\<not> (\<exists>j\<in>{1..n}. \<forall>x\<in>s - {a}. x j = p)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1899
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 2"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1900
    (is "card ?A = 2")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1901
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1902
  have lem1: "\<And>a a' s s'. s' - {a'} = s - {a} \<Longrightarrow> a' = a \<Longrightarrow> a' \<in> s' \<Longrightarrow> a \<in> s \<Longrightarrow> s' = s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1903
    by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1904
  have lem2: "\<And>a b. a \<in> s \<Longrightarrow> b \<noteq> a \<Longrightarrow> s \<noteq> insert b (s - {a})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1905
  proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1906
    case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1907
    then have "a \<in> insert b (s - {a})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1908
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1909
    then have "a \<in> s - {a}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1910
      unfolding insert_iff
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1911
      using goal1
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1912
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1913
    then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1914
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1915
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1916
  obtain a0 a1 where a0a1:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1917
      "a0 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1918
      "a1 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1919
      "a0 \<noteq> a1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1920
      "\<forall>x\<in>s. kle n a0 x \<and> kle n x a1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1921
      "\<forall>i. a1 i = (if i \<in> {1..n} then a0 i + 1 else a0 i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1922
    by (rule ksimplex_extrema_strong[OF assms(1,3)])
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1923
  {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1924
    assume "a = a0"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1925
    have *: "\<And>P Q. P \<or> Q \<Longrightarrow> \<not> P \<Longrightarrow> Q"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1926
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1927
    have "\<exists>x\<in>s. \<not> kle n x a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1928
      apply (rule_tac x=a1 in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1929
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1930
      assume as: "kle n a1 a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1931
      show False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1932
        using kle_imp_pointwise[OF as,THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1933
        unfolding a0a1(5)[THEN spec[where x=1]]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1934
        using assms(3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1935
        by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1936
    qed (insert a0a1, auto)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1937
    then have "\<exists>y\<in>s. \<exists>k\<in>{1..n}. \<forall>j. y j = (if j = k then a0 j + 1 else a0 j)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1938
      apply (rule_tac *[OF ksimplex_successor[OF assms(1-2),unfolded `a=a0`]])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1939
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1940
      done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1941
    then
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1942
    obtain a2 k where a2: "a2 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1943
      and k: "k \<in> {1..n}" "\<forall>j. a2 j = (if j = k then a0 j + 1 else a0 j)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1944
      by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1945
    def a3 \<equiv> "\<lambda>j. if j = k then a1 j + 1 else a1 j"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1946
    have "a3 \<notin> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1947
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1948
      assume "a3\<in>s"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1949
      then have "kle n a3 a1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1950
        using a0a1(4) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1951
      then show False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1952
        apply (drule_tac kle_imp_pointwise)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1953
        unfolding a3_def
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1954
        apply (erule_tac x = k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1955
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1956
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1957
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1958
    then have "a3 \<noteq> a0" and "a3 \<noteq> a1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1959
      using a0a1 by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1960
    have "a2 \<noteq> a0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1961
      using k(2)[THEN spec[where x=k]] by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1962
    have lem3: "\<And>x. x \<in> (s - {a0}) \<Longrightarrow> kle n a2 x"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1963
    proof (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1964
      case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1965
      then have as: "x \<in> s" "x \<noteq> a0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1966
        by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1967
      have "kle n a2 x \<or> kle n x a2"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1968
        using ksimplexD(6)[OF assms(1)] and as `a2 \<in> s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1969
        by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1970
      moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1971
      have "kle n a0 x"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1972
        using a0a1(4) as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1973
      ultimately have "x = a0 \<or> x = a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1974
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1975
        apply (rule kle_adjacent[OF k(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1976
        using goal1(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1977
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1978
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1979
      then have "x = a2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1980
        using as by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1981
      then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1982
        using goal1(2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1983
        using kle_refl
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1984
        by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1985
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1986
    let ?s = "insert a3 (s - {a0})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1987
    have "ksimplex p n ?s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1988
      apply (rule ksimplexI)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1989
      apply (rule_tac[2-] ballI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1990
      apply (rule_tac[4] ballI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1991
    proof -
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1992
      show "card ?s = n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1993
        using ksimplexD(2-3)[OF assms(1)]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1994
        using `a3 \<noteq> a0` `a3 \<notin> s` `a0 \<in> s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1995
        by (auto simp add: card_insert_if)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1996
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1997
      assume x: "x \<in> insert a3 (s - {a0})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1998
      show "\<forall>j. x j \<le> p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1999
      proof
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2000
        fix j
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2001
        show "x j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2002
        proof (cases "x = a3")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2003
          case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2004
          then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2005
            using x ksimplexD(4)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2006
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2007
          case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2008
          show ?thesis unfolding True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2009
          proof (cases "j = k")
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2010
            case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2011
            then show "a3 j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2012
              unfolding True a3_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2013
              using `a1 \<in> s` ksimplexD(4)[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2014
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2015
          next
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2016
            obtain a4 where a4: "a4 \<in> s - {a}" "a4 k \<noteq> p"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2017
              using assms(5) k(1) by blast
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2018
            have "a2 k \<le> a4 k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2019
              using lem3[OF a4(1)[unfolded `a = a0`],THEN kle_imp_pointwise]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2020
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2021
            also have "\<dots> < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2022
              using ksimplexD(4)[OF assms(1),rule_format,of a4 k]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2023
              using a4 by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2024
            finally have *: "a0 k + 1 < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2025
              unfolding k(2)[rule_format]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2026
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2027
            case True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2028
            then show "a3 j \<le>p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2029
              unfolding a3_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2030
              unfolding a0a1(5)[rule_format]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2031
              using k(1) k(2)assms(5)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2032
              using *
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2033
              by simp
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2034
          qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2035
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2036
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2037
      show "\<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2038
      proof (rule, rule)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2039
        fix j :: nat
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2040
        assume j: "j \<notin> {1..n}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2041
        show "x j = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2042
        proof (cases "x = a3")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2043
          case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2044
          then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2045
            using j x ksimplexD(5)[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2046
            by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2047
        next
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2048
          case True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2049
          show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2050
            unfolding True a3_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2051
            using j k(1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2052
            using ksimplexD(5)[OF assms(1),rule_format,OF `a1\<in>s` j]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2053
            by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2054
        qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2055
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2056
      fix y
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2057
      assume y: "y \<in> insert a3 (s - {a0})"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2058
      have lem4: "\<And>x. x\<in>s \<Longrightarrow> x \<noteq> a0 \<Longrightarrow> kle n x a3"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2059
      proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2060
        case goal1
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2061
        obtain kk where kk:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2062
            "kk \<subseteq> {1..n}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2063
            "\<forall>j. a1 j = x j + (if j \<in> kk then 1 else 0)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2064
          using a0a1(4)[rule_format, OF `x\<in>s`,THEN conjunct2,unfolded kle_def]
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2065
          by blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2066
        have "k \<notin> kk"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2067
        proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2068
          assume "k \<in> kk"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2069
          then have "a1 k = x k + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2070
            using kk by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2071
          then have "a0 k = x k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2072
            unfolding a0a1(5)[rule_format] using k(1) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2073
          then have "a2 k = x k + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2074
            unfolding k(2)[rule_format] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2075
          moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2076
          have "a2 k \<le> x k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2077
            using lem3[of x,THEN kle_imp_pointwise] goal1 by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2078
          ultimately show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2079
            by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2080
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2081
        then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2082
          unfolding kle_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2083
          apply (rule_tac x="insert k kk" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2084
          using kk(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2085
          unfolding a3_def kle_def kk(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2086
          using k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2087
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2088
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2089
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2090
      show "kle n x y \<or> kle n y x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2091
      proof (cases "y = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2092
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2093
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2094
          unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2095
          apply (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2096
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2097
          apply (rule disjI1, rule lem4)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2098
          using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2099
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2100
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2101
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2102
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2103
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2104
        proof (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2105
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2106
          show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2107
            unfolding True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2108
            apply (rule disjI2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2109
            apply (rule lem4)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2110
            using y False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2111
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2112
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2113
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2114
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2115
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2116
            apply (rule_tac ksimplexD(6)[OF assms(1),rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2117
            using x y `y \<noteq> a3`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2118
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2119
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2120
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2121
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2122
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2123
    then have "insert a3 (s - {a0}) \<in> ?A"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2124
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2125
      apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2126
      apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2127
      apply assumption
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2128
      apply (rule_tac x = "a3" in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2129
      unfolding `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2130
      using `a3 \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2131
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2132
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2133
    moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2134
    have "s \<in> ?A"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2135
      using assms(1,2) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2136
    ultimately have "?A \<supseteq> {s, insert a3 (s - {a0})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2137
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2138
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2139
    have "?A \<subseteq> {s, insert a3 (s - {a0})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2140
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2141
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2142
    proof (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2143
      fix s'
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2144
      assume as: "ksimplex p n s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2145
      assume "\<exists>b\<in>s'. s' - {b} = s - {a}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2146
      then obtain a' where a': "a' \<in> s'" "s' - {a'} = s - {a}" ..
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2147
      obtain a_min a_max where min_max:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2148
          "a_min \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2149
          "a_max \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2150
          "a_min \<noteq> a_max"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2151
          "\<forall>x\<in>s'. kle n a_min x \<and> kle n x a_max"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2152
          "\<forall>i. a_max i = (if i \<in> {1..n} then a_min i + 1 else a_min i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2153
        by (rule ksimplex_extrema_strong[OF as assms(3)])
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2154
      have *: "\<forall>x\<in>s' - {a'}. x k = a2 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2155
        unfolding a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2156
      proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2157
        fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2158
        assume x: "x \<in> s - {a}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2159
        then have "kle n a2 x"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2160
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2161
          apply (rule lem3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2162
          using `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2163
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2164
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2165
        then have "a2 k \<le> x k"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2166
          apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2167
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2168
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2169
        moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2170
        have "x k \<le> a2 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2171
          unfolding k(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2172
          using a0a1(4)[rule_format,of x, THEN conjunct1]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2173
          unfolding kle_def using x
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2174
          by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2175
        ultimately show "x k = a2 k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2176
        by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2177
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2178
      have **: "a' = a_min \<or> a' = a_max"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2179
        apply (rule ksimplex_fix_plane[OF a'(1) k(1) *])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2180
        using min_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2181
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2182
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2183
      show "s' \<in> {s, insert a3 (s - {a0})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2184
      proof (cases "a' = a_min")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2185
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2186
        have "a_max = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2187
          unfolding kle_antisym[symmetric,of a_max a1 n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2188
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2189
          apply (rule a0a1(4)[rule_format,THEN conjunct2])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2190
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2191
        proof (rule min_max(4)[rule_format,THEN conjunct2])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2192
          show "a1 \<in> s'"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2193
            using a'
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2194
            unfolding `a = a0`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2195
            using a0a1
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2196
            by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2197
          show "a_max \<in> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2198
          proof (rule ccontr)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2199
            assume "\<not> ?thesis"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2200
            then have "a_max = a'"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2201
              using a' min_max by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2202
            then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2203
              unfolding True using min_max by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2204
          qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2205
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2206
        then have "\<forall>i. a_max i = a1 i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2207
          by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2208
        then have "a' = a"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2209
          unfolding True `a = a0`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2210
          apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2211
          apply (subst fun_eq_iff)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2212
          apply rule
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2213
          apply (erule_tac x=x in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2214
          unfolding a0a1(5)[rule_format] min_max(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2215
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2216
          case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2217
          then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2218
            by (cases "x \<in> {1..n}") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2219
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2220
        then have "s' = s"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2221
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2222
          apply (rule lem1[OF a'(2)])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2223
          using `a \<in> s` `a' \<in> s'`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2224
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2225
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2226
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2227
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2228
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2229
        case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2230
        then have as: "a' = a_max"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2231
          using ** by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2232
        have "a_min = a2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2233
          unfolding kle_antisym[symmetric, of _ _ n]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2234
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2235
          apply (rule min_max(4)[rule_format,THEN conjunct1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2236
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2237
        proof (rule lem3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2238
          show "a_min \<in> s - {a0}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2239
            unfolding a'(2)[symmetric,unfolded `a = a0`]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2240
            unfolding as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2241
            using min_max(1-3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2242
            by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2243
          have "a2 \<noteq> a"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2244
            unfolding `a = a0`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2245
            using k(2)[rule_format,of k]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2246
            by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2247
          then have "a2 \<in> s - {a}"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2248
            using a2 by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2249
          then show "a2 \<in> s'"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2250
            unfolding a'(2)[symmetric] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2251
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2252
        then have "\<forall>i. a_min i = a2 i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2253
          by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2254
        then have "a' = a3"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2255
          unfolding as `a = a0`
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2256
          apply (subst fun_eq_iff)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2257
          apply rule
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2258
          apply (erule_tac x=x in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2259
          unfolding a0a1(5)[rule_format] min_max(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2260
          unfolding a3_def k(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2261
          unfolding a0a1(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2262
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2263
          case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2264
          show ?case
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2265
            unfolding goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2266
            apply (cases "x \<in> {1..n}")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2267
            defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2268
            apply (cases "x = k")
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2269
            using `k \<in> {1..n}`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2270
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2271
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2272
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2273
        then have "s' = insert a3 (s - {a0})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2274
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2275
          apply (rule lem1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2276
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2277
          apply assumption
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2278
          apply (rule a'(1))
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2279
          unfolding a' `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2280
          using `a3 \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2281
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2282
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2283
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2284
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2285
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2286
    ultimately have *: "?A = {s, insert a3 (s - {a0})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2287
      by blast
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2288
    have "s \<noteq> insert a3 (s - {a0})"
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  2289
      using `a3 \<notin> s` by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2290
    then have ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2291
      unfolding * by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2292
  }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2293
  moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2294
  {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2295
    assume "a = a1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2296
    have *: "\<And>P Q. P \<or> Q \<Longrightarrow> \<not> P \<Longrightarrow> Q"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2297
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2298
    have "\<exists>x\<in>s. \<not> kle n a1 x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2299
      apply (rule_tac x=a0 in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2300
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2301
      assume as: "kle n a1 a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2302
      show False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2303
        using kle_imp_pointwise[OF as,THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2304
        unfolding a0a1(5)[THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2305
        using assms(3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2306
        by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2307
    qed (insert a0a1, auto)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2308
    then have "\<exists>y\<in>s. \<exists>k\<in>{1..n}. \<forall>j. a1 j = (if j = k then y j + 1 else y j)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2309
      apply (rule_tac *[OF ksimplex_predecessor[OF assms(1-2),unfolded `a=a1`]])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2310
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2311
      done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2312
    then
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2313
    obtain a2 k where a2: "a2 \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2314
      and k: "k \<in> {1..n}" "\<forall>j. a1 j = (if j = k then a2 j + 1 else a2 j)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2315
      by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2316
    def a3 \<equiv> "\<lambda>j. if j = k then a0 j - 1 else a0 j"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2317
    have "a2 \<noteq> a1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2318
      using k(2)[THEN spec[where x=k]] by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2319
    have lem3: "\<And>x. x \<in> s - {a1} \<Longrightarrow> kle n x a2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2320
    proof (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2321
      case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2322
      then have as: "x \<in> s" "x \<noteq> a1" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2323
      have "kle n a2 x \<or> kle n x a2"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2324
        using ksimplexD(6)[OF assms(1)] and as `a2\<in>s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2325
        by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2326
      moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2327
      have "kle n x a1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2328
        using a0a1(4) as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2329
      ultimately have "x = a2 \<or> x = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2330
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2331
        apply (rule kle_adjacent[OF k(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2332
        using goal1(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2333
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2334
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2335
      then have "x = a2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2336
        using as by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2337
      then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2338
        using goal1(2) using kle_refl by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2339
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2340
    have "a0 k \<noteq> 0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2341
    proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2342
      obtain a4 where a4: "a4 \<in> s - {a}" "a4 k \<noteq> 0"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2343
        using assms(4) `k\<in>{1..n}` by blast
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2344
      have "a4 k \<le> a2 k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2345
        using lem3[OF a4(1)[unfolded `a=a1`],THEN kle_imp_pointwise]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2346
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2347
      moreover have "a4 k > 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2348
        using a4 by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2349
      ultimately have "a2 k > 0"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2350
        by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2351
      then have "a1 k > 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2352
        unfolding k(2)[rule_format] by simp
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2353
      then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2354
        unfolding a0a1(5)[rule_format] using k(1) by simp
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2355
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2356
    then have lem4: "\<forall>j. a0 j = (if j = k then a3 j + 1 else a3 j)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2357
      unfolding a3_def by simp
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2358
    have "\<not> kle n a0 a3"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2359
      apply (rule notI)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2360
      apply (drule kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2361
      unfolding lem4[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2362
      apply (erule_tac x=k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2363
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2364
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2365
    then have "a3 \<notin> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2366
      using a0a1(4) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2367
    then have "a3 \<noteq> a1" "a3 \<noteq> a0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2368
      using a0a1 by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2369
    let ?s = "insert a3 (s - {a1})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2370
    have "ksimplex p n ?s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2371
      apply (rule ksimplexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2372
    proof (rule_tac[2-] ballI,rule_tac[4] ballI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2373
      show "card ?s = n+1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2374
        using ksimplexD(2-3)[OF assms(1)]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2375
        using `a3 \<noteq> a0` `a3 \<notin> s` `a1 \<in> s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2376
        by (auto simp add:card_insert_if)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2377
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2378
      assume x: "x \<in> insert a3 (s - {a1})"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2379
      show "\<forall>j. x j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2380
      proof
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2381
        fix j
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2382
        show "x j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2383
        proof (cases "x = a3")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2384
          case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2385
          then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2386
            using x ksimplexD(4)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2387
        next
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2388
          case True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2389
          show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2390
            unfolding True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2391
          proof (cases "j = k")
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2392
            case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2393
            then show "a3 j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2394
              unfolding True a3_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2395
              using `a0 \<in> s` ksimplexD(4)[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2396
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2397
          next
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2398
            case True
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2399
            obtain a4 where a4: "a4 \<in> s - {a}" "a4 k \<noteq> p"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2400
              using assms(5) k(1) by blast
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2401
            have "a3 k \<le> a0 k"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2402
              unfolding lem4[rule_format] by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2403
            also have "\<dots> \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2404
              using ksimplexD(4)[OF assms(1),rule_format, of a0 k] a0a1
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2405
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2406
            finally show "a3 j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2407
              unfolding True by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2408
          qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2409
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2410
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2411
      show "\<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2412
      proof (rule, rule)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2413
        fix j :: nat
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2414
        assume j: "j \<notin> {1..n}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2415
        show "x j = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2416
        proof (cases "x = a3")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2417
          case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2418
          then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2419
            using j x ksimplexD(5)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2420
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2421
          case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2422
          show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2423
            unfolding True a3_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2424
            using j k(1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2425
            using ksimplexD(5)[OF assms(1),rule_format,OF `a0\<in>s` j]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2426
            by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2427
        qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2428
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2429
      fix y
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2430
      assume y: "y \<in> insert a3 (s - {a1})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2431
      have lem4: "\<And>x. x \<in> s \<Longrightarrow> x \<noteq> a1 \<Longrightarrow> kle n a3 x"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2432
      proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2433
        case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2434
        then have *: "x\<in>s - {a1}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2435
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2436
        have "kle n a3 a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2437
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2438
          have "kle n a0 a1"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2439
            using a0a1 by auto
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2440
          then obtain kk where "kk \<subseteq> {1..n}" "(\<forall>j. a1 j = a0 j + (if j \<in> kk then 1 else 0))"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2441
            unfolding kle_def by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2442
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2443
            unfolding kle_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2444
            apply (rule_tac x=kk in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2445
            unfolding lem4[rule_format] k(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2446
            apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2447
            defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2448
          proof rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2449
            case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2450
            then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2451
              apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2452
              apply (erule_tac[!] x=j in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2453
              apply (cases "j \<in> kk")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2454
              apply (case_tac[!] "j=k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2455
              apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2456
              done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2457
          qed auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2458
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2459
        moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2460
        have "kle n a3 a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2461
          unfolding kle_def lem4[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2462
          apply (rule_tac x="{k}" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2463
          using k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2464
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2465
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2466
        ultimately
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2467
        show ?case
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2468
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2469
          apply (rule kle_between_l[of _ a0 _ a2])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2470
          using lem3[OF *]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2471
          using a0a1(4)[rule_format,OF goal1(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2472
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2473
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2474
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2475
      show "kle n x y \<or> kle n y x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2476
      proof (cases "y = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2477
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2478
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2479
          unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2480
          apply (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2481
          defer
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2482
          apply (rule disjI2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2483
          apply (rule lem4)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2484
          using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2485
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2486
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2487
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2488
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2489
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2490
        proof (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2491
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2492
          show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2493
            unfolding True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2494
            apply (rule disjI1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2495
            apply (rule lem4)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2496
            using y False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2497
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2498
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2499
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2500
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2501
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2502
            apply (rule_tac ksimplexD(6)[OF assms(1),rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2503
            using x y `y \<noteq> a3`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2504
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2505
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2506
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2507
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2508
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2509
    then have "insert a3 (s - {a1}) \<in> ?A"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2510
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2511
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2512
        apply (rule, assumption)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2513
        apply (rule_tac x = "a3" in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2514
        unfolding `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2515
        using `a3 \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2516
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2517
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2518
    moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2519
    have "s \<in> ?A"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2520
      using assms(1,2) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2521
    ultimately have "?A \<supseteq> {s, insert a3 (s - {a1})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2522
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2523
    moreover have "?A \<subseteq> {s, insert a3 (s - {a1})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2524
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2525
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2526
    proof (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2527
      fix s'
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2528
      assume as: "ksimplex p n s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2529
      assume "\<exists>b\<in>s'. s' - {b} = s - {a}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2530
      then obtain a' where a': "a' \<in> s'" "s' - {a'} = s - {a}" ..
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2531
      obtain a_min a_max where min_max:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2532
          "a_min \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2533
          "a_max \<in> s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2534
          "a_min \<noteq> a_max"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2535
          "\<forall>x\<in>s'. kle n a_min x \<and> kle n x a_max"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2536
          "\<forall>i. a_max i = (if i \<in> {1..n} then a_min i + 1 else a_min i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2537
        by (rule ksimplex_extrema_strong[OF as assms(3)])
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2538
      have *: "\<forall>x\<in>s' - {a'}. x k = a2 k" unfolding a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2539
      proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2540
        fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2541
        assume x: "x \<in> s - {a}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2542
        then have "kle n x a2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2543
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2544
          apply (rule lem3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2545
          using `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2546
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2547
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2548
        then have "x k \<le> a2 k"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2549
          apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2550
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2551
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2552
        moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2553
        {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2554
          have "a2 k \<le> a0 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2555
            using k(2)[rule_format,of k]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2556
            unfolding a0a1(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2557
            using k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2558
            by simp
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2559
          also have "\<dots> \<le> x k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2560
            using a0a1(4)[rule_format,of x,THEN conjunct1,THEN kle_imp_pointwise] x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2561
            by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2562
          finally have "a2 k \<le> x k" .
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2563
        }
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2564
        ultimately show "x k = a2 k"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2565
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2566
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2567
      have **: "a' = a_min \<or> a' = a_max"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2568
        apply (rule ksimplex_fix_plane[OF a'(1) k(1) *])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2569
        using min_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2570
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2571
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2572
      have "a2 \<noteq> a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2573
      proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2574
        assume as: "a2 = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2575
        show False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2576
          using k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2577
          unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2578
          apply (erule_tac x = k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2579
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2580
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2581
      qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2582
      then have a2': "a2 \<in> s' - {a'}"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2583
        unfolding a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2584
        using a2
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2585
        unfolding `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2586
        by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2587
      show "s' \<in> {s, insert a3 (s - {a1})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2588
      proof (cases "a' = a_min")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2589
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2590
        have "a_max \<in> s - {a1}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2591
          using min_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2592
          unfolding a'(2)[unfolded `a=a1`,symmetric] True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2593
          by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2594
        then have "a_max = a2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2595
          unfolding kle_antisym[symmetric,of a_max a2 n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2596
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2597
          apply rule
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2598
          apply (rule lem3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2599
          apply assumption
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2600
          apply (rule min_max(4)[rule_format,THEN conjunct2])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2601
          using a2'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2602
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2603
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2604
        then have a_max: "\<forall>i. a_max i = a2 i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2605
          by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2606
        have *: "\<forall>j. a2 j = (if j \<in> {1..n} then a3 j + 1 else a3 j)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2607
          using k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2608
          unfolding lem4[rule_format] a0a1(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2609
          apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2610
          apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2611
          apply (erule_tac x=j in allE)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2612
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2613
          case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2614
          then show ?case by (cases "j \<in> {1..n}", case_tac[!] "j = k") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2615
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2616
        have "\<forall>i. a_min i = a3 i"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2617
          using a_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2618
            apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2619
            apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2620
            apply (erule_tac x=i in allE)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2621
            unfolding min_max(5)[rule_format] *[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2622
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2623
          case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2624
          then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2625
            by (cases "i \<in> {1..n}") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2626
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2627
        then have "a_min = a3"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2628
          unfolding fun_eq_iff .
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2629
        then have "s' = insert a3 (s - {a1})"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2630
          using a'
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2631
          unfolding `a = a1` True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2632
          by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2633
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2634
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2635
      next
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2636
        case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2637
        then have as: "a' = a_max"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2638
          using ** by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2639
        have "a_min = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2640
          unfolding kle_antisym[symmetric,of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2641
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2642
          apply (rule min_max(4)[rule_format,THEN conjunct1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2643
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2644
          apply (rule a0a1(4)[rule_format,THEN conjunct1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2645
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2646
          have "a_min \<in> s - {a1}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2647
            using min_max(1,3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2648
            unfolding a'(2)[symmetric,unfolded `a=a1`] as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2649
            by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2650
          then show "a_min \<in> s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2651
            by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2652
          have "a0 \<in> s - {a1}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2653
            using a0a1(1-3) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2654
          then show "a0 \<in> s'"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2655
            unfolding a'(2)[symmetric,unfolded `a=a1`]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2656
            by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2657
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2658
        then have "\<forall>i. a_max i = a1 i"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2659
          unfolding a0a1(5)[rule_format] min_max(5)[rule_format]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2660
          by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2661
        then have "s' = s"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2662
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2663
          apply (rule lem1[OF a'(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2664
          using `a \<in> s` `a' \<in> s'`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2665
          unfolding as `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2666
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2667
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2668
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2669
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2670
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2671
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2672
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2673
    ultimately have *: "?A = {s, insert a3 (s - {a1})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2674
      by blast
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2675
    have "s \<noteq> insert a3 (s - {a1})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2676
      using `a3\<notin>s` by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2677
    then have ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2678
      unfolding * by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2679
  }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2680
  moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2681
  {
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2682
    assume as: "a \<noteq> a0" "a \<noteq> a1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2683
    have "\<not> (\<forall>x\<in>s. kle n a x)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2684
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2685
      case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2686
      have "a = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2687
        unfolding kle_antisym[symmetric,of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2688
        apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2689
        using goal1 a0a1 assms(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2690
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2691
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2692
      then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2693
        using as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2694
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2695
    then have "\<exists>y\<in>s. \<exists>k\<in>{1..n}. \<forall>j. a j = (if j = k then y j + 1 else y j)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2696
      using ksimplex_predecessor[OF assms(1-2)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2697
      by blast
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2698
    then obtain u k where u: "u \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2699
      and k: "k \<in> {1..n}" "\<And>j. a j = (if j = k then u j + 1 else u j)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2700
      by blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2701
    have "\<not> (\<forall>x\<in>s. kle n x a)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2702
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2703
      case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2704
      have "a = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2705
        unfolding kle_antisym[symmetric,of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2706
        apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2707
        using goal1 a0a1 assms(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2708
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2709
        done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2710
      then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2711
        using as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2712
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2713
    then have "\<exists>y\<in>s. \<exists>k\<in>{1..n}. \<forall>j. y j = (if j = k then a j + 1 else a j)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2714
      using ksimplex_successor[OF assms(1-2)] by blast
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2715
    then obtain v l where v: "v \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2716
      and l: "l \<in> {1..n}" "\<And>j. v j = (if j = l then a j + 1 else a j)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2717
      by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2718
    def a' \<equiv> "\<lambda>j. if j = l then u j + 1 else u j"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2719
    have kl: "k \<noteq> l"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2720
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2721
      assume "k = l"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2722
      have *: "\<And>P. (if P then (1::nat) else 0) \<noteq> 2"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2723
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2724
      then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2725
        using ksimplexD(6)[OF assms(1),rule_format,OF u v]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2726
        unfolding kle_def
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2727
        unfolding l(2) k(2) `k = l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2728
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2729
        apply (erule disjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2730
        apply (erule_tac[!] exE conjE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2731
        apply (erule_tac[!] x = l in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2732
        apply (auto simp add: *)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2733
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2734
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2735
    then have aa': "a' \<noteq> a"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2736
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2737
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2738
      unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2739
      unfolding a'_def k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2740
      apply (erule_tac x=l in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2741
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2742
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2743
    have "a' \<notin> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2744
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2745
      apply (drule ksimplexD(6)[OF assms(1),rule_format,OF `a\<in>s`])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2746
    proof (cases "kle n a a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2747
      case goal2
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2748
      then have "kle n a' a"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2749
        by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2750
      then show False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2751
        apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2752
        apply (erule_tac x=l in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2753
        unfolding a'_def k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2754
        using kl
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2755
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2756
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2757
    next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2758
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2759
      then show False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2760
        apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2761
        apply (erule_tac x=k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2762
        unfolding a'_def k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2763
        using kl
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2764
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2765
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2766
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2767
    have kle_uv: "kle n u a" "kle n u a'" "kle n a v" "kle n a' v"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2768
      unfolding kle_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2769
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2770
      apply (rule_tac[1] x="{k}" in exI,rule_tac[2] x="{l}" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2771
      apply (rule_tac[3] x="{l}" in exI,rule_tac[4] x="{k}" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2772
      unfolding l(2) k(2) a'_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2773
      using l(1) k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2774
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2775
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2776
    have uxv: "\<And>x. kle n u x \<Longrightarrow> kle n x v \<Longrightarrow> x = u \<or> x = a \<or> x = a' \<or> x = v"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2777
    proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2778
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2779
      then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2780
      proof (cases "x k = u k", case_tac[!] "x l = u l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2781
        assume as: "x l = u l" "x k = u k"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2782
        have "x = u"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2783
          unfolding fun_eq_iff
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2784
          using goal1(2)[THEN kle_imp_pointwise,unfolded l(2)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2785
          unfolding k(2)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2786
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2787
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2788
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2789
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2790
          apply (erule_tac x=xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2791
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2792
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2793
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2794
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2795
            apply (case_tac[!] "x = k")
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2796
            using as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2797
            by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2798
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2799
        then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2800
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2801
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2802
        assume as: "x l \<noteq> u l" "x k = u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2803
        have "x = a'"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2804
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2805
          unfolding a'_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2806
          using goal1(2)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2807
          unfolding l(2) k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2808
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2809
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2810
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2811
          apply (erule_tac x = xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2812
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2813
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2814
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2815
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2816
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2817
            using as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2818
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2819
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2820
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2821
        then show ?case by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2822
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2823
        assume as: "x l = u l" "x k \<noteq> u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2824
        have "x = a"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2825
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2826
          using goal1(2)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2827
          unfolding l(2) k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2828
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2829
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2830
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2831
          apply (erule_tac x=xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2832
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2833
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2834
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2835
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2836
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2837
            using as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2838
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2839
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2840
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2841
        then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2842
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2843
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2844
        assume as: "x l \<noteq> u l" "x k \<noteq> u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2845
        have "x = v"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2846
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2847
          using goal1(2)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2848
          unfolding l(2) k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2849
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2850
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2851
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2852
          apply (erule_tac x=xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2853
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2854
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2855
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2856
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2857
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2858
            using as `k \<noteq> l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2859
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2860
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2861
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2862
        then show ?case by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2863
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2864
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2865
    have uv: "kle n u v"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2866
      apply (rule kle_trans[OF kle_uv(1,3)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2867
      using ksimplexD(6)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2868
      using u v
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2869
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2870
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2871
    have lem3: "\<And>x. x \<in> s \<Longrightarrow> kle n v x \<Longrightarrow> kle n a' x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2872
      apply (rule kle_between_r[of _ u _ v])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2873
      prefer 3
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2874
      apply (rule kle_trans[OF uv])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2875
      defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2876
      apply (rule ksimplexD(6)[OF assms(1), rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2877
      using kle_uv `u \<in> s`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2878
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2879
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2880
    have lem4: "\<And>x. x \<in> s \<Longrightarrow> kle n x u \<Longrightarrow> kle n x a'"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2881
      apply (rule kle_between_l[of _ u _ v])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2882
      prefer 4
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2883
      apply (rule kle_trans[OF _ uv])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2884
      defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2885
      apply (rule ksimplexD(6)[OF assms(1), rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2886
      using kle_uv `v \<in> s`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2887
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2888
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2889
    have lem5: "\<And>x. x \<in> s \<Longrightarrow> x \<noteq> a \<Longrightarrow> kle n x a' \<or> kle n a' x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2890
    proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2891
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2892
      then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2893
      proof (cases "kle n v x \<or> kle n x u")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2894
        case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2895
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2896
          using goal1 by (auto intro: lem3 lem4)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2897
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2898
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2899
        then have *: "kle n u x" "kle n x v"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2900
          using ksimplexD(6)[OF assms(1)]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2901
          using goal1 `u \<in> s` `v \<in> s`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2902
          by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2903
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2904
          using uxv[OF *]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2905
          using kle_uv
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2906
          using goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2907
          by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2908
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2909
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2910
    have "ksimplex p n (insert a' (s - {a}))"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2911
      apply (rule ksimplexI)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2912
      apply (rule_tac[2-] ballI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2913
      apply (rule_tac[4] ballI)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2914
    proof -
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2915
      show "card (insert a' (s - {a})) = n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2916
        using ksimplexD(2-3)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2917
        using `a' \<noteq> a` `a' \<notin> s` `a \<in> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2918
        by (auto simp add:card_insert_if)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2919
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2920
      assume x: "x \<in> insert a' (s - {a})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2921
      show "\<forall>j. x j \<le> p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2922
      proof
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2923
        fix j
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2924
        show "x j \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2925
        proof (cases "x = a'")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2926
          case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2927
          then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2928
            using x ksimplexD(4)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2929
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2930
          case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2931
          show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2932
            unfolding True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2933
          proof (cases "j = l")
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2934
            case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2935
            then show "a' j \<le>p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2936
              unfolding True a'_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2937
              using `u\<in>s` ksimplexD(4)[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2938
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2939
          next
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2940
            case True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2941
            have *: "a l = u l" "v l = a l + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2942
              using k(2)[of l] l(2)[of l] `k \<noteq> l`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2943
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2944
            have "u l + 1 \<le> p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2945
              unfolding *[symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2946
              using ksimplexD(4)[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2947
              using `v \<in> s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2948
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2949
            then show "a' j \<le>p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2950
              unfolding a'_def True
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2951
              by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2952
          qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2953
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2954
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2955
      show "\<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2956
      proof (rule, rule)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2957
        fix j :: nat
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2958
        assume j: "j \<notin> {1..n}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2959
        show "x j = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2960
        proof (cases "x = a'")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2961
          case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2962
          then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2963
            using j x ksimplexD(5)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2964
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2965
          case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2966
          show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2967
            unfolding True a'_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2968
            using j l(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2969
            using ksimplexD(5)[OF assms(1),rule_format,OF `u\<in>s` j]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2970
            by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2971
        qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2972
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2973
      fix y
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2974
      assume y: "y \<in> insert a' (s - {a})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2975
      show "kle n x y \<or> kle n y x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2976
      proof (cases "y = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2977
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2978
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2979
          unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2980
          apply (cases "x = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2981
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2982
          apply (rule lem5)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2983
          using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2984
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2985
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2986
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2987
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2988
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2989
        proof (cases "x = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2990
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2991
          show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2992
            unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2993
            using lem5[of y] using y by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2994
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2995
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2996
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2997
            apply (rule_tac ksimplexD(6)[OF assms(1),rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2998
            using x y `y \<noteq> a'`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2999
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3000
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3001
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3002
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3003
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3004
    then have "insert a' (s - {a}) \<in> ?A"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3005
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3006
      apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3007
      apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3008
      apply assumption
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3009
      apply (rule_tac x = "a'" in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3010
      using aa' `a' \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3011
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3012
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3013
    moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3014
    have "s \<in> ?A"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3015
      using assms(1,2) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3016
    ultimately have  "?A \<supseteq> {s, insert a' (s - {a})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3017
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3018
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3019
    have "?A \<subseteq> {s, insert a' (s - {a})}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3020
      apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3021
      unfolding mem_Collect_eq
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3022
    proof (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3023
      fix s'
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3024
      assume as: "ksimplex p n s'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3025
      assume "\<exists>b\<in>s'. s' - {b} = s - {a}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3026
      then obtain a'' where a'': "a'' \<in> s'" "s' - {a''} = s - {a}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3027
        by blast
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3028
      have "u \<noteq> v"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3029
        unfolding fun_eq_iff l(2) k(2) by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3030
      then have uv': "\<not> kle n v u"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3031
        using uv using kle_antisym by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3032
      have "u \<noteq> a" "v \<noteq> a"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3033
        unfolding fun_eq_iff k(2) l(2) by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3034
      then have uvs': "u \<in> s'" "v \<in> s'"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3035
        using `u \<in> s` `v \<in> s` using a'' by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3036
      have lem6: "a \<in> s' \<or> a' \<in> s'"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3037
      proof (cases "\<forall>x\<in>s'. kle n x u \<or> kle n v x")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3038
        case False
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3039
        then obtain w where w: "w \<in> s'" "\<not> (kle n w u \<or> kle n v w)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3040
          by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3041
        then have "kle n u w" "kle n w v"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3042
          using ksimplexD(6)[OF as] uvs' by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3043
        then have "w = a' \<or> w = a"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3044
          using uxv[of w] uvs' w by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3045
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3046
          using w by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3047
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3048
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3049
        have "\<not> (\<forall>x\<in>s'. kle n x u)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3050
          unfolding ball_simps
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3051
          apply (rule_tac x=v in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3052
          using uv `u \<noteq> v`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3053
          unfolding kle_antisym [of n u v,symmetric]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3054
          using `v \<in> s'`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3055
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3056
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3057
        then have "\<exists>y\<in>s'. \<exists>k\<in>{1..n}. \<forall>j. y j = (if j = k then u j + 1 else u j)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3058
          using ksimplex_successor[OF as `u\<in>s'`]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3059
          by blast
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3060
        then obtain w where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3061
          w: "w \<in> s'" "\<exists>k\<in>{1..n}. \<forall>j. w j = (if j = k then u j + 1 else u j)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3062
          ..
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3063
        from this(2) obtain kk where kk:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3064
            "kk \<in> {1..n}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3065
            "\<And>j. w j = (if j = kk then u j + 1 else u j)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3066
          by blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3067
        have "\<not> kle n w u"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3068
          apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3069
          apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3070
          apply (drule kle_imp_pointwise)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3071
          apply (erule_tac x = kk in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3072
          unfolding kk
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3073
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3074
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3075
        then have *: "kle n v w"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3076
          using True[rule_format,OF w(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3077
          by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3078
        then have False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3079
        proof (cases "kk = l")
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3080
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3081
          then show False using *[THEN kle_imp_pointwise, unfolded l(2) kk k(2)]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3082
            apply (erule_tac x=l in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3083
            using `k \<noteq> l`
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3084
            apply auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3085
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3086
        next
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3087
          case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3088
          then have "kk \<noteq> k" using `k \<noteq> l` by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3089
          then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3090
            using *[THEN kle_imp_pointwise, unfolded l(2) kk k(2)]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3091
            apply (erule_tac x=k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3092
            using `k \<noteq> l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3093
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3094
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3095
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3096
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3097
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3098
      qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3099
      then show "s' \<in> {s, insert a' (s - {a})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3100
      proof (cases "a \<in> s'")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3101
        case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3102
        then have "s' = s"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3103
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3104
          apply (rule lem1[OF a''(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3105
          using a'' `a \<in> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3106
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3107
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3108
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3109
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3110
      next
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3111
        case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3112
        then have "a' \<in> s'"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3113
          using lem6 by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3114
        then have "s' = insert a' (s - {a})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3115
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3116
          apply (rule lem1[of _ a'' _ a'])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3117
          unfolding a''(2)[symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3118
          using a'' and `a' \<notin> s`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3119
          by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3120
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3121
          by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3122
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3123
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3124
    ultimately have *: "?A = {s, insert a' (s - {a})}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3125
      by blast
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3126
    have "s \<noteq> insert a' (s - {a})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3127
      using `a'\<notin>s` by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3128
    then have ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3129
      unfolding * by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3130
  }
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3131
  ultimately show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3132
    by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3133
qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3134
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3135
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3136
text {* Hence another step towards concreteness. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3137
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3138
lemma kuhn_simplex_lemma:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3139
  assumes "\<forall>s. ksimplex p (n + 1) s \<longrightarrow> rl ` s \<subseteq> {0..n+1}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3140
    and "odd (card {f. \<exists>s a. ksimplex p (n + 1) s \<and> a \<in> s \<and> (f = s - {a}) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3141
      rl ` f = {0 .. n} \<and> ((\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = p))})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3142
  shows "odd (card {s \<in> {s. ksimplex p (n + 1) s}. rl ` s = {0..n+1}})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3143
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3144
  have *: "\<And>x y. x = y \<Longrightarrow> odd (card x) \<Longrightarrow> odd (card y)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3145
    by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3146
  have *: "odd (card {f \<in> {f. \<exists>s\<in>{s. ksimplex p (n + 1) s}. (\<exists>a\<in>s. f = s - {a})}.
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3147
    rl ` f = {0..n} \<and> ((\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = p))})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3148
    apply (rule *[OF _ assms(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3149
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3150
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3151
  show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3152
    apply (rule kuhn_complete_lemma[OF finite_simplices])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3153
    prefer 6
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3154
    apply (rule *)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3155
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3156
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3157
    apply rule
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3158
    apply (subst ksimplex_def)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3159
    defer
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3160
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3161
    apply (rule assms(1)[rule_format])
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3162
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3163
    apply assumption
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3164
    apply default+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3165
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3166
    apply (erule disjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3167
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3168
    apply (erule disjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3169
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3170
    apply default+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3171
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3172
    apply (erule disjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3173
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3174
  proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3175
    fix f s a
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3176
    assume as: "ksimplex p (n + 1) s" "a \<in> s" "f = s - {a}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3177
    let ?S = "{s. ksimplex p (n + 1) s \<and> (\<exists>a\<in>s. f = s - {a})}"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3178
    have S: "?S = {s'. ksimplex p (n + 1) s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3179
      unfolding as by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3180
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3181
      fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3182
      assume j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3183
      then show "card {s. ksimplex p (n + 1) s \<and> (\<exists>a\<in>s. f = s - {a})} = 1"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3184
        unfolding S
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3185
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3186
        apply (rule ksimplex_replace_0)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3187
        apply (rule as)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3188
        unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3189
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3190
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3191
    }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3192
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3193
      fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3194
      assume j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = p"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3195
      then show "card {s. ksimplex p (n + 1) s \<and> (\<exists>a\<in>s. f = s - {a})} = 1"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3196
        unfolding S
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3197
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3198
        apply (rule ksimplex_replace_1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3199
        apply (rule as)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3200
        unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3201
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3202
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3203
    }
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3204
    show "\<not> ((\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = p)) \<Longrightarrow> card ?S = 2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3205
      unfolding S
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3206
      apply (rule ksimplex_replace_2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3207
      apply (rule as)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3208
      unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3209
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3210
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3211
  qed auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3212
qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3213
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3214
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3215
subsection {* Reduced labelling *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3216
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3217
definition "reduced label (n::nat) (x::nat \<Rightarrow> nat) =
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3218
  (SOME k. k \<le> n \<and> (\<forall>i. 1 \<le> i \<and> i < k + 1 \<longrightarrow> label x i = 0) \<and>
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3219
    (k = n \<or> label x (k + 1) \<noteq> (0::nat)))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3220
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3221
lemma reduced_labelling:
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3222
  shows "reduced label n x \<le> n" (is ?t1)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3223
    and "\<forall>i. 1 \<le> i \<and> i < reduced label n x + 1 \<longrightarrow> label x i = 0" (is ?t2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3224
    and "reduced label n x = n \<or> label x (reduced label n x + 1) \<noteq> 0"  (is ?t3)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3225
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3226
  have num_WOP: "\<And>P k. P (k::nat) \<Longrightarrow> \<exists>n. P n \<and> (\<forall>m<n. \<not> P m)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3227
    apply (drule ex_has_least_nat[where m="\<lambda>x. x"])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3228
    apply (erule exE)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3229
    apply (rule_tac x=x in exI)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3230
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3231
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3232
  have *: "n \<le> n \<and> (label x (n + 1) \<noteq> 0 \<or> n = n)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3233
    by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3234
  then obtain N where N:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3235
      "N \<le> n \<and> (label x (N + 1) \<noteq> 0 \<or> n = N)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3236
      "\<forall>m<N. \<not> (m \<le> n \<and> (label x (m + 1) \<noteq> 0 \<or> n = m))"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3237
    apply (drule_tac num_WOP[of "\<lambda>j. j\<le>n \<and> (label x (j+1) \<noteq> 0 \<or> n = j)"])
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3238
    apply blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3239
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3240
  have N': "N \<le> n"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3241
    "\<forall>i. 1 \<le> i \<and> i < N + 1 \<longrightarrow> label x i = 0" "N = n \<or> label x (N + 1) \<noteq> 0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3242
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3243
  proof (rule, rule)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3244
    fix i
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3245
    assume i: "1 \<le> i \<and> i < N + 1"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3246
    then show "label x i = 0"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3247
      using N(2)[THEN spec[where x="i - 1"]]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3248
      using N
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3249
      by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3250
  qed (insert N(1), auto)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3251
  show ?t1 ?t2 ?t3
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3252
    unfolding reduced_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3253
    apply (rule_tac[!] someI2_ex)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3254
    using N'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3255
    apply (auto intro!: exI[where x=N])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3256
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3257
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3258
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3259
lemma reduced_labelling_unique:
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3260
  fixes x :: "nat \<Rightarrow> nat"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3261
  assumes "r \<le> n"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3262
    and "\<forall>i. 1 \<le> i \<and> i < r + 1 \<longrightarrow> label x i = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3263
    and "r = n \<or> label x (r + 1) \<noteq> 0"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3264
  shows "reduced label n x = r"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3265
  apply (rule le_antisym)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3266
  apply (rule_tac[!] ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3267
  unfolding not_le
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3268
  using reduced_labelling[of label n x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3269
  using assms
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3270
  apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3271
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3272
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3273
lemma reduced_labelling_zero:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3274
  assumes "j \<in> {1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3275
    and "label x j = 0"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3276
  shows "reduced label n x \<noteq> j - 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3277
  using reduced_labelling[of label n x]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3278
  using assms
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3279
  by fastforce
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3280
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3281
lemma reduced_labelling_nonzero:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3282
  assumes "j\<in>{1..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3283
    and "label x j \<noteq> 0"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3284
  shows "reduced label n x < j"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3285
  using assms and reduced_labelling[of label n x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3286
  apply (erule_tac x=j in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3287
  apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3288
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3289
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3290
lemma reduced_labelling_Suc:
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3291
  assumes "reduced lab (n + 1) x \<noteq> n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3292
  shows "reduced lab (n + 1) x = reduced lab n x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3293
  apply (subst eq_commute)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3294
  apply (rule reduced_labelling_unique)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3295
  using reduced_labelling[of lab "n+1" x] and assms
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3296
  apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3297
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3298
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3299
lemma complete_face_top:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3300
  assumes "\<forall>x\<in>f. \<forall>j\<in>{1..n+1}. x j = 0 \<longrightarrow> lab x j = 0"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3301
    and "\<forall>x\<in>f. \<forall>j\<in>{1..n+1}. x j = p \<longrightarrow> lab x j = 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3302
  shows "reduced lab (n + 1) ` f = {0..n} \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3303
      ((\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = p)) \<longleftrightarrow>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3304
    reduced lab (n + 1) ` f = {0..n} \<and> (\<forall>x\<in>f. x (n + 1) = p)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3305
    (is "?l = ?r")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3306
proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3307
  assume ?l (is "?as \<and> (?a \<or> ?b)")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3308
  then show ?r
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3309
    apply -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3310
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3311
    apply (erule conjE)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3312
    apply assumption
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3313
  proof (cases ?a)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3314
    case True
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3315
    then obtain j where j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = 0" ..
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3316
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3317
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3318
      assume x: "x \<in> f"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3319
      have "reduced lab (n + 1) x \<noteq> j - 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3320
        using j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3321
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3322
        apply (rule reduced_labelling_zero)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3323
        defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3324
        apply (rule assms(1)[rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3325
        using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3326
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3327
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3328
    }
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3329
    moreover have "j - 1 \<in> {0..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3330
      using j by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3331
    then obtain y where y:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3332
      "y \<in> f"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3333
      "j - 1 = reduced lab (n + 1) y"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3334
      unfolding `?l`[THEN conjunct1,symmetric] and image_iff ..
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3335
    ultimately
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3336
    have False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3337
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3338
    then show "\<forall>x\<in>f. x (n + 1) = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3339
      by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3340
  next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3341
    case False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3342
    then have ?b using `?l`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3343
      by blast
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3344
    then obtain j where j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = p" ..
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3345
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3346
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3347
      assume x: "x \<in> f"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3348
      have "reduced lab (n + 1) x < j"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3349
        using j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3350
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3351
        apply (rule reduced_labelling_nonzero)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3352
        using assms(2)[rule_format,of x j] and x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3353
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3354
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3355
    } note * = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3356
    have "j = n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3357
    proof (rule ccontr)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3358
      assume "\<not> ?thesis"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3359
      then have "j < n + 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3360
        using j by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3361
      moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3362
      have "n \<in> {0..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3363
        by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3364
      then obtain y where "y \<in> f" "n = reduced lab (n + 1) y"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3365
        unfolding `?l`[THEN conjunct1,symmetric] image_iff ..
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3366
      ultimately
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3367
      show False
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3368
        using *[of y] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3369
    qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3370
    then show "\<forall>x\<in>f. x (n + 1) = p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3371
      using j by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  3372
  qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3373
qed auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3374
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3375
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3376
text {* Hence we get just about the nice induction. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3377
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3378
lemma kuhn_induction:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3379
  assumes "0 < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3380
    and "\<forall>x. \<forall>j\<in>{1..n+1}. (\<forall>j. x j \<le> p) \<and> x j = 0 \<longrightarrow> lab x j = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3381
    and "\<forall>x. \<forall>j\<in>{1..n+1}. (\<forall>j. x j \<le> p) \<and> x j = p \<longrightarrow> lab x j = 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3382
    and "odd (card {f. ksimplex p n f \<and> reduced lab n ` f = {0..n}})"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3383
  shows "odd (card {s. ksimplex p (n + 1) s \<and> reduced lab (n + 1) `  s = {0..n+1}})"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3384
proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3385
  have *: "\<And>s t. odd (card s) \<Longrightarrow> s = t \<Longrightarrow> odd (card t)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3386
    "\<And>s f. (\<And>x. f x \<le> n + 1) \<Longrightarrow> f ` s \<subseteq> {0..n+1}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3387
    by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3388
  show ?thesis
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3389
    apply (rule kuhn_simplex_lemma[unfolded mem_Collect_eq])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3390
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3391
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3392
    apply (rule *)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3393
    apply (rule reduced_labelling)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3394
    apply (rule *(1)[OF assms(4)])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3395
    apply (rule set_eqI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3396
    unfolding mem_Collect_eq
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3397
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3398
    apply (erule conjE)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3399
    defer
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3400
    apply rule
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3401
  proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3402
    fix f
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3403
    assume as: "ksimplex p n f" "reduced lab n ` f = {0..n}"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3404
    have *: "\<forall>x\<in>f. \<forall>j\<in>{1..n + 1}. x j = 0 \<longrightarrow> lab x j = 0"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3405
      "\<forall>x\<in>f. \<forall>j\<in>{1..n + 1}. x j = p \<longrightarrow> lab x j = 1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3406
      using assms(2-3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3407
      using as(1)[unfolded ksimplex_def]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3408
      by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3409
    have allp: "\<forall>x\<in>f. x (n + 1) = p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3410
      using assms(2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3411
      using as(1)[unfolded ksimplex_def]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3412
      by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3413
    {
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3414
      fix x
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3415
      assume "x \<in> f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3416
      then have "reduced lab (n + 1) x < n + 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3417
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3418
        apply (rule reduced_labelling_nonzero)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3419
        defer
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3420
        using assms(3)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3421
        using as(1)[unfolded ksimplex_def]
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3422
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3423
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3424
      then have "reduced lab (n + 1) x = reduced lab n x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3425
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3426
        apply (rule reduced_labelling_Suc)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3427
        using reduced_labelling(1)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3428
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3429
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3430
    }
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3431
    then have "reduced lab (n + 1) ` f = {0..n}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3432
      unfolding as(2)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3433
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3434
      apply (rule set_eqI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3435
      unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3436
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3437
      done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3438
    moreover
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3439
    obtain s a where "ksimplex p (n + 1) s \<and> a \<in> s \<and> f = s - {a}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3440
      using as(1)[unfolded simplex_top_face[OF assms(1) allp,symmetric]] by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3441
    ultimately show "\<exists>s a. ksimplex p (n + 1) s \<and>
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  3442
        a \<in> s \<and> f = s - {a} \<and>
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  3443
        reduced lab (n + 1) ` f = {0..n} \<and>
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  3444
        ((\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = p))"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3445
      apply (rule_tac x = s in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3446
      apply (rule_tac x = a in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3447
      unfolding complete_face_top[OF *]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3448
      using allp as(1)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3449
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3450
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3451
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3452
    fix f
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3453
    assume as: "\<exists>s a. ksimplex p (n + 1) s \<and>
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  3454
      a \<in> s \<and> f = s - {a} \<and> reduced lab (n + 1) ` f = {0..n} \<and>
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  3455
      ((\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = p))"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3456
    then obtain s a where sa:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3457
        "ksimplex p (n + 1) s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3458
        "a \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3459
        "f = s - {a}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3460
        "reduced lab (n + 1) ` f = {0..n}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3461
        "(\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = p)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3462
      by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3463
    {
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3464
      fix x
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3465
      assume "x \<in> f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3466
      then have "reduced lab (n + 1) x \<in> reduced lab (n + 1) ` f"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3467
        by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3468
      then have "reduced lab (n + 1) x < n + 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3469
        using sa(4) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3470
      then have "reduced lab (n + 1) x = reduced lab n x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3471
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3472
        apply (rule reduced_labelling_Suc)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3473
        using reduced_labelling(1)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3474
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3475
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3476
    }
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3477
    then show part1: "reduced lab n ` f = {0..n}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3478
      unfolding sa(4)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3479
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3480
      apply (rule set_eqI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3481
      unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3482
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3483
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3484
    have *: "\<forall>x\<in>f. x (n + 1) = p"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3485
    proof (cases "\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = 0")
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3486
      case True
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3487
      then obtain j where "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = 0" ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3488
      then have "\<And>x. x \<in> f \<Longrightarrow> reduced lab (n + 1) x \<noteq> j - 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3489
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3490
        apply (rule reduced_labelling_zero)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3491
        apply assumption
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3492
        apply (rule assms(2)[rule_format])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3493
        using sa(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3494
        unfolding sa
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3495
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3496
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3497
      moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3498
      have "j - 1 \<in> {0..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3499
        using `j\<in>{1..n+1}` by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3500
      ultimately have False
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3501
        unfolding sa(4)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3502
        unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3503
        by fastforce
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3504
      then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3505
        by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3506
    next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3507
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3508
      then have "\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = p"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3509
        using sa(5) by fastforce
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3510
      then obtain j where j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = p" ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3511
      then show ?thesis
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3512
      proof (cases "j = n + 1")
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3513
        case False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3514
        then have *: "j \<in> {1..n}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3515
          using j by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3516
        then have "\<And>x. x \<in> f \<Longrightarrow> reduced lab n x < j"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3517
          apply (rule reduced_labelling_nonzero)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3518
        proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3519
          fix x
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3520
          assume "x \<in> f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3521
          then have "lab x j = 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3522
            apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3523
            apply (rule assms(3)[rule_format,OF j(1)])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3524
            using sa(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3525
            using j
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3526
            unfolding sa
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3527
            apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3528
            done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3529
          then show "lab x j \<noteq> 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3530
            by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3531
        qed
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3532
        moreover have "j \<in> {0..n}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3533
          using * by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3534
        ultimately have False
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3535
          unfolding part1[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3536
          using * unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3537
          by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3538
        then show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3539
          by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3540
      qed auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3541
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3542
    then show "ksimplex p n f"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3543
      using as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3544
      unfolding simplex_top_face[OF assms(1) *,symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3545
      by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3546
  qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3547
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3548
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3549
lemma kuhn_induction_Suc:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3550
  assumes "0 < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3551
    and "\<forall>x. \<forall>j\<in>{1..Suc n}. (\<forall>j. x j \<le> p) \<and> x j = 0 \<longrightarrow> lab x j = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3552
    and "\<forall>x. \<forall>j\<in>{1..Suc n}. (\<forall>j. x j \<le> p) \<and> x j = p \<longrightarrow> lab x j = 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3553
    and "odd (card {f. ksimplex p n f \<and> reduced lab n ` f = {0..n}})"
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  3554
  shows "odd (card {s. ksimplex p (Suc n) s \<and> reduced lab (Suc n) ` s = {0..Suc n}})"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3555
  using assms
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3556
  unfolding Suc_eq_plus1
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3557
  by (rule kuhn_induction)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3558
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3559
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3560
text {* And so we get the final combinatorial result. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3561
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3562
lemma ksimplex_0: "ksimplex p 0 s \<longleftrightarrow> s = {(\<lambda>x. p)}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3563
  (is "?l = ?r")
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3564
proof
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3565
  assume l: ?l
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3566
  obtain a where a: "a \<in> s" "\<forall>y y'. y \<in> s \<and> y' \<in> s \<longrightarrow> y = y'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3567
    using ksimplexD(3)[OF l, unfolded add_0]
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3568
    unfolding card_1_exists ..
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3569
  have "a = (\<lambda>x. p)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3570
    using ksimplexD(5)[OF l, rule_format, OF a(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3571
    by rule auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3572
  then show ?r
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3573
    using a by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3574
next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3575
  assume r: ?r
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3576
  show ?l
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3577
    unfolding r ksimplex_eq by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3578
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3579
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3580
lemma reduce_labelling_zero[simp]: "reduced lab 0 x = 0"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3581
  by (rule reduced_labelling_unique) auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3582
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3583
lemma kuhn_combinatorial:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3584
  assumes "0 < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3585
    and "\<forall>x j. (\<forall>j. x j \<le> p) \<and> 1 \<le> j \<and> j \<le> n \<and> x j = 0 \<longrightarrow> lab x j = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3586
    and "\<forall>x j. (\<forall>j. x j \<le> p) \<and> 1 \<le> j \<and> j \<le> n  \<and> x j = p \<longrightarrow> lab x j = 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3587
  shows "odd (card {s. ksimplex p n s \<and> reduced lab n ` s = {0..n}})"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3588
  using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3589
proof (induct n)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3590
  let ?M = "\<lambda>n. {s. ksimplex p n s \<and> reduced lab n ` s = {0..n}}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3591
  {
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3592
    case 0
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3593
    have *: "?M 0 = {{\<lambda>x. p}}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3594
      unfolding ksimplex_0 by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3595
    show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3596
      unfolding * by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3597
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3598
    case (Suc n)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3599
    have "odd (card (?M n))"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3600
      apply (rule Suc(1)[OF Suc(2)])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3601
      using Suc(3-)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3602
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3603
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3604
    then show ?case
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3605
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3606
      apply (rule kuhn_induction_Suc)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3607
      using Suc(2-)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3608
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3609
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3610
  }
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3611
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3612
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3613
lemma kuhn_lemma:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3614
  fixes n p :: nat
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3615
  assumes "0 < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3616
    and "0 < n"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3617
    and "\<forall>x. (\<forall>i\<in>{1..n}. x i \<le> p) \<longrightarrow> (\<forall>i\<in>{1..n}. label x i = (0::nat) \<or> label x i = 1)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3618
    and "\<forall>x. (\<forall>i\<in>{1..n}. x i \<le> p) \<longrightarrow> (\<forall>i\<in>{1..n}. x i = 0 \<longrightarrow> label x i = 0)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3619
    and "\<forall>x. (\<forall>i\<in>{1..n}. x i \<le> p) \<longrightarrow> (\<forall>i\<in>{1..n}. x i = p \<longrightarrow> label x i = 1)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3620
  obtains q where "\<forall>i\<in>{1..n}. q i < p"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3621
    and "\<forall>i\<in>{1..n}. \<exists>r s.
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3622
      (\<forall>j\<in>{1..n}. q j \<le> r j \<and> r j \<le> q j + 1) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3623
      (\<forall>j\<in>{1..n}. q j \<le> s j \<and> s j \<le> q j + 1) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3624
      label r i \<noteq> label s i"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3625
proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3626
  let ?A = "{s. ksimplex p n s \<and> reduced label n ` s = {0..n}}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3627
  have "n \<noteq> 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3628
    using assms by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3629
  have conjD: "\<And>P Q. P \<and> Q \<Longrightarrow> P" "\<And>P Q. P \<and> Q \<Longrightarrow> Q"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3630
    by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3631
  have "odd (card ?A)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3632
    apply (rule kuhn_combinatorial[of p n label])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3633
    using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3634
    apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3635
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3636
  then have "card ?A \<noteq> 0"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3637
    apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3638
    apply (rule ccontr)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3639
    apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3640
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3641
  then have "?A \<noteq> {}"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3642
    unfolding card_eq_0_iff by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3643
  then obtain s where "s \<in> ?A"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3644
    by auto note s=conjD[OF this[unfolded mem_Collect_eq]]
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3645
  obtain a b where ab:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3646
      "a \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3647
      "b \<in> s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3648
      "a \<noteq> b"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3649
      "\<forall>x\<in>s. kle n a x \<and> kle n x b"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3650
      "\<forall>i. b i = (if i \<in> {1..n} then a i + 1 else a i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3651
    by (rule ksimplex_extrema_strong[OF s(1) `n \<noteq> 0`])
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3652
  show ?thesis
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3653
    apply (rule that[of a])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3654
    apply (rule_tac[!] ballI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3655
  proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3656
    fix i
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3657
    assume "i \<in> {1..n}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3658
    then have "a i + 1 \<le> p"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3659
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3660
      apply (rule order_trans[of _ "b i"])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3661
      apply (subst ab(5)[THEN spec[where x=i]])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3662
      using s(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3663
      defer
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3664
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3665
      apply (erule conjE)+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3666
      apply (drule_tac bspec[OF _ ab(2)])+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3667
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3668
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3669
    then show "a i < p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3670
      by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3671
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3672
    case goal2
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3673
    then have "i \<in> reduced label n ` s"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3674
      using s by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3675
    then obtain u where u: "u \<in> s" "i = reduced label n u"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3676
      unfolding image_iff ..
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3677
    from goal2 have "i - 1 \<in> reduced label n ` s"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3678
      using s by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3679
    then obtain v where v: "v \<in> s" "i - 1 = reduced label n v"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3680
      unfolding image_iff ..
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3681
    show ?case
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3682
      apply (rule_tac x = u in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3683
      apply (rule_tac x = v in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3684
      apply (rule conjI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3685
      defer
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3686
      apply (rule conjI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3687
      defer 2
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3688
      apply (rule_tac[1-2] ballI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3689
    proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3690
      show "label u i \<noteq> label v i"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3691
        using reduced_labelling [of label n u] reduced_labelling [of label n v]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3692
        unfolding u(2)[symmetric] v(2)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3693
        using goal2
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3694
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3695
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3696
      fix j
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3697
      assume j: "j \<in> {1..n}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3698
      show "a j \<le> u j \<and> u j \<le> a j + 1" and "a j \<le> v j \<and> v j \<le> a j + 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3699
        using conjD[OF ab(4)[rule_format, OF u(1)]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3700
          and conjD[OF ab(4)[rule_format, OF v(1)]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3701
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3702
        apply (drule_tac[!] kle_imp_pointwise)+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3703
        apply (erule_tac[!] x=j in allE)+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3704
        unfolding ab(5)[rule_format]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3705
        using j
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3706
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3707
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3708
    qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3709
  qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3710
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3711
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3712
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3713
subsection {* The main result for the unit cube *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3714
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3715
lemma kuhn_labelling_lemma':
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3716
  assumes "(\<forall>x::nat\<Rightarrow>real. P x \<longrightarrow> P (f x))"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3717
    and "\<forall>x. P x \<longrightarrow> (\<forall>i::nat. Q i \<longrightarrow> 0 \<le> x i \<and> x i \<le> 1)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3718
  shows "\<exists>l. (\<forall>x i. l x i \<le> (1::nat)) \<and>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3719
             (\<forall>x i. P x \<and> Q i \<and> x i = 0 \<longrightarrow> l x i = 0) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3720
             (\<forall>x i. P x \<and> Q i \<and> x i = 1 \<longrightarrow> l x i = 1) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3721
             (\<forall>x i. P x \<and> Q i \<and> l x i = 0 \<longrightarrow> x i \<le> f x i) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3722
             (\<forall>x i. P x \<and> Q i \<and> l x i = 1 \<longrightarrow> f x i \<le> x i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3723
proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3724
  have and_forall_thm: "\<And>P Q. (\<forall>x. P x) \<and> (\<forall>x. Q x) \<longleftrightarrow> (\<forall>x. P x \<and> Q x)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3725
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3726
  have *: "\<forall>x y::real. 0 \<le> x \<and> x \<le> 1 \<and> 0 \<le> y \<and> y \<le> 1 \<longrightarrow> x \<noteq> 1 \<and> x \<le> y \<or> x \<noteq> 0 \<and> y \<le> x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3727
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3728
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3729
    unfolding and_forall_thm
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3730
    apply (subst choice_iff[symmetric])+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3731
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3732
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3733
  proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3734
    case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3735
    let ?R = "\<lambda>y::nat.
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3736
      (P x \<and> Q xa \<and> x xa = 0 \<longrightarrow> y = 0) \<and>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3737
      (P x \<and> Q xa \<and> x xa = 1 \<longrightarrow> y = 1) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3738
      (P x \<and> Q xa \<and> y = 0 \<longrightarrow> x xa \<le> (f x) xa) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3739
      (P x \<and> Q xa \<and> y = 1 \<longrightarrow> (f x) xa \<le> x xa)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3740
    {
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3741
      assume "P x" and "Q xa"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3742
      then have "0 \<le> f x xa \<and> f x xa \<le> 1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3743
        using assms(2)[rule_format,of "f x" xa]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3744
        apply (drule_tac assms(1)[rule_format])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3745
        apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3746
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3747
    }
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3748
    then have "?R 0 \<or> ?R 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3749
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3750
    then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3751
      by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3752
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3753
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3754
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3755
definition unit_cube :: "'a::euclidean_space set"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3756
  where "unit_cube = {x. \<forall>i\<in>Basis. 0 \<le> x \<bullet> i \<and> x \<bullet> i \<le> 1}"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3757
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3758
lemma mem_unit_cube: "x \<in> unit_cube \<longleftrightarrow> (\<forall>i\<in>Basis. 0 \<le> x \<bullet> i \<and> x \<bullet> i \<le> 1)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3759
  unfolding unit_cube_def by simp
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3760
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3761
lemma bounded_unit_cube: "bounded unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3762
  unfolding bounded_def
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3763
proof (intro exI ballI)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3764
  fix y :: 'a assume y: "y \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3765
  have "dist 0 y = norm y" by (rule dist_0_norm)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3766
  also have "\<dots> = norm (\<Sum>i\<in>Basis. (y \<bullet> i) *\<^sub>R i)" unfolding euclidean_representation ..
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3767
  also have "\<dots> \<le> (\<Sum>i\<in>Basis. norm ((y \<bullet> i) *\<^sub>R i))" by (rule norm_setsum)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3768
  also have "\<dots> \<le> (\<Sum>i::'a\<in>Basis. 1)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3769
    by (rule setsum_mono, simp add: y [unfolded mem_unit_cube])
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3770
  finally show "dist 0 y \<le> (\<Sum>i::'a\<in>Basis. 1)" .
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3771
qed
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3772
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3773
lemma closed_unit_cube: "closed unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3774
  unfolding unit_cube_def Collect_ball_eq Collect_conj_eq
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3775
  by (rule closed_INT, auto intro!: closed_Collect_le)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3776
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3777
lemma compact_unit_cube: "compact unit_cube" (is "compact ?C")
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3778
  unfolding compact_eq_seq_compact_metric
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3779
  using bounded_unit_cube closed_unit_cube
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3780
  by (rule bounded_closed_imp_seq_compact)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3781
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3782
lemma brouwer_cube:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3783
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3784
  assumes "continuous_on unit_cube f"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3785
    and "f ` unit_cube \<subseteq> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3786
  shows "\<exists>x\<in>unit_cube. f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3787
proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3788
  def n \<equiv> "DIM('a)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3789
  have n: "1 \<le> n" "0 < n" "n \<noteq> 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3790
    unfolding n_def by (auto simp add: Suc_le_eq DIM_positive)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3791
  assume "\<not> ?thesis"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3792
  then have *: "\<not> (\<exists>x\<in>unit_cube. f x - x = 0)"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3793
    by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3794
  obtain d where
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3795
      d: "d > 0" "\<And>x. x \<in> unit_cube \<Longrightarrow> d \<le> norm (f x - x)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3796
    apply (rule brouwer_compactness_lemma[OF compact_unit_cube _ *])
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3797
    apply (rule continuous_on_intros assms)+
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3798
    apply blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3799
    done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3800
  have *: "\<forall>x. x \<in> unit_cube \<longrightarrow> f x \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3801
    "\<forall>x. x \<in> (unit_cube::'a set) \<longrightarrow> (\<forall>i\<in>Basis. True \<longrightarrow> 0 \<le> x \<bullet> i \<and> x \<bullet> i \<le> 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3802
    using assms(2)[unfolded image_subset_iff Ball_def]
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3803
    unfolding mem_unit_cube
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3804
    by auto
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3805
  obtain label :: "'a \<Rightarrow> 'a \<Rightarrow> nat" where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3806
    "\<forall>x. \<forall>i\<in>Basis. label x i \<le> 1"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3807
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> x \<bullet> i = 0 \<longrightarrow> label x i = 0"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3808
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> x \<bullet> i = 1 \<longrightarrow> label x i = 1"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3809
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> label x i = 0 \<longrightarrow> x \<bullet> i \<le> f x \<bullet> i"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3810
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> label x i = 1 \<longrightarrow> f x \<bullet> i \<le> x \<bullet> i"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3811
    using kuhn_labelling_lemma[OF *] by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3812
  note label = this [rule_format]
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3813
  have lem1: "\<forall>x\<in>unit_cube. \<forall>y\<in>unit_cube. \<forall>i\<in>Basis. label x i \<noteq> label y i \<longrightarrow>
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3814
    abs (f x \<bullet> i - x \<bullet> i) \<le> norm (f y - f x) + norm (y - x)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3815
  proof safe
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3816
    fix x y :: 'a
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3817
    assume x: "x \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3818
    assume y: "y \<in> unit_cube"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3819
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3820
    assume i: "label x i \<noteq> label y i" "i \<in> Basis"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3821
    have *: "\<And>x y fx fy :: real. x \<le> fx \<and> fy \<le> y \<or> fx \<le> x \<and> y \<le> fy \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3822
      abs (fx - x) \<le> abs (fy - fx) + abs (y - x)" by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3823
    have "\<bar>(f x - x) \<bullet> i\<bar> \<le> abs ((f y - f x)\<bullet>i) + abs ((y - x)\<bullet>i)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3824
      unfolding inner_simps
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3825
      apply (rule *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3826
      apply (cases "label x i = 0")
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3827
      apply (rule disjI1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3828
      apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3829
      prefer 3
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3830
      apply (rule disjI2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3831
      apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3832
    proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3833
      assume lx: "label x i = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3834
      then have ly: "label y i = 1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3835
        using i label(1)[of i y]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3836
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3837
      show "x \<bullet> i \<le> f x \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3838
        apply (rule label(4)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3839
        using x y lx i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3840
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3841
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3842
      show "f y \<bullet> i \<le> y \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3843
        apply (rule label(5)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3844
        using x y ly i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3845
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3846
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3847
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3848
      assume "label x i \<noteq> 0"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3849
      then have l: "label x i = 1" "label y i = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3850
        using i label(1)[of i x] label(1)[of i y]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3851
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3852
      show "f x \<bullet> i \<le> x \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3853
        apply (rule label(5)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3854
        using x y l i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3855
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3856
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3857
      show "y \<bullet> i \<le> f y \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3858
        apply (rule label(4)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3859
        using x y l i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3860
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3861
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3862
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3863
    also have "\<dots> \<le> norm (f y - f x) + norm (y - x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3864
      apply (rule add_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3865
      apply (rule Basis_le_norm[OF i(2)])+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3866
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3867
    finally show "\<bar>f x \<bullet> i - x \<bullet> i\<bar> \<le> norm (f y - f x) + norm (y - x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3868
      unfolding inner_simps .
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3869
  qed
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3870
  have "\<exists>e>0. \<forall>x\<in>unit_cube. \<forall>y\<in>unit_cube. \<forall>z\<in>unit_cube. \<forall>i\<in>Basis.
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3871
    norm (x - z) < e \<and> norm (y - z) < e \<and> label x i \<noteq> label y i \<longrightarrow>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3872
      abs ((f(z) - z)\<bullet>i) < d / (real n)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3873
  proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3874
    have d': "d / real n / 8 > 0"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3875
      apply (rule divide_pos_pos)+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3876
      using d(1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3877
      unfolding n_def
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3878
      apply (auto simp:  DIM_positive)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3879
      done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3880
    have *: "uniformly_continuous_on unit_cube f"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3881
      by (rule compact_uniformly_continuous[OF assms(1) compact_unit_cube])
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3882
    obtain e where e:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3883
        "e > 0"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3884
        "\<And>x x'. x \<in> unit_cube \<Longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3885
          x' \<in> unit_cube \<Longrightarrow>
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3886
          norm (x' - x) < e \<Longrightarrow>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3887
          norm (f x' - f x) < d / real n / 8"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3888
      using *[unfolded uniformly_continuous_on_def,rule_format,OF d']
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3889
      unfolding dist_norm
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3890
      by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3891
    show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3892
      apply (rule_tac x="min (e/2) (d/real n/8)" in exI)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3893
      apply safe
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3894
    proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3895
      show "0 < min (e / 2) (d / real n / 8)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3896
        using d' e by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3897
      fix x y z i
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3898
      assume as:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3899
        "x \<in> unit_cube" "y \<in> unit_cube" "z \<in> unit_cube"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  3900
        "norm (x - z) < min (e / 2) (d / real n / 8)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3901
        "norm (y - z) < min (e / 2) (d / real n / 8)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3902
        "label x i \<noteq> label y i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3903
      assume i: "i \<in> Basis"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3904
      have *: "\<And>z fz x fx n1 n2 n3 n4 d4 d :: real. abs(fx - x) \<le> n1 + n2 \<Longrightarrow>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3905
        abs (fx - fz) \<le> n3 \<Longrightarrow> abs (x - z) \<le> n4 \<Longrightarrow>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3906
        n1 < d4 \<Longrightarrow> n2 < 2 * d4 \<Longrightarrow> n3 < d4 \<Longrightarrow> n4 < d4 \<Longrightarrow>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3907
        (8 * d4 = d) \<Longrightarrow> abs(fz - z) < d"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3908
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3909
      show "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3910
        unfolding inner_simps
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3911
      proof (rule *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3912
        show "\<bar>f x \<bullet> i - x \<bullet> i\<bar> \<le> norm (f y -f x) + norm (y - x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3913
          apply (rule lem1[rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3914
          using as i
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3915
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3916
          done
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3917
        show "\<bar>f x \<bullet> i - f z \<bullet> i\<bar> \<le> norm (f x - f z)" "\<bar>x \<bullet> i - z \<bullet> i\<bar> \<le> norm (x - z)"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3918
          unfolding inner_diff_left[symmetric]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3919
          by (rule Basis_le_norm[OF i])+
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3920
        have tria: "norm (y - x) \<le> norm (y - z) + norm (x - z)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3921
          using dist_triangle[of y x z, unfolded dist_norm]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3922
          unfolding norm_minus_commute
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3923
          by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3924
        also have "\<dots> < e / 2 + e / 2"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3925
          apply (rule add_strict_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3926
          using as(4,5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3927
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3928
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3929
        finally show "norm (f y - f x) < d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3930
          apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3931
          apply (rule e(2))
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3932
          using as
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3933
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3934
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3935
        have "norm (y - z) + norm (x - z) < d / real n / 8 + d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3936
          apply (rule add_strict_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3937
          using as
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3938
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3939
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3940
        then show "norm (y - x) < 2 * (d / real n / 8)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3941
          using tria
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3942
          by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3943
        show "norm (f x - f z) < d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3944
          apply (rule e(2))
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3945
          using as e(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3946
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3947
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3948
      qed (insert as, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3949
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3950
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3951
  then
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3952
  obtain e where e:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3953
    "e > 0"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3954
    "\<And>x y z i. x \<in> unit_cube \<Longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3955
      y \<in> unit_cube \<Longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  3956
      z \<in> unit_cube \<Longrightarrow>
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3957
      i \<in> Basis \<Longrightarrow>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3958
      norm (x - z) < e \<and> norm (y - z) < e \<and> label x i \<noteq> label y i \<Longrightarrow>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3959
      \<bar>(f z - z) \<bullet> i\<bar> < d / real n"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3960
    by blast
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3961
  obtain p :: nat where p: "1 + real n / e \<le> real p"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  3962
    using real_arch_simple ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3963
  have "1 + real n / e > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3964
    apply (rule add_pos_pos)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3965
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3966
    apply (rule divide_pos_pos)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3967
    using e(1) n
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3968
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3969
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3970
  then have "p > 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3971
    using p by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3972
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3973
  obtain b :: "nat \<Rightarrow> 'a" where b: "bij_betw b {1..n} Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3974
    by atomize_elim (auto simp: n_def intro!: finite_same_card_bij)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3975
  def b' \<equiv> "inv_into {1..n} b"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3976
  then have b': "bij_betw b' Basis {1..n}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3977
    using bij_betw_inv_into[OF b] by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3978
  then have b'_Basis: "\<And>i. i \<in> Basis \<Longrightarrow> b' i \<in> {Suc 0 .. n}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3979
    unfolding bij_betw_def by (auto simp: set_eq_iff)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3980
  have bb'[simp]:"\<And>i. i \<in> Basis \<Longrightarrow> b (b' i) = i"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3981
    unfolding b'_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3982
    using b
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3983
    by (auto simp: f_inv_into_f bij_betw_def)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3984
  have b'b[simp]:"\<And>i. i \<in> {1..n} \<Longrightarrow> b' (b i) = i"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3985
    unfolding b'_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3986
    using b
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3987
    by (auto simp: inv_into_f_eq bij_betw_def)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3988
  have *: "\<And>x :: nat. x = 0 \<or> x = 1 \<longleftrightarrow> x \<le> 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3989
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3990
  have b'': "\<And>j. j \<in> {Suc 0..n} \<Longrightarrow> b j \<in> Basis"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3991
    using b unfolding bij_betw_def by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3992
  have q1: "0 < p" "0 < n"  "\<forall>x. (\<forall>i\<in>{1..n}. x i \<le> p) \<longrightarrow>
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3993
    (\<forall>i\<in>{1..n}. (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 0 \<or>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3994
                (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3995
    unfolding *
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3996
    using `p > 0` `n > 0`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3997
    using label(1)[OF b'']
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  3998
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3999
  have q2: "\<forall>x. (\<forall>i\<in>{1..n}. x i \<le> p) \<longrightarrow> (\<forall>i\<in>{1..n}. x i = 0 \<longrightarrow>
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4000
      (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 0)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4001
    "\<forall>x. (\<forall>i\<in>{1..n}. x i \<le> p) \<longrightarrow> (\<forall>i\<in>{1..n}. x i = p \<longrightarrow>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4002
      (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4003
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4004
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4005
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4006
    apply rule
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4007
    defer
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4008
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4009
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4010
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4011
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4012
  proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4013
    fix x i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4014
    assume as: "\<forall>i\<in>{1..n}. x i \<le> p" "i \<in> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4015
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4016
      assume "x i = p \<or> x i = 0"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4017
      have "(\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<in> (unit_cube::'a set)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4018
        unfolding mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4019
        using as b'_Basis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4020
        by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4021
    }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4022
    note cube = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4023
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4024
      assume "x i = p"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4025
      then show "(label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4026
        unfolding o_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4027
        using cube as `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4028
        by (intro label(3)) (auto simp add: b'')
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4029
    }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4030
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4031
      assume "x i = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4032
      then show "(label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 0"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4033
        unfolding o_def using cube as `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4034
        by (intro label(2)) (auto simp add: b'')
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4035
    }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  4036
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4037
  obtain q where q:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4038
      "\<forall>i\<in>{1..n}. q i < p"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4039
      "\<forall>i\<in>{1..n}.
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4040
         \<exists>r s. (\<forall>j\<in>{1..n}. q j \<le> r j \<and> r j \<le> q j + 1) \<and>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4041
               (\<forall>j\<in>{1..n}. q j \<le> s j \<and> s j \<le> q j + 1) \<and>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4042
               (label (\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i) \<circ> b) i \<noteq>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4043
               (label (\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i) \<circ> b) i"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4044
    by (rule kuhn_lemma[OF q1 q2])
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4045
  def z \<equiv> "(\<Sum>i\<in>Basis. (real (q (b' i)) / real p) *\<^sub>R i)::'a"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4046
  have "\<exists>i\<in>Basis. d / real n \<le> abs ((f z - z)\<bullet>i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4047
  proof (rule ccontr)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4048
    have "\<forall>i\<in>Basis. q (b' i) \<in> {0..p}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4049
      using q(1) b'
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4050
      by (auto intro: less_imp_le simp: bij_betw_def)
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4051
    then have "z \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4052
      unfolding z_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4053
      using b'_Basis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4054
      by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4055
    then have d_fz_z: "d \<le> norm (f z - z)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4056
      by (rule d)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4057
    assume "\<not> ?thesis"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4058
    then have as: "\<forall>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar> < d / real n"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4059
      using `n > 0`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4060
      by (auto simp add: not_le inner_simps)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4061
    have "norm (f z - z) \<le> (\<Sum>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar>)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4062
      unfolding inner_diff_left[symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4063
      by (rule norm_le_l1)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4064
    also have "\<dots> < (\<Sum>(i::'a) \<in> Basis. d / real n)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4065
      apply (rule setsum_strict_mono)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4066
      using as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4067
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4068
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4069
    also have "\<dots> = d"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4070
      using DIM_positive[where 'a='a]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4071
      by (auto simp: real_eq_of_nat n_def)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4072
    finally show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4073
      using d_fz_z by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4074
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4075
  then obtain i where i: "i \<in> Basis" "d / real n \<le> \<bar>(f z - z) \<bullet> i\<bar>" ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4076
  have *: "b' i \<in> {1..n}"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4077
    using i and b'[unfolded bij_betw_def]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4078
    by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4079
  obtain r s where rs:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4080
    "\<And>j. j \<in> {1..n} \<Longrightarrow> q j \<le> r j \<and> r j \<le> q j + 1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4081
    "\<And>j. j \<in> {1..n} \<Longrightarrow> q j \<le> s j \<and> s j \<le> q j + 1"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4082
    "(label (\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i) \<circ> b) (b' i) \<noteq>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4083
      (label (\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i) \<circ> b) (b' i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4084
    using q(2)[rule_format,OF *] by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4085
  have b'_im: "\<And>i. i \<in> Basis \<Longrightarrow>  b' i \<in> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4086
    using b' unfolding bij_betw_def by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4087
  def r' \<equiv> "(\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i)::'a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4088
  have "\<And>i. i \<in> Basis \<Longrightarrow> r (b' i) \<le> p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4089
    apply (rule order_trans)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4090
    apply (rule rs(1)[OF b'_im,THEN conjunct2])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4091
    using q(1)[rule_format,OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4092
    apply (auto simp add: Suc_le_eq)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4093
    done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4094
  then have "r' \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4095
    unfolding r'_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4096
    using b'_Basis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4097
    by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4098
  def s' \<equiv> "(\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i)::'a"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4099
  have "\<And>i. i \<in> Basis \<Longrightarrow> s (b' i) \<le> p"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4100
    apply (rule order_trans)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4101
    apply (rule rs(2)[OF b'_im, THEN conjunct2])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4102
    using q(1)[rule_format,OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4103
    apply (auto simp add: Suc_le_eq)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4104
    done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4105
  then have "s' \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4106
    unfolding s'_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4107
    using b'_Basis
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4108
    by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1)
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4109
  have "z \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4110
    unfolding z_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4111
    using b'_Basis q(1)[rule_format,OF b'_im] `p > 0`
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4112
    by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1 less_imp_le)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4113
  have *: "\<And>x. 1 + real x = real (Suc x)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4114
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4115
  {
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4116
    have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4117
      apply (rule setsum_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4118
      using rs(1)[OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4119
      apply (auto simp add:* field_simps)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4120
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4121
    also have "\<dots> < e * real p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4122
      using p `e > 0` `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4123
      by (auto simp add: field_simps n_def real_of_nat_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4124
    finally have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) < e * real p" .
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4125
  }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4126
  moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4127
  {
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4128
    have "(\<Sum>i\<in>Basis. \<bar>real (s (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4129
      apply (rule setsum_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4130
      using rs(2)[OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4131
      apply (auto simp add:* field_simps)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4132
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4133
    also have "\<dots> < e * real p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4134
      using p `e > 0` `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4135
      by (auto simp add: field_simps n_def real_of_nat_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4136
    finally have "(\<Sum>i\<in>Basis. \<bar>real (s (b' i)) - real (q (b' i))\<bar>) < e * real p" .
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4137
  }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4138
  ultimately
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4139
  have "norm (r' - z) < e" and "norm (s' - z) < e"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4140
    unfolding r'_def s'_def z_def
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4141
    using `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4142
    apply (rule_tac[!] le_less_trans[OF norm_le_l1])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4143
    apply (auto simp add: field_simps setsum_divide_distrib[symmetric] inner_diff_left)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4144
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4145
  then have "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4146
    using rs(3) i
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4147
    unfolding r'_def[symmetric] s'_def[symmetric] o_def bb'
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4148
    by (intro e(2)[OF `r'\<in>unit_cube` `s'\<in>unit_cube` `z\<in>unit_cube`]) auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4149
  then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4150
    using i by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4151
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4152
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4153
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4154
subsection {* Retractions *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4155
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4156
definition "retraction s t r \<longleftrightarrow> t \<subseteq> s \<and> continuous_on s r \<and> r ` s \<subseteq> t \<and> (\<forall>x\<in>t. r x = x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4157
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4158
definition retract_of (infixl "retract'_of" 12)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4159
  where "(t retract_of s) \<longleftrightarrow> (\<exists>r. retraction s t r)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4160
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4161
lemma retraction_idempotent: "retraction s t r \<Longrightarrow> x \<in> s \<Longrightarrow>  r (r x) = r x"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4162
  unfolding retraction_def by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4163
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4164
subsection {* Preservation of fixpoints under (more general notion of) retraction *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4165
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4166
lemma invertible_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4167
  fixes s :: "'a::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4168
    and t :: "'b::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4169
  assumes "continuous_on t i"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4170
    and "i ` t \<subseteq> s"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4171
    and "continuous_on s r"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4172
    and "r ` s \<subseteq> t"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4173
    and "\<forall>y\<in>t. r (i y) = y"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4174
    and "\<forall>f. continuous_on s f \<and> f ` s \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. f x = x)"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4175
    and "continuous_on t g"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4176
    and "g ` t \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4177
  obtains y where "y \<in> t" and "g y = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4178
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4179
  have "\<exists>x\<in>s. (i \<circ> g \<circ> r) x = x"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4180
    apply (rule assms(6)[rule_format])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4181
    apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4182
    apply (rule continuous_on_compose assms)+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4183
    apply ((rule continuous_on_subset)?, rule assms)+
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4184
    using assms(2,4,8)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4185
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4186
    apply blast
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4187
    done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4188
  then obtain x where x: "x \<in> s" "(i \<circ> g \<circ> r) x = x" ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4189
  then have *: "g (r x) \<in> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4190
    using assms(4,8) by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4191
  have "r ((i \<circ> g \<circ> r) x) = r x"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4192
    using x by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4193
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4194
    apply (rule_tac that[of "r x"])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4195
    using x
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4196
    unfolding o_def
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4197
    unfolding assms(5)[rule_format,OF *]
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4198
    using assms(4)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4199
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4200
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4201
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4202
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4203
lemma homeomorphic_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4204
  fixes s :: "'a::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4205
    and t :: "'b::euclidean_space set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4206
  assumes "s homeomorphic t"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4207
  shows "(\<forall>f. continuous_on s f \<and> f ` s \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. f x = x)) \<longleftrightarrow>
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4208
    (\<forall>g. continuous_on t g \<and> g ` t \<subseteq> t \<longrightarrow> (\<exists>y\<in>t. g y = y))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4209
proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4210
  obtain r i where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4211
      "\<forall>x\<in>s. i (r x) = x"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4212
      "r ` s = t"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4213
      "continuous_on s r"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4214
      "\<forall>y\<in>t. r (i y) = y"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4215
      "i ` t = s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4216
      "continuous_on t i"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4217
    using assms
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4218
    unfolding homeomorphic_def homeomorphism_def
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4219
    by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4220
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4221
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4222
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4223
    apply (rule_tac[!] allI impI)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4224
    apply (rule_tac g=g in invertible_fixpoint_property[of t i s r])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4225
    prefer 10
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4226
    apply (rule_tac g=f in invertible_fixpoint_property[of s r t i])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4227
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4228
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4229
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4230
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4231
lemma retract_fixpoint_property:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4232
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4233
    and s :: "'a set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4234
  assumes "t retract_of s"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4235
    and "\<forall>f. continuous_on s f \<and> f ` s \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. f x = x)"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4236
    and "continuous_on t g"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4237
    and "g ` t \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4238
  obtains y where "y \<in> t" and "g y = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4239
proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4240
  obtain h where "retraction s t h"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4241
    using assms(1) unfolding retract_of_def ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4242
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4243
    unfolding retraction_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4244
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4245
    apply (rule invertible_fixpoint_property[OF continuous_on_id _ _ _ _ assms(2), of t h g])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4246
    prefer 7
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4247
    apply (rule_tac y = y in that)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4248
    using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4249
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4250
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4251
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4252
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4253
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4254
subsection {* The Brouwer theorem for any set with nonempty interior *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4255
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4256
lemma convex_unit_cube: "convex unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4257
  apply (rule is_interval_convex)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4258
  apply (clarsimp simp add: is_interval_def mem_unit_cube)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4259
  apply (drule (1) bspec)+
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4260
  apply auto
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4261
  done
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4262
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4263
lemma brouwer_weak:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4264
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4265
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4266
    and "convex s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4267
    and "interior s \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4268
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4269
    and "f ` s \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4270
  obtains x where "x \<in> s" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4271
proof -
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4272
  let ?U = "unit_cube :: 'a set"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4273
  have "\<Sum>Basis /\<^sub>R 2 \<in> interior ?U"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4274
  proof (rule interiorI)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4275
    let ?I = "(\<Inter>i\<in>Basis. {x::'a. 0 < x \<bullet> i} \<inter> {x. x \<bullet> i < 1})"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4276
    show "open ?I"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4277
      by (intro open_INT finite_Basis ballI open_Int, auto intro: open_Collect_less)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4278
    show "\<Sum>Basis /\<^sub>R 2 \<in> ?I"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4279
      by simp
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4280
    show "?I \<subseteq> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4281
      unfolding unit_cube_def by force
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4282
  qed
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4283
  then have *: "interior ?U \<noteq> {}" by fast
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4284
  have *: "?U homeomorphic s"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4285
    using homeomorphic_convex_compact[OF convex_unit_cube compact_unit_cube * assms(2,1,3)] .
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4286
  have "\<forall>f. continuous_on ?U f \<and> f ` ?U \<subseteq> ?U \<longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4287
    (\<exists>x\<in>?U. f x = x)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  4288
    using brouwer_cube by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4289
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4290
    unfolding homeomorphic_fixpoint_property[OF *]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4291
    apply (erule_tac x=f in allE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4292
    apply (erule impE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4293
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4294
    apply (erule bexE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4295
    apply (rule_tac x=y in that)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4296
    using assms
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4297
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4298
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4299
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4300
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4301
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4302
text {* And in particular for a closed ball. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4303
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4304
lemma brouwer_ball:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4305
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4306
  assumes "e > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4307
    and "continuous_on (cball a e) f"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4308
    and "f ` cball a e \<subseteq> cball a e"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4309
  obtains x where "x \<in> cball a e" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4310
  using brouwer_weak[OF compact_cball convex_cball, of a e f]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4311
  unfolding interior_cball ball_eq_empty
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4312
  using assms by auto
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4313
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4314
text {*Still more general form; could derive this directly without using the
36334
068a01b4bc56 document generation for Multivariate_Analysis
huffman
parents: 36318
diff changeset
  4315
  rather involved @{text "HOMEOMORPHIC_CONVEX_COMPACT"} theorem, just using
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4316
  a scaling and translation to put the set inside the unit cube. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4317
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4318
lemma brouwer:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4319
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4320
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4321
    and "convex s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4322
    and "s \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4323
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4324
    and "f ` s \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4325
  obtains x where "x \<in> s" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4326
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4327
  have "\<exists>e>0. s \<subseteq> cball 0 e"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4328
    using compact_imp_bounded[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4329
    unfolding bounded_pos
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4330
    apply (erule_tac exE)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4331
    apply (rule_tac x=b in exI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4332
    apply (auto simp add: dist_norm)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4333
    done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4334
  then obtain e where e: "e > 0" "s \<subseteq> cball 0 e"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4335
    by blast
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4336
  have "\<exists>x\<in> cball 0 e. (f \<circ> closest_point s) x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4337
    apply (rule_tac brouwer_ball[OF e(1), of 0 "f \<circ> closest_point s"])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4338
    apply (rule continuous_on_compose )
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4339
    apply (rule continuous_on_closest_point[OF assms(2) compact_imp_closed[OF assms(1)] assms(3)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4340
    apply (rule continuous_on_subset[OF assms(4)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4341
    apply (insert closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4342
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4343
    using assms(5)[unfolded subset_eq]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4344
    using e(2)[unfolded subset_eq mem_cball]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4345
    apply (auto simp add: dist_norm)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4346
    done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4347
  then obtain x where x: "x \<in> cball 0 e" "(f \<circ> closest_point s) x = x" ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4348
  have *: "closest_point s x = x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4349
    apply (rule closest_point_self)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4350
    apply (rule assms(5)[unfolded subset_eq,THEN bspec[where x="x"], unfolded image_iff])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4351
    apply (rule_tac x="closest_point s x" in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4352
    using x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4353
    unfolding o_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4354
    using closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3), of x]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4355
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4356
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4357
  show thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4358
    apply (rule_tac x="closest_point s x" in that)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4359
    unfolding x(2)[unfolded o_def]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4360
    apply (rule closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3)])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4361
    using *
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4362
    apply auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4363
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4364
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4365
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  4366
text {*So we get the no-retraction theorem. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4367
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4368
lemma no_retraction_cball:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4369
  fixes a :: "'a::euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4370
  assumes "e > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4371
  shows "\<not> (frontier (cball a e) retract_of (cball a e))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4372
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4373
  case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4374
  have *: "\<And>xa. a - (2 *\<^sub>R a - xa) = - (a - xa)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4375
    using scaleR_left_distrib[of 1 1 a] by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4376
  obtain x where x:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4377
      "x \<in> {x. norm (a - x) = e}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4378
      "2 *\<^sub>R a - x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4379
    apply (rule retract_fixpoint_property[OF goal1, of "\<lambda>x. scaleR 2 a - x"])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4380
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4381
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4382
    apply (erule conjE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4383
    apply (rule brouwer_ball[OF assms])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4384
    apply assumption+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4385
    apply (rule_tac x=x in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4386
    apply assumption+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4387
    apply (rule continuous_on_intros)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4388
    unfolding frontier_cball subset_eq Ball_def image_iff
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4389
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4390
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4391
    apply (erule bexE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4392
    unfolding dist_norm
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4393
    apply (simp add: * norm_minus_commute)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  4394
    apply blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4395
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4396
  then have "scaleR 2 a = scaleR 1 x + scaleR 1 x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4397
    by (auto simp add: algebra_simps)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4398
  then have "a = x"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4399
    unfolding scaleR_left_distrib[symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  4400
    by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4401
  then show False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4402
    using x assms by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4403
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4404
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4405
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4406
subsection {*Bijections between intervals. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4407
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4408
definition interval_bij :: "'a \<times> 'a \<Rightarrow> 'a \<times> 'a \<Rightarrow> 'a \<Rightarrow> 'a::euclidean_space"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4409
  where "interval_bij =
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4410
    (\<lambda>(a, b) (u, v) x. (\<Sum>i\<in>Basis. (u\<bullet>i + (x\<bullet>i - a\<bullet>i) / (b\<bullet>i - a\<bullet>i) * (v\<bullet>i - u\<bullet>i)) *\<^sub>R i))"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4411
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4412
lemma interval_bij_affine:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4413
  "interval_bij (a,b) (u,v) = (\<lambda>x. (\<Sum>i\<in>Basis. ((v\<bullet>i - u\<bullet>i) / (b\<bullet>i - a\<bullet>i) * (x\<bullet>i)) *\<^sub>R i) +
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4414
    (\<Sum>i\<in>Basis. (u\<bullet>i - (v\<bullet>i - u\<bullet>i) / (b\<bullet>i - a\<bullet>i) * (a\<bullet>i)) *\<^sub>R i))"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4415
  by (auto simp: setsum_addf[symmetric] scaleR_add_left[symmetric] interval_bij_def fun_eq_iff
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4416
    field_simps inner_simps add_divide_distrib[symmetric] intro!: setsum_cong)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4417
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4418
lemma continuous_interval_bij:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4419
  fixes a b :: "'a::euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4420
  shows "continuous (at x) (interval_bij (a, b) (u, v))"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4421
  by (auto simp add: divide_inverse interval_bij_def intro!: continuous_setsum continuous_intros)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4422
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4423
lemma continuous_on_interval_bij: "continuous_on s (interval_bij (a, b) (u, v))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4424
  apply(rule continuous_at_imp_continuous_on)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4425
  apply (rule, rule continuous_interval_bij)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4426
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4427
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4428
lemma in_interval_interval_bij:
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4429
  fixes a b u v x :: "'a::euclidean_space"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4430
  assumes "x \<in> cbox a b"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4431
    and "cbox u v \<noteq> {}"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4432
  shows "interval_bij (a, b) (u, v) x \<in> cbox u v"
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4433
  apply (simp only: interval_bij_def split_conv mem_box inner_setsum_left_Basis cong: ball_cong)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4434
  apply safe
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  4435
proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4436
  fix i :: 'a
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4437
  assume i: "i \<in> Basis"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4438
  have "cbox a b \<noteq> {}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4439
    using assms by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4440
  with i have *: "a\<bullet>i \<le> b\<bullet>i" "u\<bullet>i \<le> v\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4441
    using assms(2) by (auto simp add: box_eq_empty)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4442
  have x: "a\<bullet>i\<le>x\<bullet>i" "x\<bullet>i\<le>b\<bullet>i"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56154
diff changeset
  4443
    using assms(1)[unfolded mem_box] using i by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4444
  have "0 \<le> (x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i) * (v \<bullet> i - u \<bullet> i)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4445
    using * x by (auto intro!: mult_nonneg_nonneg divide_nonneg_nonneg)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4446
  then show "u \<bullet> i \<le> u \<bullet> i + (x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i) * (v \<bullet> i - u \<bullet> i)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4447
    using * by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4448
  have "((x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i)) * (v \<bullet> i - u \<bullet> i) \<le> 1 * (v \<bullet> i - u \<bullet> i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4449
    apply (rule mult_right_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4450
    unfolding divide_le_eq_1
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4451
    using * x
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  4452
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4453
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  4454
  then show "u \<bullet> i + (x \<bullet> i - a \<bullet> i) / (b \<bullet> i - a \<bullet> i) * (v \<bullet> i - u \<bullet> i) \<le> v \<bullet> i"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4455
    using * by auto
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  4456
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4457
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  4458
lemma interval_bij_bij:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  4459
  "\<forall>(i::'a::euclidean_space)\<in>Basis. a\<bullet>i < b\<bullet>i \<and> u\<bullet>i < v\<bullet>i \<Longrightarrow>
53846
2e4b435e17bc tuned proofs;
wenzelm
parents: 53688
diff changeset
  4460
    interval_bij (a, b) (u, v) (interval_bij (u, v) (a, b) x) = x"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  4461
  by (auto simp: interval_bij_def euclidean_eq_iff[where 'a='a])
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  4462
34291
4e896680897e finite annotation on cartesian product is now implicit.
hoelzl
parents: 34289
diff changeset
  4463
end