src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy
author wenzelm
Tue, 17 Sep 2013 00:13:20 +0200
changeset 53674 7ac7b2eaa5e6
parent 53252 4766fbe322b5
child 53688 63892cfef47f
permissions -rw-r--r--
tuned proofs;
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:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    27
  assumes "a \<ge> 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    28
    and "b \<ge> 0"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    29
  shows "0 \<le> a / (b::real)"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    30
proof (cases "b = 0")
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    31
  case True
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    32
  then show ?thesis by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    33
next
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    34
  case False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    35
  show ?thesis
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    36
    apply (rule divide_nonneg_pos)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    37
    using assms False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    38
    apply auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    39
    done
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    40
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
    41
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    42
lemma brouwer_compactness_lemma:
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50526
diff changeset
    43
  fixes f :: "'a::metric_space \<Rightarrow> 'b::euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    44
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    45
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    46
    and "\<not> (\<exists>x\<in>s. (f x = 0))"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    47
  obtains d where "0 < d" and "\<forall>x\<in>s. d \<le> norm (f x)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    48
proof (cases "s = {}")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    49
  case True
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    50
  show thesis by (rule that [of 1]) (auto simp: True)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    51
next
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    52
  case False
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    53
  have "continuous_on s (norm \<circ> f)"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    54
    by (rule continuous_on_intros continuous_on_norm assms(2))+
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    55
  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
    56
    using continuous_attains_inf[OF assms(1), of "norm \<circ> f"]
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    57
    unfolding o_def
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    58
    by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    59
  have "(norm \<circ> f) x > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    60
    using assms(3) and x(1)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    61
    by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    62
  then show ?thesis
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    63
    by (rule that) (insert x(2), auto simp: o_def)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    64
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    65
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    66
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
    67
  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
    68
  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
    69
    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
    70
  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
    71
             (\<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
    72
             (\<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
    73
             (\<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
    74
             (\<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
    75
proof -
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    76
  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
    77
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
    78
  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
    79
    by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    80
  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
    81
    unfolding and_forall_thm Ball_def
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    82
    apply (subst choice_iff[symmetric])+
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    83
    apply rule
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    84
    apply rule
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    85
  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
    86
    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
    87
    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
    88
        (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
    89
        (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
    90
        (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
    91
    {
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
    92
      assume "P x" "Q xa" "xa\<in>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
    93
      then have "0 \<le> f x \<bullet> xa \<and> f x \<bullet> xa \<le> 1"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    94
        using assms(2)[rule_format,of "f x" xa]
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    95
        apply (drule_tac assms(1)[rule_format])
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    96
        apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    97
        done
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
    98
    }
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
    99
    then have "xa\<in>Basis \<Longrightarrow> ?R 0 \<or> ?R 1" by auto
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   100
    then show ?case by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   101
  qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   102
qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   103
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   104
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   105
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
   106
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   107
lemma setsum_Un_disjoint':
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   108
  assumes "finite A" "finite B" "A \<inter> B = {}" "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
   109
  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
   110
  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
   111
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   112
lemma kuhn_counting_lemma:
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   113
  assumes
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   114
    "finite faces"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   115
    "finite simplices"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   116
    "\<forall>f\<in>faces. bnd f \<longrightarrow> (card {s \<in> simplices. face f s} = 1)"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   117
    "\<forall>f\<in>faces. \<not> bnd f \<longrightarrow> (card {s \<in> simplices. face f s} = 2)"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   118
    "\<forall>s\<in>simplices. compo s \<longrightarrow> (card {f \<in> faces. face f s \<and> compo' f} = 1)"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   119
    "\<forall>s\<in>simplices. \<not> compo s \<longrightarrow>
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   120
      (card {f \<in> faces. face f s \<and> compo' f} = 0) \<or> (card {f \<in> faces. face f s \<and> compo' f} = 2)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   121
    "odd(card {f \<in> faces. compo' f \<and> bnd f})"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   122
  shows "odd(card {s \<in> simplices. compo s})"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   123
proof -
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   124
  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
   125
      {f\<in>faces. compo' f \<and> face f x}"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   126
    "\<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
   127
    by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   128
  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
   129
      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
   130
      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
   131
    unfolding setsum_addf[symmetric]
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   132
    apply -
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   133
    apply(rule setsum_cong2)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   134
    using assms(1)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   135
    apply (auto simp add: card_Un_Int, auto simp add:conj_commute)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   136
    done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   137
  have lem2:
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   138
    "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
   139
      1 * card {f \<in> faces. compo' f \<and> bnd f}"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   140
    "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
   141
      2 * card {f \<in> faces. compo' f \<and> \<not> bnd f}"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   142
    apply(rule_tac[!] setsum_multicount)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   143
    using assms
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   144
    apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   145
    done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   146
  have lem3:
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   147
    "setsum (\<lambda>s. card {f \<in> faces. face f s \<and> compo' f}) simplices =
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   148
      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
   149
      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
   150
    apply (rule setsum_Un_disjoint')
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   151
    using assms(2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   152
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   153
    done
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   154
  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
   155
    setsum (\<lambda>s. 1) {s \<in> simplices. compo s}"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   156
    apply (rule setsum_cong2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   157
    using assms(5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   158
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   159
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   160
  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
   161
    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
   162
           {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
   163
    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
   164
           {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
   165
    apply (rule setsum_Un_disjoint')
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   166
    using assms(2,6)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   167
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   168
    done
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   169
  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
   170
    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
   171
    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
   172
    using lem1[unfolded lem3 lem2 lem5] by auto
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   173
  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
   174
    using assms by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   175
  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
   176
    using assms by auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   177
  show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   178
    unfolding even_nat_def card_eq_setsum and lem4[symmetric] and *[unfolded card_eq_setsum]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   179
    unfolding card_eq_setsum[symmetric]
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   180
    apply (rule odd_minus_even)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   181
    unfolding of_nat_add
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   182
    apply(rule odd_plus_even)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   183
    apply(rule assms(7)[unfolded even_nat_def])
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   184
    unfolding int_mult
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   185
    apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   186
    done
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   187
qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   188
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   189
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   190
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
   191
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   192
lemma card_1_exists: "card s = 1 \<longleftrightarrow> (\<exists>!x. x \<in> s)"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   193
  unfolding One_nat_def
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   194
  apply rule
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   195
  apply (drule card_eq_SucD)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   196
  defer
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   197
  apply (erule ex1E)
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   198
proof -
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   199
  fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   200
  assume as: "x \<in> s" "\<forall>y. y \<in> s \<longrightarrow> y = x"
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   201
  have *: "s = insert x {}"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   202
    apply (rule set_eqI, rule) unfolding singleton_iff
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   203
    apply (rule as(2)[rule_format]) using as(1)
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   204
    apply auto
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   205
    done
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   206
  show "card s = Suc 0"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   207
    unfolding * using card_insert by auto
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   208
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
   209
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   210
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)))"
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   211
proof
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   212
  assume "card s = 2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   213
  then obtain x y where s: "s = {x, y}" "x\<noteq>y" unfolding numeral_2_eq_2
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   214
    apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   215
    apply (erule exE conjE | drule card_eq_SucD)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   216
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   217
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   218
  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
   219
    using s by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   220
next
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   221
  assume "\<exists>x\<in>s. \<exists>y\<in>s. x \<noteq> y \<and> (\<forall>z\<in>s. z = x \<or> z = y)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   222
  then obtain x y where "x\<in>s" "y\<in>s" "x \<noteq> y" "\<forall>z\<in>s. z = x \<or> z = y"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   223
    by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   224
  then have "s = {x, y}" by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   225
  with `x \<noteq> y` show "card s = 2" by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   226
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   227
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   228
lemma image_lemma_0:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   229
  assumes "card {a\<in>s. f ` (s - {a}) = t - {b}} = n"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   230
  shows "card {s'. \<exists>a\<in>s. (s' = s - {a}) \<and> (f ` s' = t - {b})} = n"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   231
proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   232
  have *: "{s'. \<exists>a\<in>s. (s' = s - {a}) \<and> (f ` s' = t - {b})} =
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   233
    (\<lambda>a. s - {a}) ` {a\<in>s. f ` (s - {a}) = t - {b}}"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   234
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   235
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   236
    unfolding *
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   237
    unfolding assms[symmetric]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   238
    apply (rule card_image)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   239
    unfolding inj_on_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   240
    apply (rule, rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   241
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   242
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   243
    done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   244
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   245
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   246
lemma image_lemma_1:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   247
  assumes "finite s" "finite t" "card s = card t" "f ` s = t" "b \<in> t"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   248
  shows "card {s'. \<exists>a\<in>s. s' = s - {a} \<and>  f ` s' = t - {b}} = 1"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   249
proof -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   250
  obtain a where a: "b = f a" "a\<in>s" using assms(4-5) by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   251
  have inj: "inj_on f s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   252
    apply (rule eq_card_imp_inj_on)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   253
    using assms(1-4) apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   254
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   255
  have *: "{a \<in> s. f ` (s - {a}) = t - {b}} = {a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   256
    apply (rule set_eqI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   257
    unfolding singleton_iff
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   258
    apply (rule, rule inj[unfolded inj_on_def, rule_format])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   259
    unfolding a using a(2) and assms and inj[unfolded inj_on_def]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   260
    apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   261
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   262
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   263
    apply (rule image_lemma_0)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   264
    unfolding *
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   265
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   266
    done
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   267
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   268
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   269
lemma image_lemma_2:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   270
  assumes "finite s" "finite t" "card s = card t" "f ` s \<subseteq> t" "f ` s \<noteq> t" "b \<in> t"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   271
  shows "(card {s'. \<exists>a\<in>s. (s' = s - {a}) \<and> f ` s' = t - {b}} = 0) \<or>
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   272
         (card {s'. \<exists>a\<in>s. (s' = s - {a}) \<and> f ` s' = t - {b}} = 2)"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   273
proof (cases "{a\<in>s. f ` (s - {a}) = t - {b}} = {}")
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   274
  case True
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   275
  then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   276
    apply -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   277
    apply (rule disjI1, rule image_lemma_0)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   278
    using assms(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   279
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   280
    done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   281
next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   282
  let ?M = "{a\<in>s. f ` (s - {a}) = t - {b}}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   283
  case False
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   284
  then obtain a where "a\<in>?M" by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   285
  then have a: "a\<in>s" "f ` (s - {a}) = t - {b}" 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
   286
  have "f a \<in> t - {b}" using a and assms by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   287
  then have "\<exists>c \<in> s - {a}. f a = f c"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   288
    unfolding image_iff[symmetric] and a by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   289
  then obtain c where c: "c \<in> s" "a \<noteq> c" "f a = f c" by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   290
  then have *: "f ` (s - {c}) = f ` (s - {a})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   291
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   292
    apply (rule set_eqI, rule)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   293
  proof -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   294
    fix x
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   295
    assume "x \<in> f ` (s - {a})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   296
    then obtain y where y: "f y = x" "y\<in>s- {a}" by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   297
    then show "x \<in> f ` (s - {c})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   298
      unfolding image_iff
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   299
      apply (rule_tac x = "if y = c then a else y" in bexI)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   300
      using c a apply auto done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   301
  qed auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   302
  have "c\<in>?M"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   303
    unfolding mem_Collect_eq and *
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   304
    using a and c(1) by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   305
  show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   306
    apply (rule disjI2, rule image_lemma_0) unfolding card_2_exists
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   307
    apply (rule bexI[OF _ `a\<in>?M`], rule bexI[OF _ `c\<in>?M`], rule, rule `a\<noteq>c`)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   308
  proof (rule, unfold mem_Collect_eq, erule conjE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   309
    fix z
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   310
    assume as: "z \<in> s" "f ` (s - {z}) = t - {b}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   311
    have inj: "inj_on f (s - {z})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   312
      apply (rule eq_card_imp_inj_on)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   313
      unfolding as using as(1) and assms
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   314
      apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   315
      done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   316
    show "z = a \<or> z = c"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   317
    proof (rule ccontr)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   318
      assume "\<not> ?thesis"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   319
      then show False
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   320
        using inj[unfolded inj_on_def, THEN bspec[where x=a], THEN bspec[where x=c]]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   321
        using `a\<in>s` `c\<in>s` `f a = f c` `a\<noteq>c`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   322
        apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   323
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   324
    qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   325
  qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   326
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   327
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   328
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   329
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
   330
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   331
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
   332
  assumes "finite simplices"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   333
    "\<forall>f s. face f s \<longleftrightarrow> (\<exists>a\<in>s. f = s - {a})"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   334
    "\<forall>s\<in>simplices. card s = n + 2" "\<forall>s\<in>simplices. (rl ` s) \<subseteq> {0..n+1}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   335
    "\<forall>f\<in> {f. \<exists>s\<in>simplices. face f s}. bnd f  \<longrightarrow> (card {s\<in>simplices. face f s} = 1)"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   336
    "\<forall>f\<in> {f. \<exists>s\<in>simplices. face f s}. \<not>bnd f \<longrightarrow> (card {s\<in>simplices. face f s} = 2)"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   337
    "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
   338
  shows "odd (card {s\<in>simplices. (rl ` s = {0..n+1})})"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   339
  apply (rule kuhn_counting_lemma)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   340
  defer
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   341
  apply (rule assms)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   342
  prefer 3
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   343
  apply (rule assms)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   344
proof (rule_tac[1-2] ballI impI)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   345
  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
   346
    by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   347
  have **: "\<forall>s\<in>simplices. card s = n + 2 \<and> finite s"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   348
    using assms(3) by (auto intro: card_ge_0_finite)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   349
  show "finite {f. \<exists>s\<in>simplices. face f s}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   350
    unfolding assms(2)[rule_format] and *
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   351
    apply (rule finite_UN_I[OF assms(1)])
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   352
    using **
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   353
    apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   354
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   355
  have *: "\<And>P f s. s\<in>simplices \<Longrightarrow> (f \<in> {f. \<exists>s\<in>simplices. \<exists>a\<in>s. f = s - {a}}) \<and>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   356
    (\<exists>a\<in>s. (f = s - {a})) \<and> P f \<longleftrightarrow> (\<exists>a\<in>s. (f = s - {a}) \<and> P f)" by auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   357
  fix s assume s: "s\<in>simplices"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   358
  let ?S = "{f \<in> {f. \<exists>s\<in>simplices. face f s}. face f s \<and> rl ` f = {0..n}}"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   359
  have "{0..n + 1} - {n + 1} = {0..n}" by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   360
  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
   361
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   362
    apply (rule set_eqI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   363
    unfolding assms(2)[rule_format] mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   364
    unfolding *[OF s, unfolded mem_Collect_eq, where P="\<lambda>x. rl ` x = {0..n}"]
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   365
    apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   366
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   367
  show "rl ` s = {0..n+1} \<Longrightarrow> card ?S = 1" "rl ` s \<noteq> {0..n+1} \<Longrightarrow> card ?S = 0 \<or> card ?S = 2"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   368
    unfolding S
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   369
    apply(rule_tac[!] image_lemma_1 image_lemma_2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   370
    using ** assms(4) and s
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   371
    apply auto
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   372
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   373
qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   374
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   375
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   376
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
   377
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   378
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)))"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   379
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   380
lemma kle_refl [intro]: "kle n x x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   381
  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
   382
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   383
lemma kle_antisym: "kle n x y \<and> kle n y x \<longleftrightarrow> (x = y)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   384
  unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   385
  apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   386
  apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   387
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   388
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   389
lemma pointwise_minimal_pointwise_maximal:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   390
  fixes s :: "(nat \<Rightarrow> nat) set"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   391
  assumes "finite s" "s \<noteq> {}" "\<forall>x\<in>s. \<forall>y\<in>s. (\<forall>j. x j \<le> y j) \<or> (\<forall>j. y j \<le> x j)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   392
  shows "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. a j \<le> x j" "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. x j \<le> a j"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   393
  using assms unfolding atomize_conj
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   394
proof (induct s rule: finite_induct)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   395
  fix x and F::"(nat\<Rightarrow>nat) set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   396
  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
   397
    "\<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
   398
        \<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
   399
    "\<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
   400
  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
   401
  proof (cases "F = {}")
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   402
    case True
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   403
    then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   404
      apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   405
      apply (rule, rule_tac[!] x=x in bexI)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   406
      apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   407
      done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   408
  next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   409
    case False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   410
    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
   411
      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
   412
      using as(3)[OF False] using as(5) by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   413
    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
   414
      using as(5)[rule_format,OF a(1) insertI1]
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   415
      apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   416
    proof (erule disjE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   417
      assume "\<forall>j. a j \<le> x j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   418
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   419
        apply (rule_tac x=a in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   420
        using a apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   421
        done
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   422
    next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   423
      assume "\<forall>j. x j \<le> a j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   424
      then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   425
        apply (rule_tac x=x in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   426
        apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   427
        apply (insert a)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   428
        apply (erule_tac x=xa in ballE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   429
        apply (erule_tac x=j in allE)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   430
        apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   431
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   432
    qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   433
    moreover
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   434
    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
   435
      using as(5)[rule_format,OF b(1) insertI1]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   436
      apply -
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   437
    proof (erule disjE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   438
      assume "\<forall>j. x j \<le> b j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   439
      then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   440
        apply(rule_tac x=b in bexI) using b
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   441
        apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   442
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   443
    next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   444
      assume "\<forall>j. b j \<le> x j"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   445
      then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   446
        apply (rule_tac x=x in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   447
        apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   448
        apply (insert b)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   449
        apply (erule_tac x=xa in ballE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   450
        apply (erule_tac x=j in allE)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   451
        apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   452
        done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   453
    qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   454
    ultimately show ?thesis by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   455
  qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   456
qed auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   457
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   458
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   459
lemma kle_imp_pointwise: "kle n x y \<Longrightarrow> (\<forall>j. x j \<le> y j)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   460
  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
   461
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   462
lemma pointwise_antisym:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   463
  fixes x :: "nat \<Rightarrow> nat"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   464
  shows "(\<forall>j. x j \<le> y j) \<and> (\<forall>j. y j \<le> x j) \<longleftrightarrow> x = y"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   465
  apply (rule, rule ext, erule conjE)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   466
  apply (erule_tac x = xa in allE)+
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   467
  apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   468
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   469
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   470
lemma kle_trans:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   471
  assumes "kle n x y" "kle n y z" "kle n x z \<or> kle n z x"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   472
  shows "kle n x z"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   473
  using assms
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   474
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   475
    apply (erule disjE)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   476
    apply assumption
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   477
proof -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   478
  case goal1
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   479
  then have "x = z"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   480
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   481
    apply (rule ext)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   482
    apply (drule kle_imp_pointwise)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   483
    apply (erule_tac x=xa in allE)+
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   484
    apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   485
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   486
  then show ?case by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   487
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   488
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   489
lemma kle_strict:
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   490
  assumes "kle n x y" "x \<noteq> y"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   491
  shows "\<forall>j. x j \<le> y j"  "\<exists>k. 1 \<le> k \<and> k \<le> n \<and> x(k) < y(k)"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   492
  apply (rule kle_imp_pointwise[OF assms(1)])
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   493
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   494
  guess k using assms(1)[unfolded kle_def] .. note k = this
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   495
  show "\<exists>k. 1 \<le> k \<and> k \<le> n \<and> x(k) < y(k)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   496
proof (cases "k = {}")
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   497
  case True
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   498
  then have "x = y"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   499
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   500
    apply (rule ext)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   501
    using k apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   502
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   503
  then show ?thesis using assms(2) by auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   504
next
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   505
  case False
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   506
  then have "(SOME k'. k' \<in> k) \<in> k"
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   507
    apply -
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   508
    apply (rule someI_ex)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   509
    apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   510
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   511
  then show ?thesis
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   512
    apply (rule_tac x = "SOME k'. k' \<in> k" in exI)
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   513
    using k apply auto
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   514
    done
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   515
  qed
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   516
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   517
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   518
lemma kle_minimal:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   519
  assumes "finite s" "s \<noteq> {}" "\<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
   520
  shows "\<exists>a\<in>s. \<forall>x\<in>s. kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   521
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   522
  have "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. a j \<le> x j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   523
    apply (rule pointwise_minimal_pointwise_maximal(1)[OF assms(1-2)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   524
    apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   525
    apply (drule_tac assms(3)[rule_format], assumption)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   526
    using kle_imp_pointwise
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   527
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   528
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   529
  then guess a .. note a = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   530
  show ?thesis
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   531
    apply (rule_tac x = a in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   532
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   533
    fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   534
    assume "x \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   535
    show "kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   536
      using assms(3)[rule_format,OF a(1) `x\<in>s`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   537
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   538
    proof (erule disjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   539
      assume "kle n x a"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   540
      then have "x = a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   541
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   542
        unfolding pointwise_antisym[symmetric]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   543
        apply (drule kle_imp_pointwise)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   544
        using a(2)[rule_format,OF `x\<in>s`]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   545
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   546
        done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   547
      then show ?thesis using kle_refl by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   548
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   549
  qed (insert a, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   550
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   551
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   552
lemma kle_maximal:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   553
  assumes "finite s" "s \<noteq> {}" "\<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
   554
  shows "\<exists>a\<in>s. \<forall>x\<in>s. kle n x a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   555
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   556
  have "\<exists>a\<in>s. \<forall>x\<in>s. \<forall>j. a j \<ge> x j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   557
    apply (rule pointwise_minimal_pointwise_maximal(2)[OF assms(1-2)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   558
    apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   559
    apply (drule_tac assms(3)[rule_format],assumption)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   560
    using kle_imp_pointwise apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   561
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   562
  then guess a .. note a = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   563
  show ?thesis 
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   564
    apply (rule_tac x = a in bexI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   565
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   566
    fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   567
    assume "x \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   568
    show "kle n x a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   569
      using assms(3)[rule_format,OF a(1) `x\<in>s`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   570
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   571
    proof (erule disjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   572
      assume "kle n a x"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   573
      then have "x = a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   574
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   575
        unfolding pointwise_antisym[symmetric]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   576
        apply (drule kle_imp_pointwise)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   577
        using a(2)[rule_format,OF `x\<in>s`] apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   578
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   579
      then show ?thesis using kle_refl by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   580
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   581
  qed (insert a, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   582
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   583
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   584
lemma kle_strict_set:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   585
  assumes "kle n x y" "x \<noteq> y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   586
  shows "1 \<le> card {k\<in>{1..n}. x k < y k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   587
proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   588
  guess i using kle_strict(2)[OF assms] ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   589
  then have "card {i} \<le> card {k\<in>{1..n}. x k < y k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   590
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   591
    apply (rule card_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   592
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   593
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   594
  then show ?thesis by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   595
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   596
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   597
lemma kle_range_combine:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   598
  assumes "kle n x y" "kle n y z" "kle n x z \<or> kle n z x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   599
    "m1 \<le> card {k\<in>{1..n}. x k < y k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   600
    "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
   601
  shows "kle n x z \<and> m1 + m2 \<le> card {k\<in>{1..n}. x k < z k}"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   602
  apply (rule, rule kle_trans[OF assms(1-3)])
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   603
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   604
  have "\<And>j. x j < y j \<Longrightarrow> x j < z j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   605
    apply (rule less_le_trans)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   606
    using kle_imp_pointwise[OF assms(2)]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   607
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   608
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   609
  moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   610
  have "\<And>j. y j < z j \<Longrightarrow> x j < z j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   611
    apply (rule le_less_trans)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   612
    using kle_imp_pointwise[OF assms(1)]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   613
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   614
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   615
  ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   616
  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
   617
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   618
  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
   619
    unfolding disjoint_iff_not_equal
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   620
    apply (rule, rule, unfold mem_Collect_eq, rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   621
    apply (erule conjE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   622
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   623
    fix i j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   624
    assume as: "i \<in> {1..n}" "x i < y i" "j \<in> {1..n}" "y j < z j" "\<not> i \<noteq> j"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   625
    guess kx using assms(1)[unfolded kle_def] .. note kx = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   626
    have "x i < y i" using as by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   627
    then have "i \<in> kx" using as(1) kx
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   628
      apply (rule_tac ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   629
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   630
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   631
    then have "x i + 1 = y i" using kx by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   632
    moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   633
    guess ky using assms(2)[unfolded kle_def] .. note ky = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   634
    have "y i < z i" using as by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   635
    then have "i \<in> ky" using as(1) ky
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   636
      apply (rule_tac ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   637
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   638
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   639
    then have "y i + 1 = z i" using ky by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   640
    ultimately
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   641
    have "z i = x i + 2" by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   642
    then show False using assms(3) unfolding kle_def
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   643
      by (auto simp add: split_if_eq1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   644
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   645
  have fin: "\<And>P. finite {x\<in>{1..n::nat}. P x}" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   646
  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
   647
    using assms(4-5) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   648
  also have "\<dots> \<le> card {k\<in>{1..n}. x k < z k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   649
    unfolding card_Un_Int[OF fin fin] unfolding * ** by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   650
  finally show " m1 + m2 \<le> card {k \<in> {1..n}. x k < z k}" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   651
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   652
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   653
lemma kle_range_combine_l:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   654
  assumes "kle n x y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   655
    and "kle n y z"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   656
    and "kle n x z \<or> kle n z x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   657
    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
   658
  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
   659
  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
   660
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   661
lemma kle_range_combine_r:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   662
  assumes "kle n x y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   663
    and "kle n y z"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   664
    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
   665
  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
   666
  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
   667
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   668
lemma kle_range_induct:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   669
  assumes "card s = Suc m"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   670
    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
   671
  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
   672
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   673
  have "finite s" "s\<noteq>{}" using assms(1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   674
    by (auto intro: card_ge_0_finite)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   675
  then show ?thesis using assms
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   676
  proof (induct m arbitrary: s)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   677
    case 0
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   678
    then show ?case using kle_refl by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   679
  next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   680
    case (Suc m)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   681
    then obtain a where a: "a \<in> s" "\<forall>x\<in>s. kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   682
      using kle_minimal[of s n] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   683
    show ?case
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   684
    proof (cases "s \<subseteq> {a}")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   685
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   686
      then have "card (s - {a}) = Suc m" "s - {a} \<noteq> {}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   687
        using card_Diff_singleton[OF _ a(1)] Suc(4) `finite s` by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   688
      then obtain x b where xb:"x\<in>s - {a}" "b\<in>s - {a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   689
        "kle n x b" "m \<le> card {k \<in> {1..n}. x k < b k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   690
        using Suc(1)[of "s - {a}"] using Suc(5) `finite s` by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   691
      have "1 \<le> card {k \<in> {1..n}. a k < x k}" "m \<le> card {k \<in> {1..n}. x k < b k}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   692
        apply (rule kle_strict_set)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   693
        apply (rule a(2)[rule_format])
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   694
        using a and xb
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   695
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   696
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   697
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   698
        apply (rule_tac x=a in bexI, rule_tac x=b in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   699
        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
   700
        using a(1) xb(1-2)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   701
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   702
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   703
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   704
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   705
      then have "s = {a}" using Suc(3) by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   706
      then have "card s = 1" by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   707
      then have False using Suc(4) `finite s` by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   708
      then show ?thesis by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   709
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   710
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   711
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   712
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   713
lemma kle_Suc: "kle n x y \<Longrightarrow> kle (n + 1) x y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   714
  unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   715
  apply (erule exE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   716
  apply (rule_tac x=k in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   717
  apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   718
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   719
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   720
lemma kle_trans_1:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   721
  assumes "kle n x y"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   722
  shows "x j \<le> y j" "y j \<le> x j + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   723
  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
   724
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   725
lemma kle_trans_2:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   726
  assumes "kle n a b" "kle n b c" "\<forall>j. c j \<le> a j + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   727
  shows "kle n a c"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   728
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   729
  guess kk1 using assms(1)[unfolded kle_def] .. note kk1 = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   730
  guess kk2 using assms(2)[unfolded kle_def] .. note kk2 = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   731
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   732
    unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   733
    apply (rule_tac x="kk1 \<union> kk2" in exI)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   734
    apply rule
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   735
    defer
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   736
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   737
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   738
    show "c i = a i + (if i \<in> kk1 \<union> kk2 then 1 else 0)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   739
    proof (cases "i \<in> kk1 \<union> kk2")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   740
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   741
      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
   742
        unfolding kk1[THEN conjunct2,rule_format,of i] kk2[THEN conjunct2,rule_format,of i]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   743
        by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   744
      moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   745
      have "c i \<le> a i + (if i \<in> kk1 \<union> kk2 then 1 else 0)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   746
        using True assms(3) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   747
      ultimately show ?thesis by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   748
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   749
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   750
      then show ?thesis using kk1 kk2 by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   751
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   752
  qed (insert kk1 kk2, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   753
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   754
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   755
lemma kle_between_r:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   756
  assumes "kle n a b" "kle n b c" "kle n a x" "kle n c x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   757
  shows "kle n b x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   758
  apply (rule kle_trans_2[OF assms(2,4)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   759
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   760
  have *: "\<And>c b x::nat. x \<le> c + 1 \<Longrightarrow> c \<le> b \<Longrightarrow> x \<le> b + 1" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   761
  fix j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   762
  show "x j \<le> b j + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   763
    apply (rule *)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   764
    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
   765
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   766
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   767
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   768
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   769
lemma kle_between_l:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   770
  assumes "kle n a b" "kle n b c" "kle n x a" "kle n x c"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   771
  shows "kle n x b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   772
  apply (rule kle_trans_2[OF assms(3,1)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   773
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   774
  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
   775
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   776
  fix j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   777
  show "b j \<le> x j + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   778
    apply (rule *)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   779
    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
   780
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   781
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   782
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   783
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   784
lemma kle_adjacent:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   785
  assumes "\<forall>j. b j = (if j = k then a(j) + 1 else a j)" "kle n a x" "kle n x b"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   786
  shows "x = a \<or> x = b"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   787
proof (cases "x k = a k")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   788
  case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   789
  show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   790
    apply (rule disjI1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   791
    apply (rule ext)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   792
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   793
    fix j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   794
    have "x j \<le> a j" using kle_imp_pointwise[OF assms(3),THEN spec[where x=j]]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   795
      unfolding assms(1)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   796
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   797
      apply(cases "j = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   798
      using True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   799
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   800
      done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   801
    then show "x j = a j"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   802
      using kle_imp_pointwise[OF assms(2),THEN spec[where x=j]] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   803
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   804
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   805
  case False
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   806
  show ?thesis apply(rule disjI2,rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   807
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   808
    fix j
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   809
    have "x j \<ge> b j"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   810
      using kle_imp_pointwise[OF assms(2),THEN spec[where x=j]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   811
      unfolding assms(1)[rule_format]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   812
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   813
      apply(cases "j = k")
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   814
      using False by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   815
    then show "x j = b j"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   816
      using kle_imp_pointwise[OF assms(3),THEN spec[where x=j]]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   817
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   818
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   819
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   820
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   821
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   822
subsection {* kuhn's notion of a simplex (a reformulation to avoid so much indexing). *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   823
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   824
definition "ksimplex p n (s::(nat \<Rightarrow> nat) set) \<longleftrightarrow>
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   825
  card s = n + 1 \<and>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   826
  (\<forall>x\<in>s. \<forall>j. x j \<le> p) \<and>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   827
  (\<forall>x\<in>s. \<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p) \<and>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   828
  (\<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
   829
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   830
lemma ksimplexI:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   831
  "card s = n + 1 \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   832
  \<forall>x\<in>s. \<forall>j. x j \<le> p \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   833
  \<forall>x\<in>s. \<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   834
  \<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
   835
  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
   836
  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
   837
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   838
lemma ksimplex_eq:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   839
  "ksimplex p n (s::(nat \<Rightarrow> nat) set) \<longleftrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   840
    (card s = n + 1 \<and> finite s \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   841
    (\<forall>x\<in>s. \<forall>j. x(j) \<le> p) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   842
    (\<forall>x\<in>s. \<forall>j. j\<notin>{1..n} \<longrightarrow> (x j = p)) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   843
    (\<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
   844
  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
   845
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   846
lemma ksimplex_extrema:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   847
  assumes "ksimplex p n s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   848
  obtains a b where "a \<in> s" "b \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   849
    "\<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
   850
proof (cases "n = 0")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   851
  case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   852
  obtain x where *: "s = {x}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   853
    using assms[unfolded ksimplex_eq True,THEN conjunct1]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   854
    unfolding add_0_left card_1_exists by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   855
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   856
    apply (rule that[of x x]) unfolding * True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   857
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   858
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   859
next
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   860
  note assm = assms[unfolded ksimplex_eq]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   861
  case False
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   862
  have "s\<noteq>{}" using assm by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   863
  obtain a where a: "a \<in> s" "\<forall>x\<in>s. kle n a x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   864
    using `s\<noteq>{}` assm using kle_minimal[of s n] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   865
  obtain b where b: "b \<in> s" "\<forall>x\<in>s. kle n x b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   866
    using `s\<noteq>{}` assm using kle_maximal[of s n] by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
   867
  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}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   868
    using kle_range_induct[of s n n] using assm by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   869
  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
   870
    apply (rule kle_range_combine_r[where y=d])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   871
    using c_d a b
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   872
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   873
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   874
  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
   875
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   876
    apply (rule kle_range_combine_l[where y=c])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   877
    using a `c \<in> s` `b \<in> s`
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   878
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   879
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   880
  moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   881
  have "card {1..n} \<ge> card {k\<in>{1..n}. a(k) < b(k)}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   882
    by (rule card_mono) auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   883
  ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   884
  have *: "{k\<in>{1 .. n}. a k < b k} = {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   885
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   886
    apply (rule card_subset_eq)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   887
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   888
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   889
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   890
    apply (rule that[OF a(1) b(1)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   891
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   892
    apply (subst *[symmetric]) unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   893
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   894
    guess k using a(2)[rule_format,OF b(1),unfolded kle_def] .. note k = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   895
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   896
    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
   897
    proof (cases "i \<in> {1..n}")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   898
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   899
      then show ?thesis unfolding k[THEN conjunct2,rule_format] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   900
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   901
      case False
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   902
      have "a i = p" using assm and False `a\<in>s` by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   903
      moreover have "b i = p" using assm and False `b\<in>s` by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   904
      ultimately show ?thesis by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   905
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   906
  qed(insert a(2) b(2) assm, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   907
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   908
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   909
lemma ksimplex_extrema_strong:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   910
  assumes "ksimplex p n s" "n \<noteq> 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   911
  obtains a b where "a \<in> s" "b \<in> s" "a \<noteq> b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   912
    "\<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
   913
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   914
  obtain a b where ab: "a \<in> s" "b \<in> s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   915
    "\<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
   916
    apply (rule ksimplex_extrema[OF assms(1)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   917
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   918
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   919
  have "a \<noteq> b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   920
    apply (rule notI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   921
    apply (drule cong[of _ _ 1 1])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   922
    using ab(4) assms(2) apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   923
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   924
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   925
    apply (rule_tac that[of a b])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   926
    using ab apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   927
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   928
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   929
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   930
lemma ksimplexD:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   931
  assumes "ksimplex p n s"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   932
  shows "card s = n + 1" "finite s" "card s = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   933
    "\<forall>x\<in>s. \<forall>j. x j \<le> p" "\<forall>x\<in>s. \<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   934
    "\<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
   935
  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
   936
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   937
lemma ksimplex_successor:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   938
  assumes "ksimplex p n s" "a \<in> s"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   939
  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
   940
proof (cases "\<forall>x\<in>s. kle n x a")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   941
  case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   942
  then show ?thesis by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   943
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   944
  note assm = ksimplexD[OF assms(1)]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   945
  case False
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   946
  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"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   947
    using kle_minimal[of "{x\<in>s. \<not> kle n x a}" n] and assm by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   948
  then have **: "1 \<le> card {k\<in>{1..n}. a k < b k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   949
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   950
    apply (rule kle_strict_set)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   951
    using assm(6) and `a\<in>s`
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   952
    apply (auto simp add:kle_refl)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   953
    done
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
  let ?kle1 = "{x \<in> s. \<not> kle n x a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   956
  have "card ?kle1 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   957
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   958
    using assm(2) and False
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   959
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   960
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   961
  then have sizekle1: "card ?kle1 = Suc (card ?kle1 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   962
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   963
  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
   964
    "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
   965
    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
   966
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   967
  let ?kle2 = "{x \<in> s. kle n x a}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   968
  have "card ?kle2 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   969
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   970
    using assm(6)[rule_format,of a a] and `a\<in>s` and assm(2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   971
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   972
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   973
  then have sizekle2: "card ?kle2 = Suc (card ?kle2 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   974
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   975
  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
   976
    "kle n e f" "card ?kle2 - 1 \<le> card {k \<in> {1..n}. e k < f k}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   977
    using kle_range_induct[OF sizekle2, 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
   978
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   979
  have "card {k\<in>{1..n}. a k < b k} = 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   980
  proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   981
    case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   982
    then have as: "card {k\<in>{1..n}. a k < b k} \<ge> 2"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   983
      using ** by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   984
    have *: "finite ?kle2" "finite ?kle1" "?kle2 \<union> ?kle1 = s" "?kle2 \<inter> ?kle1 = {}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   985
      using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   986
    have "(card ?kle2 - 1) + 2 + (card ?kle1 - 1) = card ?kle2 + card ?kle1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   987
      using sizekle1 sizekle2 by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   988
    also have "\<dots> = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   989
      unfolding card_Un_Int[OF *(1-2)] *(3-) using assm(3) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   990
    finally have n: "(card ?kle2 - 1) + (2 + (card ?kle1 - 1)) = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   991
      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
   992
    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
   993
      apply (rule kle_range_combine_r[where y=f])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   994
      using e_f using `a\<in>s` assm(6)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   995
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   996
      done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   997
    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
   998
      apply (rule kle_range_combine_l[where y=c])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   999
      using c_d using assm(6) and b
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1000
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1001
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1002
    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
  1003
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1004
      apply (rule kle_range_combine[where y=b]) using as and b assm(6) `a\<in>s` `d\<in>s`
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1005
      apply blast+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1006
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1007
    ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1008
    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
  1009
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1010
      apply (rule kle_range_combine[where y=a]) using assm(6)[rule_format,OF `e\<in>s` `d\<in>s`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1011
      apply blast+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1012
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1013
    moreover have "card {k \<in> {1..n}. e k < d k} \<le> card {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1014
      by (rule card_mono) auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1015
    ultimately show False unfolding n by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1016
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1017
  then guess k unfolding card_1_exists .. note k = this[unfolded mem_Collect_eq]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1018
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1019
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1020
    apply (rule disjI2)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1021
    apply (rule_tac x=b in bexI, rule_tac x=k in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1022
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1023
    fix j :: nat
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1024
    have "kle n a b"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1025
      using b and assm(6)[rule_format, OF `a\<in>s` `b\<in>s`] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1026
    then guess kk unfolding kle_def .. note kk_raw = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1027
    note kk = this[THEN conjunct2, rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1028
    have kkk: "k \<in> kk"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1029
      apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1030
      using k(1)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1031
      unfolding kk
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1032
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1033
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1034
    show "b j = (if j = k then a j + 1 else a j)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1035
    proof (cases "j \<in> kk")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1036
      case True
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1037
      then have "j = k"
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1038
        apply -
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1039
        apply (rule k(2)[rule_format])
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1040
        using kk_raw kkk
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1041
        apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1042
        done
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1043
      then show ?thesis unfolding kk using kkk by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1044
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1045
      case False
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1046
      then have "j \<noteq> k"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1047
        using k(2)[rule_format, of j k] and kk_raw kkk by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1048
      then show ?thesis unfolding kk using kkk and False
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1049
        by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1050
    qed
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1051
  qed (insert k(1) `b\<in>s`, auto)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1052
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1053
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1054
lemma ksimplex_predecessor:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1055
  assumes "ksimplex p n s" "a \<in> s"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1056
  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
  1057
proof (cases "\<forall>x\<in>s. kle n a x")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1058
  case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1059
  then show ?thesis by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1060
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1061
  note assm = ksimplexD[OF assms(1)]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1062
  case False
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1063
  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"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1064
    using kle_maximal[of "{x\<in>s. \<not> kle n a x}" n] and assm by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1065
  then have **: "1 \<le> card {k\<in>{1..n}. a k > b k}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1066
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1067
    apply (rule kle_strict_set)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1068
    using assm(6) and `a\<in>s`
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1069
    apply (auto simp add: kle_refl)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1070
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1071
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1072
  let ?kle1 = "{x \<in> s. \<not> kle n a x}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1073
  have "card ?kle1 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1074
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1075
    using assm(2) and False
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1076
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1077
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1078
  then have sizekle1: "card ?kle1 = Suc (card ?kle1 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1079
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1080
  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
  1081
    "kle n d c" "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
  1082
    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
  1083
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1084
  let ?kle2 = "{x \<in> s. kle n a x}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1085
  have "card ?kle2 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1086
    apply (rule ccontr)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1087
    using assm(6)[rule_format,of a a] and `a\<in>s` and assm(2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1088
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1089
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1090
  then have sizekle2:"card ?kle2 = Suc (card ?kle2 - 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1091
    using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1092
  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
  1093
    "kle n f e" "card ?kle2 - 1 \<le> card {k \<in> {1..n}. e k > f k}"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1094
    using kle_range_induct[OF sizekle2, 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
  1095
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1096
  have "card {k\<in>{1..n}. a k > b k} = 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1097
  proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1098
    case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1099
    then have as: "card {k\<in>{1..n}. a k > b k} \<ge> 2"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1100
      using ** by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1101
    have *: "finite ?kle2" "finite ?kle1" "?kle2 \<union> ?kle1 = s" "?kle2 \<inter> ?kle1 = {}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1102
      using assm(2) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1103
    have "(card ?kle2 - 1) + 2 + (card ?kle1 - 1) = card ?kle2 + card ?kle1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1104
      using sizekle1 sizekle2 by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1105
    also have "\<dots> = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1106
      unfolding card_Un_Int[OF *(1-2)] *(3-) using assm(3) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1107
    finally have n: "(card ?kle1 - 1) + 2 + (card ?kle2 - 1) = n + 1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1108
      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
  1109
    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
  1110
      apply (rule kle_range_combine_l[where y=f])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1111
      using e_f and `a\<in>s` assm(6)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1112
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1113
      done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1114
    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
  1115
      apply (rule kle_range_combine_r[where y=c])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1116
      using c_d and assm(6) and b
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1117
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1118
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1119
    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
  1120
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1121
      apply (rule kle_range_combine[where y=b]) using as and b assm(6) `a\<in>s` `d\<in>s`
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1122
      apply blast+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1123
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1124
    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
  1125
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1126
      apply (rule kle_range_combine[where y=a])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1127
      using assm(6)[rule_format,OF `e\<in>s` `d\<in>s`]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1128
      apply blast+
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1129
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1130
    moreover have "card {k \<in> {1..n}. e k > d k} \<le> card {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1131
      by (rule card_mono) auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1132
    ultimately show False unfolding n by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1133
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1134
  then guess k unfolding card_1_exists .. note k = this[unfolded mem_Collect_eq]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1135
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1136
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1137
    apply (rule disjI2)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1138
    apply (rule_tac x=b in bexI,rule_tac x=k in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1139
  proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1140
    fix j :: nat
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1141
    have "kle n b a"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1142
      using b and assm(6)[rule_format, OF `a\<in>s` `b\<in>s`] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1143
    then guess kk unfolding kle_def .. note kk_raw = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1144
    note kk = this[THEN conjunct2,rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1145
    have kkk: "k \<in> kk"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1146
      apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1147
      using k(1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1148
      unfolding kk
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1149
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1150
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1151
    show "a j = (if j = k then b j + 1 else b j)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1152
    proof (cases "j \<in> kk")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1153
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1154
      then have "j = k"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1155
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1156
        apply (rule k(2)[rule_format])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1157
        using kk_raw kkk
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 show ?thesis unfolding kk using kkk by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1161
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1162
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1163
      then have "j \<noteq> k" using k(2)[rule_format, of j k]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1164
        using kk_raw kkk by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1165
      then show ?thesis unfolding kk
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1166
        using kkk and False by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1167
    qed
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1168
  qed (insert k(1) `b\<in>s`, auto)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1169
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1170
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1171
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1172
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
  1173
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1174
(* FIXME: These are clones of lemmas in Library/FuncSet *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1175
lemma card_funspace':
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1176
  assumes "finite s" "finite t" "card s = m" "card t = n"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1177
  shows "card {f. (\<forall>x\<in>s. f x \<in> t) \<and> (\<forall>x\<in>UNIV - s. f x = d)} = n ^ m"  (is "card (?M s) = _")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1178
  using assms
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1179
  apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1180
proof (induct m arbitrary: s)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1181
  case 0
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1182
  have [simp]: "{f. \<forall>x. f x = d} = {\<lambda>x. d}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1183
    apply (rule set_eqI,rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1184
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1185
    apply (rule, rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1186
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1187
    done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1188
  from 0 show ?case by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1189
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1190
  case (Suc m)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1191
  guess a using card_eq_SucD[OF Suc(4)] ..
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1192
  then guess s0 by (elim exE conjE) note as0 = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1193
  have **: "card s0 = m"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1194
    using as0 using Suc(2) Suc(4) by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1195
  let ?l = "(\<lambda>(b, g) x. if x = a then b else g x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1196
  have *: "?M (insert a s0) = ?l ` {(b,g). b\<in>t \<and> g\<in>?M s0}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1197
    apply (rule set_eqI, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1198
    unfolding mem_Collect_eq image_iff
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1199
    apply (erule conjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1200
    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
  1201
    apply (rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1202
    prefer 3
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1203
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1204
    defer
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1205
    apply (erule bexE, rule)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1206
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1207
    apply (erule splitE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1208
    apply (erule conjE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1209
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1210
    fix x xa xb xc y
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1211
    assume as: "x = (\<lambda>(b, g) x. if x = a then b else g x) xa"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1212
      "xb \<in> UNIV - insert a s0" "xa = (xc, y)" "xc \<in> t"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1213
      "\<forall>x\<in>s0. y x \<in> t" "\<forall>x\<in>UNIV - s0. y x = d"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1214
    then show "x xb = d" unfolding as by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1215
  qed auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1216
  have inj: "inj_on ?l {(b,g). b\<in>t \<and> g\<in>?M s0}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1217
    unfolding inj_on_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1218
      apply (rule, rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1219
      unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1220
      apply (erule splitE conjE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1221
  proof -
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1222
    case goal1 note as = this(1,4-)[unfolded goal1 split_conv]
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1223
    have "xa = xb" using as(1)[THEN cong[of _ _ a]] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1224
    moreover have "ya = yb"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1225
    proof (rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1226
      fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1227
      show "ya x = yb x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1228
      proof (cases "x = a")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1229
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1230
        then show ?thesis using as(1)[THEN cong[of _ _ x x]] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1231
      next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1232
        case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1233
        then show ?thesis using as(5,7) using as0(2) by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1234
      qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1235
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1236
    ultimately show ?case unfolding goal1 by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1237
  qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1238
  have "finite s0" using `finite s` unfolding as0 by simp
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1239
  show ?case
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1240
    unfolding as0 * card_image[OF inj]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1241
    using assms
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1242
    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
  1243
    unfolding card_cartesian_product
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1244
    using Suc(1)[OF `finite s0` `finite t` ** `card t = n`]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1245
    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
  1246
qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1247
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1248
lemma card_funspace:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1249
  assumes "finite s" "finite t"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1250
  shows "card {f. (\<forall>x\<in>s. f x \<in> t) \<and> (\<forall>x\<in>UNIV - s. f x = d)} = (card t) ^ (card s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1251
  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
  1252
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1253
lemma finite_funspace:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1254
  assumes "finite s" "finite t"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1255
  shows "finite {f. (\<forall>x\<in>s. f x \<in> t) \<and> (\<forall>x\<in>UNIV - s. f x = d)}" (is "finite ?S")
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1256
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
  1257
  case True
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1258
  have "card ?S = (card t) ^ (card s)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1259
    using assms by (auto intro!: card_funspace)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1260
  then show ?thesis 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
  1261
next
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1262
  case False then have "t = {}" 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
  1263
  show ?thesis
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1264
  proof (cases "s = {}")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1265
    have *: "{f. \<forall>x. f x = d} = {\<lambda>x. d}" by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1266
    case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1267
    then show ?thesis 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
  1268
  next
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1269
    case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1270
    then show ?thesis 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
  1271
  qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1272
qed
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1273
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1274
lemma finite_simplices: "finite {s. ksimplex p n s}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1275
  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
  1276
  unfolding ksimplex_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1277
  defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1278
  apply (rule finite_Collect_subsets)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1279
  apply (rule finite_funspace)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1280
  apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1281
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1282
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1283
lemma simplex_top_face:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1284
  assumes "0 < p" "\<forall>x\<in>f. x (n + 1) = p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1285
  shows "(\<exists>s a. ksimplex p (n + 1) s \<and> a \<in> s \<and> (f = s - {a})) \<longleftrightarrow> ksimplex p n f" (is "?ls = ?rs")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1286
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1287
  assume ?ls
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1288
  then guess s ..
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1289
  then guess a by (elim exE conjE) note sa = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1290
  show ?rs
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1291
    unfolding ksimplex_def sa(3)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1292
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1293
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1294
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1295
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1296
    apply (rule, rule, rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1297
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1298
    apply (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1299
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1300
    fix x y
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1301
    assume as: "x \<in>s - {a}" "y \<in>s - {a}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1302
    have xyp: "x (n + 1) = y (n + 1)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1303
      using as(1)[unfolded sa(3)[symmetric], THEN assms(2)[rule_format]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1304
      using as(2)[unfolded sa(3)[symmetric], THEN assms(2)[rule_format]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1305
      by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1306
    show "kle n x y \<or> kle n y x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1307
    proof (cases "kle (n + 1) x y")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1308
      case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1309
      then guess k unfolding kle_def .. note k = this
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1310
      then have *: "n + 1 \<notin> k" using xyp by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1311
      have "\<not> (\<exists>x\<in>k. x\<notin>{1..n})"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1312
        apply (rule notI)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1313
        apply (erule bexE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1314
      proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1315
        fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1316
        assume as: "x \<in> k" "x \<notin> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1317
        have "x \<noteq> n + 1" using as and * by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1318
        then show False using as and k[THEN conjunct1,unfolded subset_eq] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1319
      qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1320
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1321
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1322
        apply (rule disjI1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1323
        unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1324
        using k
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1325
        apply (rule_tac x=k in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1326
        apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1327
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1328
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1329
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1330
      then have "kle (n + 1) y x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1331
        using ksimplexD(6)[OF sa(1),rule_format, of x y] and as by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1332
      then guess k unfolding kle_def .. note k = this
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1333
      then have *: "n + 1 \<notin> k" using xyp by auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1334
      then have "\<not> (\<exists>x\<in>k. x\<notin>{1..n})"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1335
        apply -
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1336
        apply (rule notI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1337
        apply (erule bexE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1338
      proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1339
        fix x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1340
        assume as: "x \<in> k" "x \<notin> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1341
        have "x \<noteq> n + 1" using as and * by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1342
        then show False using as and k[THEN conjunct1,unfolded subset_eq] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1343
      qed
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1344
      then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1345
        apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1346
        apply (rule disjI2)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1347
        unfolding kle_def
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1348
        using k
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1349
        apply (rule_tac x = k in exI)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1350
        apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1351
        done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1352
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1353
  next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1354
    fix x j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1355
    assume as: "x \<in> s - {a}" "j\<notin>{1..n}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1356
    then show "x j = p"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1357
      using as(1)[unfolded sa(3)[symmetric], THEN assms(2)[rule_format]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1358
      apply (cases "j = n+1")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1359
      using sa(1)[unfolded ksimplex_def]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1360
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1361
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1362
  qed (insert sa ksimplexD[OF sa(1)], auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1363
next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1364
  assume ?rs note rs=ksimplexD[OF this]
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1365
  guess a b by (rule ksimplex_extrema[OF `?rs`]) note ab = this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1366
  def c \<equiv> "\<lambda>i. if i = (n + 1) then p - 1 else a i"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1367
  have "c \<notin> f"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1368
    apply (rule notI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1369
    apply (drule assms(2)[rule_format])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1370
    unfolding c_def
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1371
    using assms(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1372
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1373
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1374
  then show ?ls
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1375
    apply (rule_tac x = "insert c f" in exI, rule_tac x = c in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1376
    unfolding ksimplex_def conj_assoc
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1377
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1378
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1379
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1380
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1381
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1382
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1383
    apply (rule conjI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1384
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1385
  proof (rule_tac[3-5] ballI allI)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1386
    fix x j
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1387
    assume x: "x \<in> insert c f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1388
    then show "x j \<le> p"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1389
    proof (cases "x=c")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1390
      case True
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1391
      show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1392
        unfolding True c_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1393
        apply (cases "j=n+1")
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1394
        using ab(1) and rs(4)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1395
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1396
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1397
    qed (insert x rs(4), auto simp add:c_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1398
    show "j \<notin> {1..n + 1} \<longrightarrow> x j = p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1399
      apply (cases "x = c")
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1400
      using x ab(1) rs(5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1401
      unfolding c_def
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1402
      apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1403
      done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1404
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1405
      fix z
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1406
      assume z: "z \<in> insert c f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1407
      then have "kle (n + 1) c z"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1408
        apply (cases "z = c") (*defer apply(rule kle_Suc)*)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1409
      proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1410
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1411
        then have "z \<in> f" using z by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1412
        then guess k
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1413
          apply (drule_tac ab(3)[THEN bspec[where x=z], THEN conjunct1])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1414
          unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1415
          apply (erule exE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1416
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1417
        then show "kle (n + 1) c z"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1418
          unfolding kle_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1419
          apply (rule_tac x="insert (n + 1) k" in exI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1420
          unfolding c_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1421
          using ab
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1422
          using rs(5)[rule_format,OF ab(1),of "n + 1"] assms(1)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1423
          apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1424
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1425
        qed auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1426
    } note * = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1427
    fix y
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1428
    assume y: "y \<in> insert c f"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1429
    show "kle (n + 1) x y \<or> kle (n + 1) y x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1430
    proof (cases "x = c \<or> y = c")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1431
      case False then have **: "x \<in> f" "y \<in> f" using x y by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1432
      show ?thesis using rs(6)[rule_format,OF **]
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1433
        by (auto dest: kle_Suc)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1434
    qed (insert * x y, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1435
  qed (insert rs, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1436
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1437
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1438
lemma ksimplex_fix_plane:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1439
  assumes "a \<in> s" "j\<in>{1..n::nat}" "\<forall>x\<in>s - {a}. x j = q" "a0 \<in> s" "a1 \<in> s"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1440
    "\<forall>i. a1 i = ((if i\<in>{1..n} then a0 i + 1 else a0 i)::nat)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1441
  shows "(a = a0) \<or> (a = a1)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1442
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1443
  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
  1444
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1445
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1446
    apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1447
    using *[OF assms(3), of a0 a1]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1448
    unfolding assms(6)[THEN spec[where x=j]]
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1449
    using assms(1-2,4-5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1450
    apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1451
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1452
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1453
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1454
lemma ksimplex_fix_plane_0:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1455
  assumes "a \<in> s" "j\<in>{1..n::nat}" "\<forall>x\<in>s - {a}. x j = 0" "a0 \<in> s" "a1 \<in> s"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1456
    "\<forall>i. a1 i = ((if i\<in>{1..n} then a0 i + 1 else a0 i)::nat)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1457
  shows "a = a1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1458
    apply (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1459
    using ksimplex_fix_plane[OF assms]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1460
    using assms(3)[THEN bspec[where x=a1]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1461
    using assms(2,5)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1462
    unfolding assms(6)[THEN spec[where x=j]]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1463
    apply simp
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1464
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1465
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1466
lemma ksimplex_fix_plane_p:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1467
  assumes "ksimplex p n s" "a \<in> s" "j\<in>{1..n}" "\<forall>x\<in>s - {a}. x j = p" "a0 \<in> s" "a1 \<in> s"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1468
    "\<forall>i. a1 i = (if i\<in>{1..n} then a0 i + 1 else a0 i)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1469
  shows "a = a0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1470
proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1471
  note s = ksimplexD[OF assms(1),rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1472
  assume as: "a \<noteq> a0"
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1473
  then have *: "a0 \<in> s - {a}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1474
    using assms(5) by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1475
  then have "a1 = a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1476
    using ksimplex_fix_plane[OF assms(2-)] by auto
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1477
  then show False
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1478
    using as and assms(3,5) and assms(7)[rule_format,of j]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1479
    unfolding assms(4)[rule_format,OF *]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1480
    using s(4)[OF assms(6), of j]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1481
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1482
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1483
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1484
lemma ksimplex_replace_0:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1485
  assumes "ksimplex p n s" "a \<in> s" "n \<noteq> 0" "j\<in>{1..n}" "\<forall>x\<in>s - {a}. x j = 0"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1486
  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
  1487
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1488
  have *: "\<And>s' a a'. s' - {a'} = s - {a} \<Longrightarrow> a' = a \<Longrightarrow> a' \<in> s' \<Longrightarrow> a \<in> s \<Longrightarrow> (s' = s)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1489
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1490
  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
  1491
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1492
    case goal1
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1493
    guess a0 a1 by (rule ksimplex_extrema_strong[OF assms(1,3)]) note exta = this[rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1494
    have a:"a = a1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1495
      apply (rule ksimplex_fix_plane_0[OF assms(2,4-5)])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1496
      using exta(1-2,5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1497
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1498
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1499
    moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1500
    guess b0 b1 by (rule ksimplex_extrema_strong[OF goal1(1) assms(3)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1501
    note extb = this[rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1502
    have a': "a' = b1"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1503
      apply (rule ksimplex_fix_plane_0[OF goal1(2) assms(4), of b0])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1504
      unfolding goal1(3)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1505
      using assms extb goal1
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1506
      apply auto
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1507
      done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1508
    moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1509
    have "b0 = a0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1510
      unfolding kle_antisym[symmetric, of b0 a0 n]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1511
      using exta extb and goal1(3)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1512
      unfolding a a' by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1513
    then have "b1 = a1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1514
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1515
      apply (rule ext)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1516
      unfolding exta(5) extb(5)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1517
      apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1518
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1519
    ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1520
    show "s' = s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1521
      apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1522
      apply (rule *[of _ a1 b1])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1523
      using exta(1-2) extb(1-2) goal1
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1524
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1525
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1526
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1527
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1528
    unfolding card_1_exists
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1529
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1530
    apply(rule ex1I[of _ s])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1531
    unfolding mem_Collect_eq
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1532
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1533
    apply (erule conjE bexE)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1534
    apply (rule_tac a'=b in **)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1535
    using assms(1,2)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1536
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1537
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1538
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1539
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1540
lemma ksimplex_replace_1:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1541
  assumes "ksimplex p n s" "a \<in> s" "n \<noteq> 0" "j\<in>{1..n}" "\<forall>x\<in>s - {a}. x j = p"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1542
  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
  1543
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1544
  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
  1545
    by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1546
  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
  1547
  proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1548
    case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1549
    guess a0 a1 by (rule ksimplex_extrema_strong[OF assms(1,3)]) note exta = this [rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1550
    have a: "a = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1551
      apply (rule ksimplex_fix_plane_p[OF assms(1-2,4-5) exta(1,2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1552
      unfolding exta
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1553
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1554
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1555
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1556
    guess b0 b1 by (rule ksimplex_extrema_strong[OF goal1(1) assms(3)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1557
    note extb = this [rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1558
    have a': "a' = b0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1559
      apply (rule ksimplex_fix_plane_p[OF goal1(1-2) assms(4), of _ b1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1560
      unfolding goal1 extb
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1561
      using extb(1,2) assms(5)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1562
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1563
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1564
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1565
    have *: "b1 = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1566
      unfolding kle_antisym[symmetric, of b1 a1 n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1567
      using exta extb
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1568
      using goal1(3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1569
      unfolding a a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1570
      by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1571
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1572
    have "a0 = b0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1573
      apply (rule ext)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1574
    proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1575
      case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1576
      show "a0 x = b0 x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1577
        using *[THEN cong, of x x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1578
        unfolding exta extb
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1579
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1580
        apply (cases "x \<in> {1..n}")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1581
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1582
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1583
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1584
    ultimately
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1585
    show "s' = s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1586
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1587
      apply (rule lem[OF goal1(3) _ goal1(2) assms(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1588
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1589
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1590
  qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1591
  show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1592
    unfolding card_1_exists
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1593
    apply (rule ex1I[of _ s])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1594
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1595
    apply (rule, rule assms(1))
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1596
    apply (rule_tac x = a in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1597
    prefer 3
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1598
    apply (erule conjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1599
    apply (rule_tac a'=b in lem)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1600
    using assms(1-2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1601
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1602
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1603
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1604
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1605
lemma ksimplex_replace_2:
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1606
  assumes "ksimplex p n s" "a \<in> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1607
    "n \<noteq> 0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1608
    "~(\<exists>j\<in>{1..n}. \<forall>x\<in>s - {a}. x j = 0)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1609
    "~(\<exists>j\<in>{1..n}. \<forall>x\<in>s - {a}. x j = p)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1610
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1611
  (is "card ?A = 2")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1612
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1613
  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
  1614
    by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1615
  have lem2: "\<And>a b. a\<in>s \<Longrightarrow> b\<noteq>a \<Longrightarrow> s \<noteq> insert b (s - {a})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1616
  proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1617
    case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1618
    then have "a \<in> insert b (s - {a})" by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1619
    then have "a \<in> s - {a}" unfolding insert_iff using goal1 by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1620
    then show False by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1621
  qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1622
  guess a0 a1 by (rule ksimplex_extrema_strong[OF assms(1,3)]) note a0a1 = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1623
  {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1624
    assume "a = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1625
    have *: "\<And>P Q. (P \<or> Q) \<Longrightarrow> \<not> P \<Longrightarrow> Q" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1626
    have "\<exists>x\<in>s. \<not> kle n x a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1627
      apply (rule_tac x=a1 in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1628
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1629
      assume as: "kle n a1 a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1630
      show False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1631
        using kle_imp_pointwise[OF as,THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1632
        unfolding a0a1(5)[THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1633
        using assms(3) by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1634
    qed (insert a0a1, auto)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1635
    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
  1636
      apply (rule_tac *[OF ksimplex_successor[OF assms(1-2),unfolded `a=a0`]])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1637
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1638
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1639
    then guess a2 ..
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1640
    from this(2) guess k .. note k = this note a2 =`a2 \<in> s`
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1641
    def a3 \<equiv> "\<lambda>j. if j = k then a1 j + 1 else a1 j"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1642
    have "a3 \<notin> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1643
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1644
      assume "a3\<in>s"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1645
      then have "kle n a3 a1"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1646
      using a0a1(4) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1647
      then show False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1648
        apply (drule_tac kle_imp_pointwise) unfolding a3_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1649
        apply (erule_tac x = k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1650
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1651
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1652
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1653
    then have "a3 \<noteq> a0" "a3 \<noteq> a1" using a0a1 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
  1654
    have "a2 \<noteq> a0" using k(2)[THEN spec[where x=k]] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1655
    have lem3: "\<And>x. x\<in>(s - {a0}) \<Longrightarrow> kle n a2 x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1656
    proof (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1657
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1658
      then have as: "x\<in>s" "x\<noteq>a0" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1659
      have "kle n a2 x \<or> kle n x a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1660
        using ksimplexD(6)[OF assms(1)] and as `a2\<in>s` by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1661
      moreover
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1662
      have "kle n a0 x" using a0a1(4) as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1663
      ultimately have "x = a0 \<or> x = a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1664
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1665
        apply (rule kle_adjacent[OF k(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1666
        using goal1(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1667
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1668
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1669
      then have "x = a2" using as by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1670
      then show False using goal1(2) using kle_refl by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1671
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1672
    let ?s = "insert a3 (s - {a0})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1673
    have "ksimplex p n ?s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1674
      apply (rule ksimplexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1675
    proof (rule_tac[2-] ballI,rule_tac[4] ballI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1676
      show "card ?s = n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1677
        using ksimplexD(2-3)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1678
        using `a3\<noteq>a0` `a3\<notin>s` `a0\<in>s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1679
        by (auto simp add:card_insert_if)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1680
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1681
      assume x: "x \<in> insert a3 (s - {a0})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1682
      show "\<forall>j. x j \<le> p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1683
      proof (rule, cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1684
        fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1685
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1686
        then show "x j\<le>p" using x ksimplexD(4)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1687
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1688
        fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1689
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1690
        show "x j\<le>p" unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1691
        proof (cases "j = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1692
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1693
          then show "a3 j \<le>p" unfolding True a3_def
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1694
          using `a1\<in>s` ksimplexD(4)[OF assms(1)] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1695
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1696
          guess a4 using assms(5)[unfolded bex_simps ball_simps,rule_format,OF k(1)] ..
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1697
          note a4 = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1698
          have "a2 k \<le> a4 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1699
            using lem3[OF a4(1)[unfolded `a=a0`],THEN kle_imp_pointwise] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1700
          also have "\<dots> < p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1701
            using ksimplexD(4)[OF assms(1),rule_format,of a4 k] using a4 by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1702
          finally have *:"a0 k + 1 < p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1703
            unfolding k(2)[rule_format] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1704
          case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1705
          then show "a3 j \<le>p" unfolding a3_def unfolding a0a1(5)[rule_format]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1706
            using k(1) k(2)assms(5) using * by simp
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1707
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1708
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1709
      show "\<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1710
      proof (rule, rule, cases "x=a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1711
        fix j :: nat
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1712
        assume j: "j \<notin> {1..n}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1713
        {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1714
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1715
          then show "x j = p" using j x ksimplexD(5)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1716
        }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1717
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1718
        show "x j = p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1719
          unfolding True a3_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1720
          using j k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1721
          using ksimplexD(5)[OF assms(1),rule_format,OF `a1\<in>s` j] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1722
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1723
      fix y
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1724
      assume y: "y \<in> insert a3 (s - {a0})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1725
      have lem4: "\<And>x. x\<in>s \<Longrightarrow> x\<noteq>a0 \<Longrightarrow> kle n x a3"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1726
      proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1727
        case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1728
        guess kk using a0a1(4)[rule_format, OF `x\<in>s`,THEN conjunct2,unfolded kle_def]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1729
          by (elim exE conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1730
        note kk = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1731
        have "k \<notin> kk"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1732
        proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1733
          assume "k \<in> kk"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1734
          then have "a1 k = x k + 1" using kk by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1735
          then have "a0 k = x k" unfolding a0a1(5)[rule_format] using k(1) by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1736
          then have "a2 k = x k + 1" unfolding k(2)[rule_format] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1737
          moreover
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1738
          have "a2 k \<le> x k" using lem3[of x,THEN kle_imp_pointwise] goal1 by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1739
          ultimately show False by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1740
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1741
        then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1742
          unfolding kle_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1743
          apply (rule_tac x="insert k kk" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1744
          using kk(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1745
          unfolding a3_def kle_def kk(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1746
          using k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1747
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1748
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1749
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1750
      show "kle n x y \<or> kle n y x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1751
      proof (cases "y = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1752
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1753
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1754
          unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1755
          apply (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1756
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1757
          apply (rule disjI1, rule lem4)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1758
          using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1759
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1760
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1761
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1762
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1763
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1764
        proof (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1765
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1766
          show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1767
            unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1768
            apply (rule disjI2, rule lem4)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1769
            using y False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1770
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1771
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1772
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1773
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1774
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1775
            apply (rule_tac ksimplexD(6)[OF assms(1),rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1776
            using x y `y \<noteq> a3`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1777
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1778
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1779
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1780
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1781
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1782
    then have "insert a3 (s - {a0}) \<in> ?A"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1783
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1784
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1785
      apply (rule, assumption)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1786
      apply (rule_tac x = "a3" in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1787
      unfolding `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1788
      using `a3 \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1789
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1790
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1791
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1792
    have "s \<in> ?A" using assms(1,2) by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1793
    ultimately have  "?A \<supseteq> {s, insert a3 (s - {a0})}" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1794
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1795
    have "?A \<subseteq> {s, insert a3 (s - {a0})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1796
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1797
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1798
    proof (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1799
      fix s'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1800
      assume as: "ksimplex p n s'" and "\<exists>b\<in>s'. s' - {b} = s - {a}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1801
      from this(2) guess a' .. note a' = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1802
      guess a_min a_max by (rule ksimplex_extrema_strong[OF as assms(3)]) note min_max = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1803
      have *: "\<forall>x\<in>s' - {a'}. x k = a2 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1804
        unfolding a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1805
      proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1806
        fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1807
        assume x: "x \<in> s - {a}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1808
        then have "kle n a2 x"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1809
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1810
          apply (rule lem3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1811
          using `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1812
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1813
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1814
        then have "a2 k \<le> x k"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1815
          apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1816
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1817
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1818
        moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1819
        have "x k \<le> a2 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1820
          unfolding k(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1821
          using a0a1(4)[rule_format,of x, THEN conjunct1]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1822
          unfolding kle_def using x by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1823
        ultimately show "x k = a2 k" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1824
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1825
      have **: "a' = a_min \<or> a' = a_max"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1826
        apply (rule ksimplex_fix_plane[OF a'(1) k(1) *])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1827
        using min_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1828
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1829
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1830
      show "s' \<in> {s, insert a3 (s - {a0})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1831
      proof (cases "a' = a_min")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1832
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1833
        have "a_max = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1834
          unfolding kle_antisym[symmetric,of a_max a1 n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1835
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1836
          apply (rule a0a1(4)[rule_format,THEN conjunct2])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1837
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1838
        proof (rule min_max(4)[rule_format,THEN conjunct2])
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 39302
diff changeset
  1839
          show "a1\<in>s'" using a' unfolding `a=a0` using a0a1 by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1840
          show "a_max \<in> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1841
          proof (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1842
            assume "a_max \<notin> s"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1843
            then have "a_max = a'" using a' min_max by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1844
            then show False unfolding True using min_max by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1845
          qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1846
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1847
        then have "\<forall>i. a_max i = a1 i" by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1848
        then have "a' = a" unfolding True `a = a0`
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1849
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1850
          apply (subst fun_eq_iff, rule)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1851
          apply (erule_tac x=x in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1852
          unfolding a0a1(5)[rule_format] min_max(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1853
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1854
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1855
          then show ?case by (cases "x\<in>{1..n}") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1856
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1857
        then have "s' = s"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1858
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1859
          apply (rule lem1[OF a'(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1860
          using `a\<in>s` `a'\<in>s'`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1861
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1862
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1863
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1864
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1865
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1866
        then have as:"a' = a_max" using ** by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1867
        have "a_min = a2" unfolding kle_antisym[symmetric, of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1868
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1869
          apply (rule min_max(4)[rule_format,THEN conjunct1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1870
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1871
        proof (rule lem3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1872
          show "a_min \<in> s - {a0}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1873
            unfolding a'(2)[symmetric,unfolded `a = a0`]
41958
5abc60a017e0 eliminated hard tabs;
wenzelm
parents: 39302
diff changeset
  1874
            unfolding as using min_max(1-3) by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1875
          have "a2 \<noteq> a"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1876
            unfolding `a = a0` using k(2)[rule_format,of k] by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1877
          then have "a2 \<in> s - {a}"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1878
            using a2 by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1879
          then show "a2 \<in> s'" unfolding a'(2)[symmetric] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1880
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1881
        then have "\<forall>i. a_min i = a2 i" by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1882
        then have "a' = a3"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1883
          unfolding as `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1884
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1885
          apply (subst fun_eq_iff, rule)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1886
          apply (erule_tac x=x in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1887
          unfolding a0a1(5)[rule_format] min_max(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1888
          unfolding a3_def k(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1889
          unfolding a0a1(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1890
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1891
          case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1892
          show ?case
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1893
            unfolding goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1894
            apply (cases "x\<in>{1..n}")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1895
            defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1896
            apply (cases "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1897
            using `k\<in>{1..n}`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1898
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1899
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1900
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1901
        then have "s' = insert a3 (s - {a0})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1902
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1903
          apply (rule lem1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1904
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1905
          apply assumption
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1906
          apply (rule a'(1))
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1907
          unfolding a' `a = a0`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1908
          using `a3 \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1909
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1910
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1911
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1912
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1913
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1914
    ultimately have *: "?A = {s, insert a3 (s - {a0})}" 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
  1915
    have "s \<noteq> insert a3 (s - {a0})" using `a3\<notin>s` by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1916
    then have ?thesis unfolding * by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1917
  }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1918
  moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1919
  {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1920
    assume "a = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1921
    have *: "\<And>P Q. (P \<or> Q) \<Longrightarrow> \<not> P \<Longrightarrow> Q" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1922
    have "\<exists>x\<in>s. \<not> kle n a1 x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1923
      apply (rule_tac x=a0 in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1924
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1925
      assume as: "kle n a1 a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1926
      show False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1927
        using kle_imp_pointwise[OF as,THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1928
        unfolding a0a1(5)[THEN spec[where x=1]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1929
        using assms(3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1930
        by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1931
    qed (insert a0a1, auto)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1932
    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
  1933
      apply (rule_tac *[OF ksimplex_predecessor[OF assms(1-2),unfolded `a=a1`]])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1934
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1935
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1936
    then guess a2 .. from this(2) guess k .. note k=this note a2 = `a2 \<in> s`
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1937
    def a3 \<equiv> "\<lambda>j. if j = k then a0 j - 1 else a0 j"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1938
    have "a2 \<noteq> a1" using k(2)[THEN spec[where x=k]] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1939
    have lem3: "\<And>x. x\<in>(s - {a1}) \<Longrightarrow> kle n x a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1940
    proof (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1941
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1942
      then have as: "x\<in>s" "x\<noteq>a1" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1943
      have "kle n a2 x \<or> kle n x a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1944
        using ksimplexD(6)[OF assms(1)] and as `a2\<in>s` by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1945
      moreover
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1946
      have "kle n x a1" using a0a1(4) as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1947
      ultimately have "x = a2 \<or> x = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1948
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1949
        apply (rule kle_adjacent[OF k(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1950
        using goal1(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1951
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1952
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1953
      then have "x = a2" using as by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1954
      then show False using goal1(2) using kle_refl by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1955
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1956
    have "a0 k \<noteq> 0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1957
    proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1958
      guess a4 using assms(4)[unfolded bex_simps ball_simps,rule_format,OF `k\<in>{1..n}`] ..
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1959
      note a4 = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1960
      have "a4 k \<le> a2 k" using lem3[OF a4(1)[unfolded `a=a1`],THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1961
        by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1962
      moreover have "a4 k > 0" using a4 by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1963
      ultimately have "a2 k > 0" by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1964
      then have "a1 k > 1" unfolding k(2)[rule_format] by simp
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1965
      then show ?thesis unfolding a0a1(5)[rule_format] using k(1) by simp
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1966
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1967
    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
  1968
      unfolding a3_def by simp
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1969
    have "\<not> kle n a0 a3"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1970
      apply (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1971
      unfolding not_not
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1972
      apply (drule kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1973
      unfolding lem4[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1974
      apply (erule_tac x=k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1975
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1976
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1977
    then have "a3 \<notin> s" using a0a1(4) by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1978
    then have "a3 \<noteq> a1" "a3 \<noteq> a0" using a0a1 by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1979
    let ?s = "insert a3 (s - {a1})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1980
    have "ksimplex p n ?s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1981
      apply (rule ksimplexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1982
    proof (rule_tac[2-] ballI,rule_tac[4] ballI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1983
      show "card ?s = n+1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1984
        using ksimplexD(2-3)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1985
        using `a3\<noteq>a0` `a3\<notin>s` `a1\<in>s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1986
        by(auto simp add:card_insert_if)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1987
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1988
      assume x: "x \<in> insert a3 (s - {a1})"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1989
      show "\<forall>j. x j \<le> p" proof(rule,cases "x = a3")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1990
        fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1991
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1992
        then show "x j\<le>p" using x ksimplexD(4)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1993
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1994
        fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1995
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1996
        show "x j\<le>p" unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1997
        proof (cases "j = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1998
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1999
          then show "a3 j \<le>p"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2000
            unfolding True a3_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2001
            using `a0\<in>s` ksimplexD(4)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2002
            by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2003
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2004
          guess a4 using assms(5)[unfolded bex_simps ball_simps,rule_format,OF k(1)] ..
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2005
          note a4 = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2006
          case True have "a3 k \<le> a0 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2007
            unfolding lem4[rule_format] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2008
          also have "\<dots> \<le> p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2009
            using ksimplexD(4)[OF assms(1),rule_format,of a0 k] a0a1 by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2010
          finally show "a3 j \<le> p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2011
            unfolding True by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2012
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2013
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2014
      show "\<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2015
      proof (rule, rule, cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2016
        fix j :: nat
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2017
        assume j: "j \<notin> {1..n}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2018
        {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2019
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2020
          then show "x j = p" using j x ksimplexD(5)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2021
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2022
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2023
          show "x j = p" unfolding True a3_def using j k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2024
            using ksimplexD(5)[OF assms(1),rule_format,OF `a0\<in>s` j] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2025
        }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2026
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2027
      fix y
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2028
      assume y: "y\<in>insert a3 (s - {a1})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2029
      have lem4: "\<And>x. x\<in>s \<Longrightarrow> x \<noteq> a1 \<Longrightarrow> kle n a3 x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2030
      proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2031
        case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2032
        then have *: "x\<in>s - {a1}" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2033
        have "kle n a3 a2"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2034
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2035
          have "kle n a0 a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2036
            using a0a1 by auto then guess kk unfolding kle_def ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2037
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2038
            unfolding kle_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2039
            apply (rule_tac x=kk in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2040
            unfolding lem4[rule_format] k(2)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2041
            apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2042
            defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2043
          proof rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2044
            case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2045
            then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2046
              apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2047
              apply (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2048
              apply (erule_tac[!] x=j in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2049
              apply (cases "j \<in> kk")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2050
              apply (case_tac[!] "j=k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2051
              apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2052
              done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2053
          qed auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2054
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2055
        moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2056
        have "kle n a3 a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2057
          unfolding kle_def lem4[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2058
          apply (rule_tac x="{k}" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2059
          using k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2060
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2061
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2062
        ultimately
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2063
        show ?case
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2064
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2065
          apply (rule kle_between_l[of _ a0 _ a2])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2066
          using lem3[OF *]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2067
          using a0a1(4)[rule_format,OF goal1(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2068
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2069
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2070
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2071
      show "kle n x y \<or> kle n y x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2072
      proof (cases "y = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2073
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2074
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2075
          unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2076
          apply (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2077
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2078
          apply (rule disjI2, rule lem4)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2079
          using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2080
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2081
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2082
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2083
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2084
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2085
        proof (cases "x = a3")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2086
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2087
          show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2088
            unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2089
            apply (rule disjI1, rule lem4)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2090
            using y False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2091
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2092
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2093
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2094
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2095
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2096
            apply (rule_tac ksimplexD(6)[OF assms(1),rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2097
            using x y `y\<noteq>a3`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2098
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2099
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2100
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2101
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2102
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2103
    then have "insert a3 (s - {a1}) \<in> ?A"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2104
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2105
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2106
        apply (rule, assumption)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2107
        apply (rule_tac x = "a3" in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2108
        unfolding `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2109
        using `a3 \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2110
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2111
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2112
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2113
    have "s \<in> ?A" using assms(1,2) by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2114
    ultimately have "?A \<supseteq> {s, insert a3 (s - {a1})}" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2115
    moreover have "?A \<subseteq> {s, insert a3 (s - {a1})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2116
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2117
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2118
    proof (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2119
      fix s'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2120
      assume as: "ksimplex p n s'" and "\<exists>b\<in>s'. s' - {b} = s - {a}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2121
      from this(2) guess a' .. note a' = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2122
      guess a_min a_max by (rule ksimplex_extrema_strong[OF as assms(3)]) note min_max = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2123
      have *: "\<forall>x\<in>s' - {a'}. x k = a2 k" unfolding a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2124
      proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2125
        fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2126
        assume x: "x \<in> s - {a}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2127
        then have "kle n x a2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2128
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2129
          apply (rule lem3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2130
          using `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2131
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2132
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2133
        then have "x k \<le> a2 k"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2134
          apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2135
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2136
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2137
        moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2138
        {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2139
          have "a2 k \<le> a0 k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2140
            using k(2)[rule_format,of k]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2141
            unfolding a0a1(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2142
            using k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2143
            by simp
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2144
          also have "\<dots> \<le> x k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2145
            using a0a1(4)[rule_format,of x,THEN conjunct1,THEN kle_imp_pointwise] x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2146
            by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2147
          finally have "a2 k \<le> x k" .
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2148
        }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2149
        ultimately show "x k = a2 k" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2150
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2151
      have **: "a' = a_min \<or> a' = a_max"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2152
        apply (rule ksimplex_fix_plane[OF a'(1) k(1) *])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2153
        using min_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2154
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2155
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2156
      have "a2 \<noteq> a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2157
      proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2158
        assume as: "a2 = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2159
        show False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2160
          using k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2161
          unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2162
          apply (erule_tac x = k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2163
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2164
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2165
      qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2166
      then have a2': "a2 \<in> s' - {a'}"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2167
        unfolding a'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2168
        using a2
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2169
        unfolding `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2170
        by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2171
      show "s' \<in> {s, insert a3 (s - {a1})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2172
      proof (cases "a' = a_min")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2173
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2174
        have "a_max \<in> s - {a1}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2175
          using min_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2176
          unfolding a'(2)[unfolded `a=a1`,symmetric] True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2177
          by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2178
        then have "a_max = a2"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2179
          unfolding kle_antisym[symmetric,of a_max a2 n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2180
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2181
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2182
          apply (rule lem3,assumption)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2183
          apply (rule min_max(4)[rule_format,THEN conjunct2])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2184
          using a2'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2185
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2186
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2187
        then have a_max:"\<forall>i. a_max i = a2 i" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2188
        have *: "\<forall>j. a2 j = (if j\<in>{1..n} then a3 j + 1 else a3 j)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2189
          using k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2190
          unfolding lem4[rule_format] a0a1(5)[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2191
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2192
          apply (rule,erule_tac x=j in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2193
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2194
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2195
          then show ?case by (cases "j\<in>{1..n}",case_tac[!] "j=k") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2196
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2197
        have "\<forall>i. a_min i = a3 i"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2198
          using a_max
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2199
            apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2200
            apply (rule,erule_tac x=i in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2201
            unfolding min_max(5)[rule_format] *[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2202
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2203
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2204
          then show ?case by (cases "i\<in>{1..n}") auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2205
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2206
        then have "a_min = a3" unfolding fun_eq_iff .
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2207
        then have "s' = insert a3 (s - {a1})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2208
          using a' unfolding `a = a1` True by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2209
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2210
      next
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2211
        case False then have as:"a'=a_max" using ** by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2212
        have "a_min = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2213
          unfolding kle_antisym[symmetric,of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2214
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2215
          apply (rule min_max(4)[rule_format,THEN conjunct1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2216
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2217
          apply (rule a0a1(4)[rule_format,THEN conjunct1])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2218
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2219
          have "a_min \<in> s - {a1}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2220
            using min_max(1,3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2221
            unfolding a'(2)[symmetric,unfolded `a=a1`] as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2222
            by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2223
          then show "a_min \<in> s" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2224
          have "a0 \<in> s - {a1}" using a0a1(1-3) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2225
          then show "a0 \<in> s'" unfolding a'(2)[symmetric,unfolded `a=a1`] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2226
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2227
        then have "\<forall>i. a_max i = a1 i"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2228
          unfolding a0a1(5)[rule_format] min_max(5)[rule_format] by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2229
        then have "s' = s"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2230
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2231
          apply (rule lem1[OF a'(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2232
          using `a \<in> s` `a' \<in> s'`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2233
          unfolding as `a = a1`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2234
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2235
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2236
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2237
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2238
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2239
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2240
    ultimately have *: "?A = {s, insert a3 (s - {a1})}" 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
  2241
    have "s \<noteq> insert a3 (s - {a1})" using `a3\<notin>s` by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2242
    then have ?thesis unfolding * by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2243
  }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2244
  moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2245
  {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2246
    assume as: "a \<noteq> a0" "a \<noteq> a1" have "\<not> (\<forall>x\<in>s. kle n a x)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2247
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2248
      case goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2249
      have "a = a0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2250
        unfolding kle_antisym[symmetric,of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2251
        apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2252
        using goal1 a0a1 assms(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2253
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2254
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2255
      then show False using as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2256
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2257
    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)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2258
      using ksimplex_predecessor[OF assms(1-2)] by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2259
    then guess u .. from this(2) guess k .. note k = this[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2260
    note u = `u \<in> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2261
    have "\<not> (\<forall>x\<in>s. kle n x a)"
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
      have "a = a1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2265
        unfolding kle_antisym[symmetric,of _ _ n]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2266
        apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2267
        using goal1 a0a1 assms(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2268
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2269
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2270
      then show False using as by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2271
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2272
    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
  2273
      using ksimplex_successor[OF assms(1-2)] by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2274
    then guess v .. from this(2) guess l ..
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2275
    note l = this[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2276
    note v = `v\<in>s`
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2277
    def a' \<equiv> "\<lambda>j. if j = l then u j + 1 else u j"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2278
    have kl: "k \<noteq> l"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2279
    proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2280
      assume "k = l"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2281
      have *: "\<And>P. (if P then (1::nat) else 0) \<noteq> 2" by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2282
      then show False using ksimplexD(6)[OF assms(1),rule_format,OF u v] unfolding kle_def
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2283
        unfolding l(2) k(2) `k = l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2284
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2285
        apply (erule disjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2286
        apply (erule_tac[!] exE conjE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2287
        apply (erule_tac[!] x = l in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2288
        apply (auto simp add: *)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2289
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2290
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2291
    then have aa': "a' \<noteq> a"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2292
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2293
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2294
      unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2295
      unfolding a'_def k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2296
      apply (erule_tac x=l in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2297
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2298
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2299
    have "a' \<notin> s"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2300
      apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2301
      apply (drule ksimplexD(6)[OF assms(1),rule_format,OF `a\<in>s`])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2302
    proof (cases "kle n a a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2303
      case goal2
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2304
      then have "kle n a' a" by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2305
      then show False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2306
        apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2307
        apply (erule_tac x=l in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2308
        unfolding a'_def k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2309
        using kl
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2310
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2311
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2312
    next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2313
      case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2314
      then show False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2315
        apply (drule_tac kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2316
        apply (erule_tac x=k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2317
        unfolding a'_def k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2318
        using kl
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2319
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2320
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2321
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2322
    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
  2323
      unfolding kle_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2324
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2325
      apply (rule_tac[1] x="{k}" in exI,rule_tac[2] x="{l}" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2326
      apply (rule_tac[3] x="{l}" in exI,rule_tac[4] x="{k}" in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2327
      unfolding l(2) k(2) a'_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2328
      using l(1) k(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2329
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2330
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2331
    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
  2332
    proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2333
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2334
      then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2335
      proof (cases "x k = u k", case_tac[!] "x l = u l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2336
        assume as: "x l = u l" "x k = u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2337
        have "x = u" unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2338
          using goal1(2)[THEN kle_imp_pointwise,unfolded l(2)] unfolding k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2339
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2340
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2341
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2342
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2343
          apply (erule_tac x=xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2344
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2345
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2346
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2347
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2348
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2349
            using as by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2350
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2351
        then show ?case by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2352
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2353
        assume as: "x l \<noteq> u l" "x k = u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2354
        have "x = a'"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2355
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2356
          unfolding a'_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2357
          using goal1(2)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2358
          unfolding l(2) k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2359
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2360
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2361
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2362
          apply (erule_tac x = xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2363
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2364
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2365
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2366
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2367
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2368
            using as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2369
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2370
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2371
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2372
        then show ?case by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2373
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2374
        assume as: "x l = u l" "x k \<noteq> u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2375
        have "x = a"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2376
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2377
          using goal1(2)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2378
          unfolding l(2) k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2379
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2380
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2381
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2382
          apply (erule_tac x=xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2383
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2384
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2385
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2386
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2387
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2388
            using as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2389
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2390
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2391
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2392
        then show ?case by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2393
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2394
        assume as: "x l \<noteq> u l" "x k \<noteq> u k"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2395
        have "x = v"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2396
          unfolding fun_eq_iff
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2397
          using goal1(2)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2398
          unfolding l(2) k(2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2399
          using goal1(1)[THEN kle_imp_pointwise]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2400
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2401
          apply rule
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2402
          apply (erule_tac x=xa in allE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2403
        proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2404
          case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2405
          then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2406
            apply (cases "x = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2407
            apply (case_tac[!] "x = k")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2408
            using as `k \<noteq> l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2409
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2410
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2411
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2412
        then show ?case by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2413
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2414
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2415
    have uv: "kle n u v"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2416
      apply (rule kle_trans[OF kle_uv(1,3)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2417
      using ksimplexD(6)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2418
      using u v
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2419
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2420
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2421
    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
  2422
      apply (rule kle_between_r[of _ u _ v])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2423
      prefer 3
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2424
      apply (rule kle_trans[OF uv])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2425
      defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2426
      apply (rule ksimplexD(6)[OF assms(1), rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2427
      using kle_uv `u\<in>s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2428
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2429
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2430
    have lem4: "\<And>x. x\<in>s \<Longrightarrow> kle n x u \<Longrightarrow> kle n x a'"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2431
      apply (rule kle_between_l[of _ u _ v])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2432
      prefer 4
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2433
      apply (rule kle_trans[OF _ uv])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2434
      defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2435
      apply (rule ksimplexD(6)[OF assms(1), rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2436
      using kle_uv `v\<in>s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2437
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2438
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2439
    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
  2440
    proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2441
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2442
      then show ?case
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2443
      proof (cases "kle n v x \<or> kle n x u")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2444
        case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2445
        then show ?thesis using goal1 by(auto intro:lem3 lem4)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2446
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2447
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2448
        then have *: "kle n u x" "kle n x v"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2449
          using ksimplexD(6)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2450
          using goal1 `u\<in>s` `v\<in>s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2451
          by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2452
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2453
          using uxv[OF *]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2454
          using kle_uv
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2455
          using goal1
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2456
          by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2457
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2458
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2459
    have "ksimplex p n (insert a' (s - {a}))"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2460
      apply (rule ksimplexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2461
    proof (rule_tac[2-] ballI, rule_tac[4] ballI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2462
      show "card (insert a' (s - {a})) = n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2463
        using ksimplexD(2-3)[OF assms(1)]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2464
        using `a' \<noteq> a` `a' \<notin> s` `a \<in> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2465
        by (auto simp add:card_insert_if)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2466
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2467
      assume x: "x \<in> insert a' (s - {a})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2468
      show "\<forall>j. x j \<le> p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2469
      proof (rule, cases "x = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2470
        fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2471
        case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2472
        then show "x j\<le>p" using x ksimplexD(4)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2473
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2474
        fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2475
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2476
        show "x j\<le>p" unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2477
        proof (cases "j = l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2478
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2479
          then show "a' j \<le>p"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2480
            unfolding True a'_def using `u\<in>s` ksimplexD(4)[OF assms(1)] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2481
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2482
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2483
          have *: "a l = u l" "v l = a l + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2484
            using k(2)[of l] l(2)[of l] `k\<noteq>l` by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2485
          have "u l + 1 \<le> p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2486
            unfolding *[symmetric] using ksimplexD(4)[OF assms(1)] using `v\<in>s` by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2487
          then show "a' j \<le>p" unfolding a'_def True by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2488
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2489
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2490
      show "\<forall>j. j \<notin> {1..n} \<longrightarrow> x j = p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2491
      proof (rule, rule,cases "x = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2492
        fix j :: nat
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2493
        assume j: "j \<notin> {1..n}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2494
        {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2495
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2496
          then show "x j = p" using j x ksimplexD(5)[OF assms(1)] by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2497
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2498
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2499
          show "x j = p"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2500
            unfolding True a'_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2501
            using j l(1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2502
            using ksimplexD(5)[OF assms(1),rule_format,OF `u\<in>s` j]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2503
            by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2504
        }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2505
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2506
      fix y
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2507
      assume y: "y\<in>insert a' (s - {a})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2508
      show "kle n x y \<or> kle n y x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2509
      proof (cases "y = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2510
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2511
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2512
          unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2513
          apply (cases "x = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2514
          defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2515
          apply (rule lem5)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2516
          using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2517
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2518
          done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2519
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2520
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2521
        show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2522
        proof (cases "x = a'")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2523
          case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2524
          show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2525
            unfolding True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2526
            using lem5[of y] using y by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2527
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2528
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2529
          then show ?thesis
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2530
            apply (rule_tac ksimplexD(6)[OF assms(1),rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2531
            using x y `y\<noteq>a'`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2532
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2533
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2534
        qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2535
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2536
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2537
    then have "insert a' (s - {a}) \<in> ?A"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2538
      unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2539
      apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2540
      apply (rule, assumption)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2541
      apply (rule_tac x = "a'" in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2542
      using aa' `a' \<notin> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2543
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2544
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2545
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2546
    have "s \<in> ?A" using assms(1,2) by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2547
    ultimately have  "?A \<supseteq> {s, insert a' (s - {a})}" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2548
    moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2549
    have "?A \<subseteq> {s, insert a' (s - {a})}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2550
      apply rule unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2551
    proof (erule conjE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2552
      fix s'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2553
      assume as: "ksimplex p n s'" and "\<exists>b\<in>s'. s' - {b} = s - {a}"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2554
      from this(2) guess a'' .. note a'' = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2555
      have "u \<noteq> v" unfolding fun_eq_iff unfolding l(2) k(2) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2556
      then have uv': "\<not> kle n v u" using uv using kle_antisym by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2557
      have "u \<noteq> a" "v \<noteq> a" unfolding fun_eq_iff k(2) l(2) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2558
      then have uvs': "u \<in> s'" "v \<in> s'" using `u \<in> s` `v \<in> s` using a'' by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2559
      have lem6: "a \<in> s' \<or> a' \<in> s'"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2560
      proof (cases "\<forall>x\<in>s'. kle n x u \<or> kle n v x")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2561
        case False
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2562
        then guess w unfolding ball_simps .. note w = this
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2563
        then have "kle n u w" "kle n w v"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2564
          using ksimplexD(6)[OF as] uvs' by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2565
        then have "w = a' \<or> w = a"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2566
          using uxv[of w] uvs' w by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2567
        then show ?thesis using w by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2568
      next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2569
        case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2570
        have "\<not> (\<forall>x\<in>s'. kle n x u)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2571
          unfolding ball_simps
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2572
          apply (rule_tac x=v in bexI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2573
          using uv `u \<noteq> v`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2574
          unfolding kle_antisym [of n u v,symmetric]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2575
          using `v\<in>s'`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2576
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2577
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2578
        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)"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2579
          using ksimplex_successor[OF as `u\<in>s'`] by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2580
        then guess w .. note w = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2581
        from this(2) guess kk .. note kk = this[rule_format]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2582
        have "\<not> kle n w u"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2583
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2584
          apply (rule, drule kle_imp_pointwise)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2585
          apply (erule_tac x = kk in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2586
          unfolding kk
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2587
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2588
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2589
        then have *: "kle n v w"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2590
          using True[rule_format,OF w(1)] by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2591
        then have False
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2592
        proof (cases "kk \<noteq> l")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2593
          case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2594
          then show False using *[THEN kle_imp_pointwise, unfolded l(2) kk k(2)]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2595
            apply (erule_tac x=l in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2596
            using `k \<noteq> l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2597
            apply auto  
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2598
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2599
        next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2600
          case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2601
          then have "kk \<noteq> k" using `k \<noteq> l` by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2602
          then show False using *[THEN kle_imp_pointwise, unfolded l(2) kk k(2)]
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2603
            apply (erule_tac x=k in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2604
            using `k \<noteq> l`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2605
            apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2606
            done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2607
        qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2608
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2609
      qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2610
      then show "s' \<in> {s, insert a' (s - {a})}" proof(cases "a\<in>s'")
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2611
        case True
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2612
        then have "s' = s"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2613
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2614
          apply (rule lem1[OF a''(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2615
          using a'' `a \<in> s`
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2616
          apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2617
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2618
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2619
      next
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2620
        case False then have "a'\<in>s'" using lem6 by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2621
        then have "s' = insert a' (s - {a})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2622
          apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2623
          apply (rule lem1[of _ a'' _ a'])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2624
          unfolding a''(2)[symmetric] using a'' and `a'\<notin>s` by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2625
        then show ?thesis by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2626
      qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2627
    qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2628
    ultimately have *: "?A = {s, insert a' (s - {a})}" 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
  2629
    have "s \<noteq> insert a' (s - {a})" using `a'\<notin>s` by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2630
    then have ?thesis unfolding * by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2631
  }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2632
  ultimately show ?thesis by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2633
qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2634
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2635
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2636
subsection {* Hence another step towards concreteness. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2637
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2638
lemma kuhn_simplex_lemma:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2639
  assumes "\<forall>s. ksimplex p (n + 1) s \<longrightarrow> (rl ` s \<subseteq>{0..n+1})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2640
    "odd (card{f. \<exists>s a. ksimplex p (n + 1) s \<and> a \<in> s \<and> (f = s - {a}) \<and>
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2641
    (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))})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2642
  shows "odd(card {s\<in>{s. ksimplex p (n + 1) s}. rl ` s = {0..n+1} })"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2643
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2644
  have *: "\<And>x y. x = y \<Longrightarrow> odd (card x) \<Longrightarrow> odd (card y)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2645
    by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2646
  have *: "odd(card {f\<in>{f. \<exists>s\<in>{s. ksimplex p (n + 1) s}. (\<exists>a\<in>s. f = s - {a})}.
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2647
    (rl ` f = {0..n}) \<and>
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2648
     ((\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = 0) \<or>
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2649
      (\<exists>j\<in>{1..n+1}. \<forall>x\<in>f. x j = p))})"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2650
    apply (rule *[OF _ assms(2)])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2651
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2652
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2653
  show ?thesis
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2654
    apply (rule kuhn_complete_lemma[OF finite_simplices])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2655
    prefer 6
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2656
    apply (rule *)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2657
    apply (rule, rule, rule)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2658
    apply (subst ksimplex_def)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2659
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2660
    apply (rule, rule assms(1)[rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2661
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2662
    apply assumption
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2663
    apply default+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2664
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2665
    apply (erule disjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2666
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2667
    apply (erule disjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2668
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2669
    apply default+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2670
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2671
    apply (erule disjE bexE)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2672
    unfolding mem_Collect_eq
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2673
  proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2674
    fix f s a
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2675
    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
  2676
    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
  2677
    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
  2678
      unfolding as by blast
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2679
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2680
      fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2681
      assume j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2682
      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
  2683
        unfolding S
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2684
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2685
        apply (rule ksimplex_replace_0)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2686
        apply (rule as)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2687
        unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2688
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2689
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2690
    }
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2691
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2692
      fix j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2693
      assume j: "j \<in> {1..n + 1}" "\<forall>x\<in>f. x j = p"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2694
      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
  2695
        unfolding S
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2696
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2697
        apply (rule ksimplex_replace_1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2698
        apply (rule as)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2699
        unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2700
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2701
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2702
    }
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2703
    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
  2704
      unfolding S
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2705
      apply (rule ksimplex_replace_2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2706
      apply (rule as)+
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2707
      unfolding as
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2708
      apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2709
      done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2710
  qed auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2711
qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2712
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2713
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2714
subsection {* Reduced labelling. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2715
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2716
definition "reduced label (n::nat) (x::nat\<Rightarrow>nat) =
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2717
  (SOME k. k \<le> n \<and> (\<forall>i. 1\<le>i \<and> i<k+1 \<longrightarrow> label x i = 0) \<and>
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2718
    (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
  2719
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2720
lemma reduced_labelling:
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2721
  shows "reduced label n x \<le> n" (is ?t1)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2722
    and "\<forall>i. 1\<le>i \<and> i < reduced label n x + 1 \<longrightarrow> (label x i = 0)" (is ?t2)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2723
    and "(reduced label n x = n) \<or> (label x (reduced label n x + 1) \<noteq> 0)"  (is ?t3)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2724
proof -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2725
  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
  2726
    apply (drule ex_has_least_nat[where m="\<lambda>x. x"])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2727
    apply (erule exE,rule_tac x=x in exI)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2728
    apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2729
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2730
  have *: "n \<le> n \<and> (label x (n + 1) \<noteq> 0 \<or> n = n)" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2731
  then guess N
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2732
    apply (drule_tac num_WOP[of "\<lambda>j. j\<le>n \<and> (label x (j+1) \<noteq> 0 \<or> n = j)"])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2733
    apply (erule exE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2734
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2735
  note N = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2736
  have N': "N \<le> n"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2737
    "\<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
  2738
    defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2739
  proof (rule, rule)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2740
    fix i
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2741
    assume i: "1\<le>i \<and> i<N+1"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2742
    then show "label x i = 0"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2743
      using N[THEN conjunct2,THEN spec[where x="i - 1"]]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2744
      using N by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2745
  qed (insert N, auto)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2746
  show ?t1 ?t2 ?t3
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2747
    unfolding reduced_def
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2748
    apply (rule_tac[!] someI2_ex)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2749
    using N'
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2750
    apply (auto intro!: exI[where x=N])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2751
    done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2752
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2753
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2754
lemma reduced_labelling_unique:
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2755
  fixes x :: "nat \<Rightarrow> nat"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2756
  assumes "r \<le> n"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2757
    "\<forall>i. 1 \<le> i \<and> i < r + 1 \<longrightarrow> (label x i = 0)" "(r = n) \<or> (label x (r + 1) \<noteq> 0)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2758
  shows "reduced label n x = r"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2759
  apply (rule le_antisym)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2760
  apply (rule_tac[!] ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2761
  unfolding not_le
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2762
  using reduced_labelling[of label n x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2763
  using assms
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2764
  apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2765
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2766
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2767
lemma reduced_labelling_zero:
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2768
  assumes "j\<in>{1..n}" "label x j = 0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2769
  shows "reduced label n x \<noteq> j - 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2770
  using reduced_labelling[of label n x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2771
  using assms 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
  2772
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2773
lemma reduced_labelling_nonzero:
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2774
  assumes "j\<in>{1..n}" "label x j \<noteq> 0"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2775
  shows "reduced label n x < j"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2776
  using assms and reduced_labelling[of label n x]
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2777
  apply (erule_tac x=j in allE)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2778
  apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2779
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2780
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2781
lemma reduced_labelling_Suc:
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2782
  assumes "reduced lab (n + 1) x \<noteq> n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2783
  shows "reduced lab (n + 1) x = reduced lab n x"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2784
  apply (subst eq_commute)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2785
  apply (rule reduced_labelling_unique)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2786
  using reduced_labelling[of lab "n+1" x] and assms
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2787
  apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2788
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2789
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2790
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
  2791
  assumes "\<forall>x\<in>f. \<forall>j\<in>{1..n+1}. x j = 0 \<longrightarrow> lab x j = 0"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2792
          "\<forall>x\<in>f. \<forall>j\<in>{1..n+1}. x j = p \<longrightarrow> lab x j = 1"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2793
  shows "((reduced lab (n + 1)) ` 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)) \<longleftrightarrow>
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2794
  ((reduced lab (n + 1)) ` f = {0..n}) \<and> (\<forall>x\<in>f. x (n + 1) = p)" (is "?l = ?r")
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2795
proof
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2796
  assume ?l (is "?as \<and> (?a \<or> ?b)")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2797
  then show ?r
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2798
    apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2799
    apply (rule, erule conjE, assumption)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2800
  proof (cases ?a)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2801
    case True
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2802
    then guess j .. note j = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2803
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2804
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2805
      assume x: "x \<in> f"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2806
      have "reduced lab (n + 1) x \<noteq> j - 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2807
        using j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2808
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2809
        apply (rule reduced_labelling_zero)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2810
        defer
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2811
        apply (rule assms(1)[rule_format])
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2812
        using x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2813
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2814
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2815
    }
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2816
    moreover have "j - 1 \<in> {0..n}" using j by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2817
    then guess y unfolding `?l`[THEN conjunct1,symmetric] and image_iff .. note y = this
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2818
    ultimately have False by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2819
    then show "\<forall>x\<in>f. x (n + 1) = p" by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2820
  next
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2821
    case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2822
    then have ?b using `?l` by blast
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2823
    then guess j .. note j = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2824
    {
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2825
      fix x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2826
      assume x: "x \<in> f"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2827
      have "reduced lab (n + 1) x < j"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2828
        using j
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2829
        apply -
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2830
        apply (rule reduced_labelling_nonzero)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2831
        using assms(2)[rule_format,of x j] and x
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2832
        apply auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2833
        done
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2834
    } note * = this
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2835
    have "j = n + 1"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2836
    proof (rule ccontr)
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2837
      case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2838
      then have "j < n + 1" using j by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2839
      moreover
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2840
      have "n \<in> {0..n}" by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2841
      then guess y unfolding `?l`[THEN conjunct1,symmetric] image_iff ..
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2842
      ultimately show False using *[of y] by auto
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2843
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2844
    then show "\<forall>x\<in>f. x (n + 1) = p" using j by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2845
  qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  2846
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
  2847
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2848
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2849
subsection {* Hence we get just about the nice induction. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2850
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2851
lemma kuhn_induction:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2852
  assumes "0 < p" "\<forall>x. \<forall>j\<in>{1..n+1}. (\<forall>j. x j \<le> p) \<and> (x j = 0) \<longrightarrow> (lab x j = 0)"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2853
    "\<forall>x. \<forall>j\<in>{1..n+1}. (\<forall>j. x j \<le> p) \<and> (x j = p) \<longrightarrow> (lab x j = 1)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2854
    "odd (card {f. ksimplex p n f \<and> ((reduced lab n) ` f = {0..n})})"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2855
  shows "odd (card {s. ksimplex p (n+1) s \<and>((reduced lab (n+1)) `  s = {0..n+1})})"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2856
proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2857
  have *: "\<And>s t. odd (card s) \<Longrightarrow> s = t \<Longrightarrow> odd (card t)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2858
    "\<And>s f. (\<And>x. f x \<le> n +1 ) \<Longrightarrow> f ` s \<subseteq> {0..n+1}" by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2859
  show ?thesis
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2860
    apply (rule kuhn_simplex_lemma[unfolded mem_Collect_eq])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2861
    apply (rule, rule, rule *, rule reduced_labelling)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2862
    apply (rule *(1)[OF assms(4)])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2863
    apply (rule set_eqI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2864
    unfolding mem_Collect_eq
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2865
    apply (rule, erule conjE)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2866
    defer
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2867
    apply rule
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2868
  proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2869
    fix f
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2870
    assume as: "ksimplex p n f" "reduced lab n ` f = {0..n}"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2871
    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
  2872
      "\<forall>x\<in>f. \<forall>j\<in>{1..n + 1}. x j = p \<longrightarrow> lab x j = 1"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2873
      using assms(2-3) using as(1)[unfolded ksimplex_def] by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2874
    have allp: "\<forall>x\<in>f. x (n + 1) = p"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2875
      using assms(2) using as(1)[unfolded ksimplex_def] by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2876
    {
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2877
      fix x
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2878
      assume "x \<in> f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2879
      then have "reduced lab (n + 1) x < n + 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2880
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2881
        apply (rule reduced_labelling_nonzero)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2882
        defer using assms(3) using as(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2883
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2884
        done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2885
      then have "reduced lab (n + 1) x = reduced lab n x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2886
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2887
        apply (rule reduced_labelling_Suc)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2888
        using reduced_labelling(1)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2889
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2890
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2891
    }
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2892
    then have "reduced lab (n + 1) ` f = {0..n}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2893
      unfolding as(2)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2894
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2895
      apply (rule set_eqI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2896
      unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2897
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2898
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2899
    moreover guess s using as(1)[unfolded simplex_top_face[OF assms(1) allp,symmetric]] ..
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2900
    then guess a ..
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2901
    ultimately show "\<exists>s a. ksimplex p (n + 1) s \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2902
      a \<in> s \<and> f = s - {a} \<and> reduced lab (n + 1) ` 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))" (is ?ex)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2903
      apply (rule_tac x = s in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2904
      apply (rule_tac x = a in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2905
      unfolding complete_face_top[OF *]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2906
      using allp as(1)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2907
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2908
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2909
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2910
    fix f
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2911
    assume as: "\<exists>s a. ksimplex p (n + 1) s \<and>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2912
      a \<in> s \<and> f = s - {a} \<and> reduced lab (n + 1) ` 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))" (is ?ex)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2913
    then guess s ..
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2914
    then guess a
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2915
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2916
      apply (erule exE,(erule conjE)+)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2917
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2918
    note sa = this
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2919
    {
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2920
      fix x
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2921
      assume "x \<in> f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2922
      then have "reduced lab (n + 1) x \<in> reduced lab (n + 1) ` f"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2923
        by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2924
      then have "reduced lab (n + 1) x < n + 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2925
        using sa(4) by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2926
      then have "reduced lab (n + 1) x = reduced lab n x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2927
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2928
        apply (rule reduced_labelling_Suc)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2929
        using reduced_labelling(1)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2930
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2931
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2932
    }
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2933
    then show part1: "reduced lab n ` f = {0..n}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2934
      unfolding sa(4)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2935
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2936
      apply (rule set_eqI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2937
      unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2938
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2939
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2940
    have *: "\<forall>x\<in>f. x (n + 1) = p"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2941
    proof (cases "\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = 0")
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2942
      case True
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2943
      then guess j ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2944
      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
  2945
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2946
        apply (rule reduced_labelling_zero)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2947
        apply assumption
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2948
        apply (rule assms(2)[rule_format])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2949
        using sa(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2950
        unfolding sa
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2951
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2952
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2953
      moreover
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2954
      have "j - 1 \<in> {0..n}" using `j\<in>{1..n+1}` by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2955
      ultimately have False
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2956
        unfolding sa(4)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2957
        unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2958
        by fastforce
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2959
      then show ?thesis by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2960
    next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2961
      case False
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2962
      then have "\<exists>j\<in>{1..n + 1}. \<forall>x\<in>f. x j = p"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2963
        using sa(5) by fastforce then guess j .. note j=this
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2964
      then show ?thesis
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2965
      proof (cases "j = n + 1")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2966
        case False then have *: "j \<in> {1..n}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2967
          using j by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2968
        then have "\<And>x. x \<in> f \<Longrightarrow> reduced lab n x < j"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2969
          apply (rule reduced_labelling_nonzero)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2970
        proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2971
          fix x
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2972
          assume "x \<in> f"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2973
          then have "lab x j = 1"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2974
            apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2975
            apply (rule assms(3)[rule_format,OF j(1)])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2976
            using sa(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2977
            using j
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2978
            unfolding sa
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2979
            apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2980
            done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2981
          then show "lab x j \<noteq> 0" by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2982
        qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2983
        moreover have "j \<in> {0..n}" using * by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2984
        ultimately have False
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2985
          unfolding part1[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2986
          using * unfolding image_iff
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2987
          by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2988
        then show ?thesis by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2989
      qed auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2990
    qed
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2991
    then show "ksimplex p n f"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2992
      using as unfolding simplex_top_face[OF assms(1) *,symmetric] by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2993
  qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2994
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2995
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2996
lemma kuhn_induction_Suc:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2997
  assumes "0 < p" "\<forall>x. \<forall>j\<in>{1..Suc n}. (\<forall>j. x j \<le> p) \<and> (x j = 0) \<longrightarrow> (lab x j = 0)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2998
                  "\<forall>x. \<forall>j\<in>{1..Suc n}. (\<forall>j. x j \<le> p) \<and> (x j = p) \<longrightarrow> (lab x j = 1)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2999
        "odd (card {f. ksimplex p n f \<and> ((reduced lab n) ` f = {0..n})})"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3000
  shows "odd (card {s. ksimplex p (Suc n) s \<and>((reduced lab (Suc n)) `  s = {0..Suc n})})"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3001
  using assms unfolding Suc_eq_plus1 by(rule kuhn_induction)
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3002
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3003
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3004
subsection {* And so we get the final combinatorial result. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3005
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3006
lemma ksimplex_0: "ksimplex p 0 s \<longleftrightarrow> s = {(\<lambda>x. p)}" (is "?l = ?r")
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3007
proof
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3008
  assume l: ?l
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3009
  guess a using ksimplexD(3)[OF l, unfolded add_0] unfolding card_1_exists .. note a = this
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3010
  have "a = (\<lambda>x. p)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3011
    using ksimplexD(5)[OF l, rule_format, OF a(1)] by rule auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3012
  then show ?r using a by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3013
next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3014
  assume r: ?r
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3015
  show ?l unfolding r ksimplex_eq by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3016
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3017
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3018
lemma reduce_labelling_zero[simp]: "reduced lab 0 x = 0"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3019
  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
  3020
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3021
lemma kuhn_combinatorial:
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3022
  assumes "0 < p" "\<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)"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3023
    "\<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)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3024
  shows " odd (card {s. ksimplex p n s \<and> ((reduced lab n) ` s = {0..n})})"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3025
  using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3026
proof (induct n)
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3027
  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
  3028
  {
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3029
    case 0
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3030
    have *: "?M 0 = {{(\<lambda>x. p)}}"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3031
      unfolding ksimplex_0 by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3032
    show ?case unfolding * by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3033
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3034
    case (Suc n)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3035
    have "odd (card (?M n))"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3036
      apply (rule Suc(1)[OF Suc(2)])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3037
      using Suc(3-)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3038
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3039
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3040
    then show ?case
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3041
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3042
      apply (rule kuhn_induction_Suc)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3043
      using Suc(2-)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3044
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3045
      done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3046
  }
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3047
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3048
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3049
lemma kuhn_lemma:
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3050
  assumes "0 < (p::nat)" "0 < (n::nat)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3051
    "\<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))"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3052
    "\<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))"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3053
    "\<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
  3054
  obtains q where "\<forall>i\<in>{1..n}. q i < p"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3055
    "\<forall>i\<in>{1..n}. \<exists>r s. (\<forall>j\<in>{1..n}. q(j) \<le> r(j) \<and> r(j) \<le> q(j) + 1) \<and>
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3056
                                 (\<forall>j\<in>{1..n}. q(j) \<le> s(j) \<and> s(j) \<le> q(j) + 1) \<and>
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3057
                                 ~(label r i = label s i)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3058
proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3059
  let ?A = "{s. ksimplex p n s \<and> reduced label n ` s = {0..n}}"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3060
  have "n \<noteq> 0" using assms by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3061
  have conjD:"\<And>P Q. P \<and> Q \<Longrightarrow> P" "\<And>P Q. P \<and> Q \<Longrightarrow> Q"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3062
    by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3063
  have "odd (card ?A)"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3064
    apply (rule kuhn_combinatorial[of p n label])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3065
    using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3066
    apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3067
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3068
  then have "card ?A \<noteq> 0"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3069
    apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3070
    apply (rule ccontr)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3071
    apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3072
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3073
  then have "?A \<noteq> {}" unfolding card_eq_0_iff by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3074
  then obtain s where "s \<in> ?A"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3075
    by auto note s=conjD[OF this[unfolded mem_Collect_eq]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3076
  guess a b by (rule ksimplex_extrema_strong[OF s(1) `n\<noteq>0`]) note ab = this
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3077
  show ?thesis
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3078
    apply (rule that[of a])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3079
    apply (rule_tac[!] ballI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3080
  proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3081
    fix i
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3082
    assume "i\<in>{1..n}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3083
    then have "a i + 1 \<le> p"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3084
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3085
      apply (rule order_trans[of _ "b i"])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3086
      apply (subst ab(5)[THEN spec[where x=i]])
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3087
      using s(1)[unfolded ksimplex_def]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3088
      defer
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3089
      apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3090
      apply (erule conjE)+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3091
      apply (drule_tac bspec[OF _ ab(2)])+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3092
      apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3093
      done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3094
    then show "a i < p" by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3095
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3096
    case goal2
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3097
    then have "i \<in> reduced label n ` s" using s by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3098
    then guess u unfolding image_iff .. note u = this
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3099
    from goal2 have "i - 1 \<in> reduced label n ` s"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3100
      using s by auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3101
    then guess v unfolding image_iff .. note v = this
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3102
    show ?case
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3103
      apply (rule_tac x = u in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3104
      apply (rule_tac x = v in exI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3105
      apply (rule conjI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3106
      defer
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3107
      apply (rule conjI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3108
      defer 2
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3109
      apply (rule_tac[1-2] ballI)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3110
    proof -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3111
      show "label u i \<noteq> label v i"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3112
        using reduced_labelling [of label n u] reduced_labelling [of label n v]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3113
        unfolding u(2)[symmetric] v(2)[symmetric]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3114
        using goal2
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3115
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3116
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3117
      fix j
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3118
      assume j: "j \<in> {1..n}"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3119
      show "a j \<le> u j \<and> u j \<le> a j + 1" "a j \<le> v j \<and> v j \<le> a j + 1"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3120
        using conjD[OF ab(4)[rule_format, OF u(1)]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3121
          and conjD[OF ab(4)[rule_format, OF v(1)]]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3122
        apply -
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3123
        apply (drule_tac[!] kle_imp_pointwise)+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3124
        apply (erule_tac[!] x=j in allE)+
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3125
        unfolding ab(5)[rule_format]
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3126
        using j
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3127
        apply auto
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3128
        done
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3129
    qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3130
  qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3131
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3132
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3133
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3134
subsection {* The main result for 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
  3135
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3136
lemma kuhn_labelling_lemma':
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3137
  assumes "(\<forall>x::nat\<Rightarrow>real. P x \<longrightarrow> P (f x))"  "\<forall>x. P x \<longrightarrow> (\<forall>i::nat. Q i \<longrightarrow> 0 \<le> x i \<and> x i \<le> 1)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3138
  shows "\<exists>l. (\<forall>x i. l x i \<le> (1::nat)) \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3139
             (\<forall>x i. P x \<and> Q i \<and> (x i = 0) \<longrightarrow> (l x i = 0)) \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3140
             (\<forall>x i. P x \<and> Q i \<and> (x i = 1) \<longrightarrow> (l x i = 1)) \<and>
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3141
             (\<forall>x i. P x \<and> Q i \<and> (l x i = 0) \<longrightarrow> x i \<le> f(x) i) \<and>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3142
             (\<forall>x i. P x \<and> Q i \<and> (l x i = 1) \<longrightarrow> f(x) i \<le> x i)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3143
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3144
  have and_forall_thm: "\<And>P Q. (\<forall>x. P x) \<and> (\<forall>x. Q x) \<longleftrightarrow> (\<forall>x. P x \<and> Q x)" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3145
  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)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3146
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3147
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3148
    unfolding and_forall_thm
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3149
    apply (subst choice_iff[symmetric])+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3150
  proof (rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3151
    case goal1
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3152
    let ?R = "\<lambda>y. (P x \<and> Q xa \<and> x xa = 0 \<longrightarrow> y = (0::nat)) \<and>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3153
      (P x \<and> Q xa \<and> x xa = 1 \<longrightarrow> y = 1) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3154
      (P x \<and> Q xa \<and> y = 0 \<longrightarrow> x xa \<le> (f x) xa) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3155
      (P x \<and> Q xa \<and> y = 1 \<longrightarrow> (f x) xa \<le> x xa)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3156
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3157
      assume "P x" "Q xa"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3158
      then have "0 \<le> (f x) xa \<and> (f x) xa \<le> 1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3159
        using assms(2)[rule_format,of "f x" xa]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3160
        apply (drule_tac assms(1)[rule_format])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3161
        apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3162
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3163
    }
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3164
    then have "?R 0 \<or> ?R 1" by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3165
    then show ?case by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3166
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3167
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3168
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
  3169
lemma brouwer_cube:
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3170
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'a::ordered_euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3171
  assumes "continuous_on {0..(\<Sum>Basis)} f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3172
    and "f ` {0..(\<Sum>Basis)} \<subseteq> {0..(\<Sum>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
  3173
  shows "\<exists>x\<in>{0..(\<Sum>Basis)}. f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3174
proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3175
  def n \<equiv> "DIM('a)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3176
  have n: "1 \<le> n" "0 < n" "n \<noteq> 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3177
    unfolding n_def by (auto simp add: Suc_le_eq DIM_positive)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3178
  assume "\<not> ?thesis"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3179
  then have *: "\<not> (\<exists>x\<in>{0..\<Sum>Basis}. f x - x = 0)"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3180
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3181
  guess d
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3182
    apply (rule brouwer_compactness_lemma[OF compact_interval _ *])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3183
    apply (rule continuous_on_intros assms)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3184
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3185
  note d = this [rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3186
  have *: "\<forall>x. x \<in> {0..\<Sum>Basis} \<longrightarrow> f x \<in> {0..\<Sum>Basis}"  "\<forall>x. x \<in> {0..(\<Sum>Basis)::'a} \<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
  3187
    (\<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
  3188
    using assms(2)[unfolded image_subset_iff Ball_def]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3189
    unfolding mem_interval by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3190
  guess label using kuhn_labelling_lemma[OF *] by (elim exE conjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3191
  note label = this [rule_format]
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3192
  have lem1: "\<forall>x\<in>{0..\<Sum>Basis}.\<forall>y\<in>{0..\<Sum>Basis}.\<forall>i\<in>Basis. label x i \<noteq> label y i \<longrightarrow>
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3193
    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
  3194
  proof safe
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3195
    fix x y :: 'a
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3196
    assume x: "x\<in>{0..\<Sum>Basis}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3197
    assume y: "y\<in>{0..\<Sum>Basis}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3198
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3199
    assume i: "label x i \<noteq> label y i" "i \<in> Basis"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3200
    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
  3201
      abs (fx - x) \<le> abs (fy - fx) + abs (y - x)" 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
  3202
    have "\<bar>(f x - x) \<bullet> i\<bar> \<le> abs((f y - f x)\<bullet>i) + abs((y - x)\<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
  3203
      unfolding inner_simps
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3204
      apply (rule *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3205
      apply (cases "label x i = 0")
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3206
      apply (rule disjI1, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3207
      prefer 3
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3208
    proof (rule disjI2, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3209
      assume lx: "label x i = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3210
      then have ly: "label y i = 1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3211
        using i label(1)[of i y] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3212
      show "x \<bullet> i \<le> f x \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3213
        apply (rule label(4)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3214
        using x y lx i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3215
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3216
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3217
      show "f y \<bullet> i \<le> y \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3218
        apply (rule label(5)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3219
        using x y ly i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3220
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3221
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3222
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3223
      assume "label x i \<noteq> 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3224
      then have l:"label x i = 1" "label y i = 0"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  3225
        using i label(1)[of i x] label(1)[of i y] by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3226
      show "f x \<bullet> i \<le> x \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3227
        apply (rule label(5)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3228
        using x y l i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3229
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3230
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3231
      show "y \<bullet> i \<le> f y \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3232
        apply (rule label(4)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3233
        using x y l i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3234
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3235
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3236
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3237
    also have "\<dots> \<le> norm (f y - f x) + norm (y - x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3238
      apply (rule add_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3239
      apply (rule Basis_le_norm[OF i(2)])+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3240
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3241
    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
  3242
      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
  3243
  qed
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3244
  have "\<exists>e>0. \<forall>x\<in>{0..\<Sum>Basis}. \<forall>y\<in>{0..\<Sum>Basis}. \<forall>z\<in>{0..\<Sum>Basis}. \<forall>i\<in>Basis.
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3245
    norm(x - z) < e \<and> norm(y - z) < e \<and> label x i \<noteq> label y i \<longrightarrow> abs((f(z) - z)\<bullet>i) < d / (real n)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3246
  proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3247
    have d':"d / real n / 8 > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3248
      apply (rule divide_pos_pos)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3249
      using d(1) unfolding n_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3250
      apply (auto simp:  DIM_positive)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3251
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3252
    have *: "uniformly_continuous_on {0..\<Sum>Basis} f"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3253
      by (rule compact_uniformly_continuous[OF assms(1) compact_interval])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3254
    guess e using *[unfolded uniformly_continuous_on_def,rule_format,OF d'] by (elim exE conjE)
36587
534418d8d494 remove redundant lemma vector_dist_norm
huffman
parents: 36432
diff changeset
  3255
    note e=this[rule_format,unfolded dist_norm]
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3256
    show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3257
      apply (rule_tac x="min (e/2) (d/real n/8)" in exI)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3258
      apply safe
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3259
    proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3260
      show "0 < min (e / 2) (d / real n / 8)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3261
        using d' e by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3262
      fix x y z i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3263
      assume as: "x \<in> {0..\<Sum>Basis}" "y \<in> {0..\<Sum>Basis}" "z \<in> {0..\<Sum>Basis}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  3264
        "norm (x - z) < min (e / 2) (d / real n / 8)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3265
        "norm (y - z) < min (e / 2) (d / real n / 8)" "label x i \<noteq> label y i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3266
        and i: "i \<in> Basis"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3267
      have *: "\<And>z fz x fx n1 n2 n3 n4 d4 d :: real. abs(fx - x) \<le> n1 + n2 \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3268
        abs(fx - fz) \<le> n3 \<Longrightarrow> abs(x - z) \<le> n4 \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3269
        n1 < d4 \<Longrightarrow> n2 < 2 * d4 \<Longrightarrow> n3 < d4 \<Longrightarrow> n4 < d4 \<Longrightarrow>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3270
        (8 * d4 = d) \<Longrightarrow> abs(fz - z) < d" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3271
      show "\<bar>(f z - z) \<bullet> i\<bar> < d / real n" unfolding inner_simps
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3272
      proof (rule *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3273
        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
  3274
          apply (rule lem1[rule_format])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3275
          using as i apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3276
          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
  3277
        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)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3278
          unfolding inner_diff_left[symmetric] by(rule Basis_le_norm[OF i])+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3279
        have tria:"norm (y - x) \<le> norm (y - z) + norm (x - z)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3280
          using dist_triangle[of y x z, unfolded dist_norm]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3281
          unfolding norm_minus_commute by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3282
        also have "\<dots> < e / 2 + e / 2"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3283
          apply (rule add_strict_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3284
          using as(4,5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3285
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3286
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3287
        finally show "norm (f y - f x) < d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3288
          apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3289
          apply (rule e(2))
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3290
          using as
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3291
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3292
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3293
        have "norm (y - z) + norm (x - z) < d / real n / 8 + d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3294
          apply (rule add_strict_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3295
          using as
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3296
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3297
          done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3298
        then show "norm (y - x) < 2 * (d / real n / 8)" using tria by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3299
        show "norm (f x - f z) < d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3300
          apply (rule e(2))
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3301
          using as e(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3302
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3303
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3304
      qed (insert as, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3305
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3306
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3307
  then guess e by (elim exE conjE) note e=this[rule_format]
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3308
  guess p using real_arch_simple[of "1 + real n / e"] .. note p=this
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3309
  have "1 + real n / e > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3310
    apply (rule add_pos_pos)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3311
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3312
    apply (rule divide_pos_pos)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3313
    using e(1) n
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3314
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3315
    done
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3316
  then have "p > 0" 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
  3317
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3318
  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
  3319
    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
  3320
  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
  3321
  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
  3322
    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
  3323
  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
  3324
    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
  3325
  have bb'[simp]:"\<And>i. i \<in> Basis \<Longrightarrow> b (b' i) = 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
  3326
    unfolding b'_def using b by (auto simp: f_inv_into_f bij_betw_def)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3327
  have b'b[simp]:"\<And>i. i \<in> {1..n} \<Longrightarrow> b' (b i) = 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
  3328
    unfolding b'_def using b by (auto simp: inv_into_f_eq bij_betw_def)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3329
  have *: "\<And>x :: nat. x=0 \<or> x=1 \<longleftrightarrow> x\<le>1" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3330
  have b'': "\<And>j. j \<in> {Suc 0..n} \<Longrightarrow> b j \<in> Basis"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3331
    using b unfolding bij_betw_def by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3332
  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
  3333
    (\<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
  3334
                (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3335
    unfolding * using `p>0` `n>0` using label(1)[OF b''] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3336
  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
  3337
      (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
  3338
    "\<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
  3339
      (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3340
    apply (rule, rule, rule, 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
  3341
    defer
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3342
  proof (rule, rule, rule, rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3343
    fix x i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3344
    assume as: "\<forall>i\<in>{1..n}. x i \<le> p" "i \<in> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3345
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3346
      assume "x i = p \<or> x i = 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
  3347
      have "(\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<in> {0::'a..\<Sum>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
  3348
        unfolding mem_interval using as b'_Basis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3349
        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
  3350
    }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3351
    note cube = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3352
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3353
      assume "x i = p"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3354
      then show "(label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1"
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
  3355
        unfolding o_def using cube as `p>0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3356
        by (intro label(3)) (auto simp add: b'')
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3357
    }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3358
    {
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3359
      assume "x i = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3360
      then show "(label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 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
  3361
        unfolding o_def using cube as `p>0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3362
        by (intro label(2)) (auto simp add: b'')
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3363
    }
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  3364
  qed
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3365
  guess q by (rule kuhn_lemma[OF q1 q2]) note q = this
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
  3366
  def z \<equiv> "(\<Sum>i\<in>Basis. (real (q (b' i)) / real p) *\<^sub>R i)::'a"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3367
  have "\<exists>i\<in>Basis. d / real n \<le> abs((f z - z)\<bullet>i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3368
  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
  3369
    have "\<forall>i\<in>Basis. q (b' i) \<in> {0..p}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3370
      using q(1) b' by (auto intro: less_imp_le simp: bij_betw_def)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3371
    then have "z\<in>{0..\<Sum>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
  3372
      unfolding z_def mem_interval using b'_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
  3373
      by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3374
    then have d_fz_z:"d \<le> norm (f z - z)" by (rule d)
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
  3375
    case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3376
    then have as: "\<forall>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar> < d / real n"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3377
      using `n > 0` 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
  3378
    have "norm (f z - z) \<le> (\<Sum>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar>)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3379
      unfolding inner_diff_left[symmetric] by(rule norm_le_l1)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3380
    also have "\<dots> < (\<Sum>(i::'a) \<in> Basis. d / real n)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3381
      apply (rule setsum_strict_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3382
      using as apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3383
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3384
    also have "\<dots> = d"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3385
      using DIM_positive[where 'a='a] by (auto simp: real_eq_of_nat n_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3386
    finally show False using d_fz_z by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3387
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3388
  then guess i .. note i = this
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3389
  have *: "b' i \<in> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3390
    using i using b'[unfolded bij_betw_def] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3391
  guess r using q(2)[rule_format,OF *] ..
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3392
  then guess s by (elim exE conjE) note rs = this[rule_format]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3393
  have b'_im: "\<And>i. i \<in> Basis \<Longrightarrow>  b' i \<in> {1..n}"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3394
    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
  3395
  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
  3396
  have "\<And>i. i \<in> Basis \<Longrightarrow> r (b' i) \<le> p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3397
    apply (rule order_trans)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3398
    apply (rule rs(1)[OF b'_im,THEN conjunct2])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3399
    using q(1)[rule_format,OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3400
    apply (auto simp add: Suc_le_eq)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3401
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3402
  then have "r' \<in> {0..\<Sum>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
  3403
    unfolding r'_def mem_interval using b'_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
  3404
    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
  3405
  def s' \<equiv> "(\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i)::'a"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3406
  have "\<And>i. i\<in>Basis \<Longrightarrow> s (b' i) \<le> p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3407
    apply (rule order_trans)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3408
    apply (rule rs(2)[OF b'_im, THEN conjunct2])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3409
    using q(1)[rule_format,OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3410
    apply (auto simp add: Suc_le_eq)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3411
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3412
  then have "s' \<in> {0..\<Sum>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
  3413
    unfolding s'_def mem_interval using b'_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
  3414
    by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3415
  have "z \<in> {0..\<Sum>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
  3416
    unfolding z_def mem_interval using b'_Basis q(1)[rule_format,OF b'_im] `p>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
  3417
    by (auto simp add: inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1 less_imp_le)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3418
  have *: "\<And>x. 1 + real x = real (Suc x)" by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3419
  { have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3420
      apply (rule setsum_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3421
      using rs(1)[OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3422
      apply (auto simp add:* field_simps)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3423
      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
  3424
    also have "\<dots> < e * real p" using p `e>0` `p>0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3425
      by (auto simp add: field_simps n_def real_of_nat_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3426
    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
  3427
  }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3428
  moreover
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3429
  { have "(\<Sum>i\<in>Basis. \<bar>real (s (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3430
      apply (rule setsum_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3431
      using rs(2)[OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3432
      apply (auto simp add:* field_simps)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3433
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3434
    also have "\<dots> < e * real p" using p `e > 0` `p > 0`
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3435
      by (auto simp add: field_simps n_def real_of_nat_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3436
    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
  3437
  }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3438
  ultimately
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3439
  have "norm (r' - z) < e" "norm (s' - z) < e"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3440
    unfolding r'_def s'_def z_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3441
    using `p>0`
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3442
    apply (rule_tac[!] le_less_trans[OF norm_le_l1])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3443
    apply (auto simp add: field_simps setsum_divide_distrib[symmetric] inner_diff_left)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3444
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3445
  then have "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
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
  3446
    using rs(3) i unfolding r'_def[symmetric] s'_def[symmetric] o_def bb'
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3447
    by (intro e(2)[OF `r'\<in>{0..\<Sum>Basis}` `s'\<in>{0..\<Sum>Basis}` `z\<in>{0..\<Sum>Basis}`]) auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3448
  then show False 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
  3449
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3450
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3451
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3452
subsection {* Retractions. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3453
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  3454
definition "retraction s t r \<longleftrightarrow>
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3455
  t \<subseteq> s \<and> continuous_on s r \<and> (r ` s \<subseteq> t) \<and> (\<forall>x\<in>t. r x = x)"
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3456
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3457
definition retract_of (infixl "retract'_of" 12)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3458
  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
  3459
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3460
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
  3461
  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
  3462
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3463
subsection {*preservation of fixpoints under (more general notion of) retraction. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3464
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3465
lemma invertible_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3466
  fixes s :: "'a::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3467
    and t :: "'b::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3468
  assumes "continuous_on t i"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3469
    and "i ` t \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3470
    and "continuous_on s r" "r ` s \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3471
    and "\<forall>y\<in>t. r (i y) = y"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3472
    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
  3473
    and "continuous_on t g"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3474
    and "g ` t \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3475
  obtains y where "y \<in> t" and "g y = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3476
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3477
  have "\<exists>x\<in>s. (i \<circ> g \<circ> r) x = x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3478
    apply (rule assms(6)[rule_format], rule)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3479
    apply (rule continuous_on_compose assms)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3480
    apply ((rule continuous_on_subset)?,rule assms)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3481
    using assms(2,4,8) unfolding image_compose
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3482
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3483
    apply blast
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3484
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3485
  then guess x .. note x = this
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3486
  then have *: "g (r x) \<in> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3487
    using assms(4,8) by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3488
  have "r ((i \<circ> g \<circ> r) x) = r x"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3489
    using x by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3490
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3491
    apply (rule_tac that[of "r x"])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3492
    using x
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3493
    unfolding o_def
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3494
    unfolding assms(5)[rule_format,OF *]
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3495
    using assms(4)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3496
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3497
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3498
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3499
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3500
lemma homeomorphic_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3501
  fixes s :: "'a::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3502
    and t :: "'b::euclidean_space set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3503
  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
  3504
  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
  3505
    (\<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
  3506
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3507
  guess r using assms[unfolded homeomorphic_def homeomorphism_def] ..
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3508
  then guess i ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3509
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3510
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3511
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3512
    apply (rule_tac[!] allI impI)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3513
    apply (rule_tac g=g in invertible_fixpoint_property[of t i s r])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3514
    prefer 10
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3515
    apply (rule_tac g=f in invertible_fixpoint_property[of s r t i])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3516
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3517
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3518
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3519
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3520
lemma retract_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3521
  fixes f :: "'a::euclidean_space => 'b::euclidean_space"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3522
    and s :: "'a set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3523
  assumes "t retract_of s"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3524
    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
  3525
    and "continuous_on t g"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3526
    and "g ` t \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3527
  obtains y where "y \<in> t" and "g y = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3528
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3529
  guess h using assms(1) unfolding retract_of_def ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3530
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3531
    unfolding retraction_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3532
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3533
    apply (rule invertible_fixpoint_property[OF continuous_on_id _ _ _ _ assms(2), of t h g])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3534
    prefer 7
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3535
    apply (rule_tac y = y in that)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3536
    using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3537
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3538
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3539
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3540
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3541
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3542
subsection {*So the Brouwer theorem for any set with nonempty interior. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3543
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
  3544
lemma brouwer_weak:
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3545
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'a::ordered_euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3546
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3547
    and "convex s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3548
    and "interior s \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3549
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3550
    and "f ` s \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3551
  obtains x where "x \<in> s" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3552
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3553
  have *: "interior {0::'a..\<Sum>Basis} \<noteq> {}"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3554
    unfolding interior_closed_interval interval_eq_empty
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3555
    by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3556
  have *: "{0::'a..\<Sum>Basis} homeomorphic s"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3557
    using homeomorphic_convex_compact[OF convex_interval(1) compact_interval * assms(2,1,3)] .
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3558
  have "\<forall>f. continuous_on {0::'a..\<Sum>Basis} f \<and> f ` {0::'a..\<Sum>Basis} \<subseteq> {0::'a..\<Sum>Basis} \<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
  3559
    (\<exists>x\<in>{0::'a..\<Sum>Basis}. 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
  3560
    using brouwer_cube by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3561
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3562
    unfolding homeomorphic_fixpoint_property[OF *]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3563
    apply (erule_tac x=f in allE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3564
    apply (erule impE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3565
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3566
    apply (erule bexE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3567
    apply (rule_tac x=y in that)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3568
    using assms
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3569
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3570
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3571
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3572
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3573
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3574
subsection {* And in particular for a closed ball. *}
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3575
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3576
lemma brouwer_ball:
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3577
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3578
  assumes "e > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3579
    and "continuous_on (cball a e) f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3580
    and "f ` (cball a e) \<subseteq> cball a e"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3581
  obtains x where "x \<in> cball a e" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3582
  using brouwer_weak[OF compact_cball convex_cball, of a e f]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3583
  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
  3584
  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
  3585
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3586
text {*Still more general form; could derive this directly without using the
36334
068a01b4bc56 document generation for Multivariate_Analysis
huffman
parents: 36318
diff changeset
  3587
  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
  3588
  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
  3589
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3590
lemma brouwer:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3591
  fixes f :: "'a::ordered_euclidean_space \<Rightarrow> 'a"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3592
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3593
    and "convex s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3594
    and "s \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3595
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3596
    and "f ` s \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3597
  obtains x where "x \<in> s" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3598
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3599
  have "\<exists>e>0. s \<subseteq> cball 0 e"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3600
    using compact_imp_bounded[OF assms(1)] unfolding bounded_pos
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3601
    apply (erule_tac exE)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3602
    apply (rule_tac x=b in exI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3603
    apply (auto simp add: dist_norm)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3604
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3605
  then guess e by (elim exE conjE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3606
  note e = this
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3607
  have "\<exists>x\<in> cball 0 e. (f \<circ> closest_point s) x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3608
    apply (rule_tac brouwer_ball[OF e(1), of 0 "f \<circ> closest_point s"])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3609
    apply (rule continuous_on_compose )
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3610
    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
  3611
    apply (rule continuous_on_subset[OF assms(4)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3612
    apply (insert closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3613
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3614
    using assms(5)[unfolded subset_eq]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3615
    using e(2)[unfolded subset_eq mem_cball]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3616
    apply (auto simp add: dist_norm)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3617
    done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3618
  then guess x .. note x=this
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3619
  have *: "closest_point s x = x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3620
    apply (rule closest_point_self)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3621
    apply (rule assms(5)[unfolded subset_eq,THEN bspec[where x="x"], unfolded image_iff])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3622
    apply (rule_tac x="closest_point s x" in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3623
    using x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3624
    unfolding o_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3625
    using closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3), of x]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3626
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3627
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3628
  show thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3629
    apply (rule_tac x="closest_point s x" in that)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3630
    unfolding x(2)[unfolded o_def]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3631
    apply (rule closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3)])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3632
    using *
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3633
    apply auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3634
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3635
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3636
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  3637
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
  3638
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3639
lemma no_retraction_cball:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3640
  fixes a :: "'a::ordered_euclidean_space"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3641
  assumes "e > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3642
  shows "\<not> (frontier (cball a e) retract_of (cball a e))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3643
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3644
  case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3645
  have *: "\<And>xa. a - (2 *\<^sub>R a - xa) = - (a - xa)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3646
    using scaleR_left_distrib[of 1 1 a] by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3647
  guess x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3648
    apply (rule retract_fixpoint_property[OF goal1, of "\<lambda>x. scaleR 2 a - x"])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3649
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3650
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3651
    apply (erule conjE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3652
    apply (rule brouwer_ball[OF assms])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3653
    apply assumption+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3654
    apply (rule_tac x=x in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3655
    apply assumption+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3656
    apply (rule continuous_on_intros)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3657
    unfolding frontier_cball subset_eq Ball_def image_iff
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3658
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3659
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3660
    apply (erule bexE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3661
    unfolding dist_norm
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3662
    apply (simp add: * norm_minus_commute)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3663
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3664
  note x = this
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3665
  then have "scaleR 2 a = scaleR 1 x + scaleR 1 x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3666
    by (auto simp add: algebra_simps)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3667
  then have "a = x"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3668
    unfolding scaleR_left_distrib[symmetric] by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3669
  then show False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3670
    using x assms by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3671
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3672
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3673
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3674
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
  3675
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3676
definition interval_bij :: "'a \<times> 'a \<Rightarrow> 'a \<times> 'a \<Rightarrow> 'a \<Rightarrow> 'a::ordered_euclidean_space"
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3677
  where "interval_bij =
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3678
    (\<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
  3679
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3680
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
  3681
  "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
  3682
    (\<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
  3683
  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
  3684
    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
  3685
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3686
lemma continuous_interval_bij:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3687
  fixes a b :: "'a::ordered_euclidean_space"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3688
  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
  3689
  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
  3690
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3691
lemma continuous_on_interval_bij: "continuous_on s (interval_bij (a, b) (u, v))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3692
  apply(rule continuous_at_imp_continuous_on)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3693
  apply (rule, rule continuous_interval_bij)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3694
  done
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3695
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
  3696
lemma in_interval_interval_bij:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3697
  fixes a b u v x :: "'a::ordered_euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3698
  assumes "x \<in> {a..b}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3699
    and "{u..v} \<noteq> {}"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3700
  shows "interval_bij (a,b) (u,v) x \<in> {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
  3701
  apply (simp only: interval_bij_def split_conv mem_interval inner_setsum_left_Basis cong: ball_cong)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3702
  apply safe
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  3703
proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3704
  fix i :: 'a
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3705
  assume i: "i \<in> Basis"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3706
  have "{a..b} \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3707
    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
  3708
  with i have *: "a\<bullet>i \<le> b\<bullet>i" "u\<bullet>i \<le> v\<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
  3709
    using assms(2) by (auto simp add: interval_eq_empty not_less)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  3710
  have x: "a\<bullet>i\<le>x\<bullet>i" "x\<bullet>i\<le>b\<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
  3711
    using assms(1)[unfolded mem_interval] using i 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
  3712
  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
  3713
    using * x by (auto intro!: mult_nonneg_nonneg divide_nonneg_nonneg)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3714
  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
  3715
    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
  3716
  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
  3717
    apply (rule mult_right_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3718
    unfolding divide_le_eq_1
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3719
    using * x
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  3720
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3721
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  3722
  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
  3723
    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
  3724
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  3725
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  3726
lemma interval_bij_bij:
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
  3727
  "\<forall>(i::'a::ordered_euclidean_space)\<in>Basis. a\<bullet>i < b\<bullet>i \<and> u\<bullet>i < v\<bullet>i \<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
  3728
    interval_bij (a,b) (u,v) (interval_bij (u,v) (a,b) x) = 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
  3729
  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
  3730
34291
4e896680897e finite annotation on cartesian product is now implicit.
hoelzl
parents: 34289
diff changeset
  3731
end