src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy
author wenzelm
Thu, 27 Mar 2014 10:43:43 +0100
changeset 56299 8201790fdeb9
parent 56273 def3bbe6f2a5
child 56371 fb9ae0727548
permissions -rw-r--r--
more careful treatment of multiple command states (eval + prints): merge content that is actually required; more standard Markup_Tree merge, including trivial cases;
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
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    25
lemma bij_betw_singleton_eq:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    26
  assumes f: "bij_betw f A B" and g: "bij_betw g A B" and a: "a \<in> A"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    27
  assumes eq: "(\<And>x. x \<in> A \<Longrightarrow> x \<noteq> a \<Longrightarrow> f x = g x)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    28
  shows "f a = g a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    29
proof -
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    30
  have "f ` (A - {a}) = g ` (A - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    31
    by (intro image_cong) (simp_all add: eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    32
  then have "B - {f a} = B - {g a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    33
    using f g a by (auto simp: bij_betw_def inj_on_image_set_diff set_eq_iff)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    34
  moreover have "f a \<in> B" "g a \<in> B"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    35
    using f g a by (auto simp: bij_betw_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    36
  ultimately show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    37
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    38
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    39
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    40
lemma swap_image:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    41
  "Fun.swap i j f ` A = (if i \<in> A then (if j \<in> A then f ` A else f ` ((A - {i}) \<union> {j}))
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    42
                                  else (if j \<in> A then f ` ((A - {j}) \<union> {i}) else f ` A))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    43
  apply (auto simp: Fun.swap_def image_iff)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    44
  apply metis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    45
  apply (metis member_remove remove_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    46
  apply (metis member_remove remove_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    47
  done
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    48
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    49
lemma swap_apply1: "Fun.swap x y f x = f y"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    50
  by (simp add: swap_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    51
  
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    52
lemma swap_apply2: "Fun.swap x y f y = f x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    53
  by (simp add: swap_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    54
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    55
lemma (in -) lessThan_empty_iff: "{..< n::nat} = {} \<longleftrightarrow> n = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    56
  by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    57
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    58
lemma Zero_notin_Suc: "0 \<notin> Suc ` A"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    59
  by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    60
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    61
lemma atMost_Suc_eq_insert_0: "{.. Suc n} = insert 0 (Suc ` {.. n})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    62
  apply auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    63
  apply (case_tac x)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    64
  apply auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    65
  done
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    66
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
    67
lemma divide_nonneg_nonneg:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    68
  fixes a b :: "'a :: {linordered_field, field_inverse_zero}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    69
  shows "a \<ge> 0 \<Longrightarrow> b \<ge> 0 \<Longrightarrow> 0 \<le> a / b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    70
  by (cases "b = 0") (auto intro!: divide_nonneg_pos)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    71
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    72
lemma setsum_Un_disjoint':
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    73
  assumes "finite A"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    74
    and "finite B"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    75
    and "A \<inter> B = {}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    76
    and "A \<union> B = C"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    77
  shows "setsum g C = setsum g A + setsum g B"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    78
  using setsum_Un_disjoint[OF assms(1-3)] and assms(4) by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    79
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    80
lemma pointwise_minimal_pointwise_maximal:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    81
  fixes s :: "(nat \<Rightarrow> nat) set"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    82
  assumes "finite s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    83
    and "s \<noteq> {}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    84
    and "\<forall>x\<in>s. \<forall>y\<in>s. x \<le> y \<or> y \<le> x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    85
  shows "\<exists>a\<in>s. \<forall>x\<in>s. a \<le> x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    86
    and "\<exists>a\<in>s. \<forall>x\<in>s. x \<le> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    87
  using assms
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    88
proof (induct s rule: finite_ne_induct)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    89
  case (insert b s)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    90
  assume *: "\<forall>x\<in>insert b s. \<forall>y\<in>insert b s. x \<le> y \<or> y \<le> x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    91
  moreover then obtain u l where "l \<in> s" "\<forall>b\<in>s. l \<le> b" "u \<in> s" "\<forall>b\<in>s. b \<le> u"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    92
    using insert by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    93
  ultimately show "\<exists>a\<in>insert b s. \<forall>x\<in>insert b s. a \<le> x" "\<exists>a\<in>insert b s. \<forall>x\<in>insert b s. x \<le> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    94
    using *[rule_format, of b u] *[rule_format, of b l] by (metis insert_iff order.trans)+
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
    95
qed 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
    96
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
    97
lemma brouwer_compactness_lemma:
56226
29fd6bd9228e generalize some theorems
huffman
parents: 56188
diff changeset
    98
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
    99
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   100
    and "continuous_on s f"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   101
    and "\<not> (\<exists>x\<in>s. f x = 0)"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   102
  obtains d where "0 < d" and "\<forall>x\<in>s. d \<le> norm (f x)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   103
proof (cases "s = {}")
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   104
  case True
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   105
  show thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   106
    by (rule that [of 1]) (auto simp: True)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   107
next
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   108
  case False
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   109
  have "continuous_on s (norm \<circ> f)"
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   110
    by (rule continuous_on_intros continuous_on_norm assms(2))+
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   111
  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
   112
    using continuous_attains_inf[OF assms(1), of "norm \<circ> f"]
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   113
    unfolding o_def
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   114
    by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   115
  have "(norm \<circ> f) x > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   116
    using assms(3) and x(1)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   117
    by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   118
  then show ?thesis
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
   119
    by (rule that) (insert x(2), auto simp: o_def)
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   120
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   121
49555
fb2128470345 tuned proofs;
wenzelm
parents: 49374
diff changeset
   122
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
   123
  fixes P Q :: "'a::euclidean_space \<Rightarrow> bool"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   124
  assumes "\<forall>x. P x \<longrightarrow> P (f x)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
   125
    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
   126
  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
   127
             (\<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
   128
             (\<forall>x.\<forall>i\<in>Basis. P x \<and> Q i \<and> (x\<bullet>i = 1) \<longrightarrow> (l x i = 1)) \<and>
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   129
             (\<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>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   130
             (\<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
   131
proof -
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   132
  { fix x i
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   133
    let ?R = "\<lambda>y. (P x \<and> Q i \<and> x \<bullet> i = 0 \<longrightarrow> y = (0::nat)) \<and>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   134
        (P x \<and> Q i \<and> x \<bullet> i = 1 \<longrightarrow> y = 1) \<and>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   135
        (P x \<and> Q i \<and> y = 0 \<longrightarrow> x \<bullet> i \<le> f x \<bullet> i) \<and>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   136
        (P x \<and> Q i \<and> y = 1 \<longrightarrow> f x \<bullet> i \<le> x \<bullet> i)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   137
    { assume "P x" "Q i" "i \<in> Basis" with assms have "0 \<le> f x \<bullet> i \<and> f x \<bullet> i \<le> 1" by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   138
    then have "i \<in> Basis \<Longrightarrow> ?R 0 \<or> ?R 1" by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   139
  then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   140
    unfolding all_conj_distrib[symmetric] Ball_def (* FIXME: shouldn't this work by metis? *)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   141
    by (subst choice_iff[symmetric])+ blast
49374
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   142
qed
b08c6312782b tuned proofs;
wenzelm
parents: 44890
diff changeset
   143
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   144
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
   145
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
   146
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
   147
lemma kuhn_counting_lemma:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   148
  fixes bnd compo compo' face S F
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   149
  defines "nF s == card {f\<in>F. face f s \<and> compo' f}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   150
  assumes [simp, intro]: "finite F" -- "faces" and [simp, intro]: "finite S" -- "simplices"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   151
    and "\<And>f. f \<in> F \<Longrightarrow> bnd f \<Longrightarrow> card {s\<in>S. face f s} = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   152
    and "\<And>f. f \<in> F \<Longrightarrow> \<not> bnd f \<Longrightarrow> card {s\<in>S. face f s} = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   153
    and "\<And>s. s \<in> S \<Longrightarrow> compo s \<Longrightarrow> nF s = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   154
    and "\<And>s. s \<in> S \<Longrightarrow> \<not> compo s \<Longrightarrow> nF s = 0 \<or> nF s = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   155
    and "odd (card {f\<in>F. compo' f \<and> bnd f})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   156
  shows "odd (card {s\<in>S. compo s})"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
   157
proof -
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   158
  have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + (\<Sum>s | s \<in> S \<and> compo s. nF s) = (\<Sum>s\<in>S. nF s)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   159
    by (subst setsum_Un_disjoint[symmetric]) (auto intro!: setsum_cong)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   160
  also have "\<dots> = (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> bnd f}. face f s}) +
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   161
                  (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> \<not> bnd f}. face f s})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   162
    unfolding setsum_addf[symmetric]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   163
    by (subst card_Un_disjoint[symmetric])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   164
       (auto simp: nF_def intro!: setsum_cong arg_cong[where f=card])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   165
  also have "\<dots> = 1 * card {f\<in>F. compo' f \<and> bnd f} + 2 * card {f\<in>F. compo' f \<and> \<not> bnd f}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   166
    using assms(4,5) by (fastforce intro!: arg_cong2[where f="op +"] setsum_multicount)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   167
  finally have "odd ((\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + card {s\<in>S. compo s})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   168
    using assms(6,8) by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   169
  moreover have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) =
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   170
    (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 0. nF s) + (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 2. nF s)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   171
    using assms(7) by (subst setsum_Un_disjoint[symmetric]) (fastforce intro!: setsum_cong)+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   172
  ultimately show ?thesis
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
   173
    by auto
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   174
qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
   175
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   176
subsection {* The odd/even result for faces of complete vertices, generalized. *}
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   177
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   178
lemma kuhn_complete_lemma:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   179
  assumes [simp]: "finite simplices"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   180
    and face: "\<And>f s. face f s \<longleftrightarrow> (\<exists>a\<in>s. f = s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   181
    and card_s[simp]:  "\<And>s. s \<in> simplices \<Longrightarrow> card s = n + 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   182
    and rl_bd: "\<And>s. s \<in> simplices \<Longrightarrow> rl ` s \<subseteq> {..Suc n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   183
    and bnd: "\<And>f s. s \<in> simplices \<Longrightarrow> face f s \<Longrightarrow> bnd f \<Longrightarrow> card {s\<in>simplices. face f s} = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   184
    and nbnd: "\<And>f s. s \<in> simplices \<Longrightarrow> face f s \<Longrightarrow> \<not> bnd f \<Longrightarrow> card {s\<in>simplices. face f s} = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   185
    and odd_card: "odd (card {f. (\<exists>s\<in>simplices. face f s) \<and> rl ` f = {..n} \<and> bnd f})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   186
  shows "odd (card {s\<in>simplices. (rl ` s = {..Suc n})})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   187
proof (rule kuhn_counting_lemma)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   188
  have finite_s[simp]: "\<And>s. s \<in> simplices \<Longrightarrow> finite s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   189
    by (metis add_is_0 zero_neq_numeral card_infinite assms(3)) 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   190
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   191
  let ?F = "{f. \<exists>s\<in>simplices. face f s}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   192
  have F_eq: "?F = (\<Union>s\<in>simplices. \<Union>a\<in>s. {s - {a}})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   193
    by (auto simp: face)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   194
  show "finite ?F"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   195
    using `finite simplices` unfolding F_eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   196
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   197
  { fix f assume "f \<in> ?F" "bnd f" then show "card {s \<in> simplices. face f s} = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   198
      using bnd by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   199
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   200
  { fix f assume "f \<in> ?F" "\<not> bnd f" then show "card {s \<in> simplices. face f s} = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   201
      using nbnd by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   202
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   203
  show "odd (card {f \<in> {f. \<exists>s\<in>simplices. face f s}. rl ` f = {..n} \<and> bnd f})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   204
    using odd_card by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   205
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   206
  fix s assume s[simp]: "s \<in> simplices"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   207
  let ?S = "{f \<in> {f. \<exists>s\<in>simplices. face f s}. face f s \<and> rl ` f = {..n}}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   208
  have "?S = (\<lambda>a. s - {a}) ` {a\<in>s. rl ` (s - {a}) = {..n}}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   209
    using s by (fastforce simp: face)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   210
  then have card_S: "card ?S = card {a\<in>s. rl ` (s - {a}) = {..n}}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   211
    by (auto intro!: card_image inj_onI)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   212
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   213
  { assume rl: "rl ` s = {..Suc n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   214
    then have inj_rl: "inj_on rl s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   215
      by (intro eq_card_imp_inj_on) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   216
    moreover obtain a where "rl a = Suc n" "a \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   217
      by (metis atMost_iff image_iff le_Suc_eq rl)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   218
    ultimately have n: "{..n} = rl ` (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   219
      by (auto simp add: inj_on_image_set_diff rl)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   220
    have "{a\<in>s. rl ` (s - {a}) = {..n}} = {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   221
      using inj_rl `a \<in> s` by (auto simp add: n inj_on_image_eq_iff[OF inj_rl] Diff_subset)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   222
    then show "card ?S = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   223
      unfolding card_S by simp }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   224
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   225
  { assume rl: "rl ` s \<noteq> {..Suc n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   226
    show "card ?S = 0 \<or> card ?S = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   227
    proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   228
      assume *: "{..n} \<subseteq> rl ` s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   229
      with rl rl_bd[OF s] have rl_s: "rl ` s = {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   230
        by (auto simp add: atMost_Suc subset_insert_iff split: split_if_asm)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   231
      then have "\<not> inj_on rl s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   232
        by (intro pigeonhole) simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   233
      then obtain a b where ab: "a \<in> s" "b \<in> s" "rl a = rl b" "a \<noteq> b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   234
        by (auto simp: inj_on_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   235
      then have eq: "rl ` (s - {a}) = rl ` s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   236
        by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   237
      with ab have inj: "inj_on rl (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   238
        by (intro eq_card_imp_inj_on) (auto simp add: rl_s card_Diff_singleton_if)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   239
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   240
      { fix x assume "x \<in> s" "x \<notin> {a, b}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   241
        then have "rl ` s - {rl x} = rl ` ((s - {a}) - {x})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   242
          by (auto simp: eq inj_on_image_set_diff[OF inj])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   243
        also have "\<dots> = rl ` (s - {x})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   244
          using ab `x \<notin> {a, b}` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   245
        also assume "\<dots> = rl ` s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   246
        finally have False
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   247
          using `x\<in>s` by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   248
      moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   249
      { fix x assume "x \<in> {a, b}" with ab have "x \<in> s \<and> rl ` (s - {x}) = rl ` s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   250
          by (simp add: set_eq_iff image_iff Bex_def) metis }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   251
      ultimately have "{a\<in>s. rl ` (s - {a}) = {..n}} = {a, b}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   252
        unfolding rl_s[symmetric] by fastforce
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   253
      with `a \<noteq> b` show "card ?S = 0 \<or> card ?S = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   254
        unfolding card_S by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   255
    next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   256
      assume "\<not> {..n} \<subseteq> rl ` s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   257
      then have "\<And>x. rl ` (s - {x}) \<noteq> {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   258
        by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   259
      then show "card ?S = 0 \<or> card ?S = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   260
        unfolding card_S by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   261
    qed }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   262
qed fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   263
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   264
locale kuhn_simplex =
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   265
  fixes p n and base upd and s :: "(nat \<Rightarrow> nat) set"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   266
  assumes base: "base \<in> {..< n} \<rightarrow> {..< p}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   267
  assumes base_out: "\<And>i. n \<le> i \<Longrightarrow> base i = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   268
  assumes upd: "bij_betw upd {..< n} {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   269
  assumes s_pre: "s = (\<lambda>i j. if j \<in> upd`{..< i} then Suc (base j) else base j) ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   270
begin
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   271
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   272
definition "enum i j = (if j \<in> upd`{..< i} then Suc (base j) else base j)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   274
lemma s_eq: "s = enum ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   275
  unfolding s_pre enum_def[abs_def] ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   276
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   277
lemma upd_space: "i < n \<Longrightarrow> upd i < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   278
  using upd by (auto dest!: bij_betwE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   279
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   280
lemma s_space: "s \<subseteq> {..< n} \<rightarrow> {.. p}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   281
proof -
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   282
  { fix i assume "i \<le> n" then have "enum i \<in> {..< n} \<rightarrow> {.. p}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   283
    proof (induct i)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   284
      case 0 then show ?case
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   285
        using base by (auto simp: Pi_iff less_imp_le enum_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   286
    next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   287
      case (Suc i) with base show ?case
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   288
        by (auto simp: Pi_iff Suc_le_eq less_imp_le enum_def intro: upd_space)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   289
    qed }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   290
  then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   291
    by (auto simp: s_eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   292
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   293
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   294
lemma inj_upd: "inj_on upd {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   295
  using upd by (simp add: bij_betw_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   296
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   297
lemma inj_enum: "inj_on enum {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   298
proof -
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   299
  { fix x y :: nat assume "x \<noteq> y" "x \<le> n" "y \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   300
    with upd have "upd ` {..< x} \<noteq> upd ` {..< y}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   301
      by (subst inj_on_image_eq_iff[where C="{..< n}"]) (auto simp: bij_betw_def) 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   302
    then have "enum x \<noteq> enum y"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   303
      by (auto simp add: enum_def fun_eq_iff) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   304
  then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   305
    by (auto simp: inj_on_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   306
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   307
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   308
lemma enum_0: "enum 0 = base"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   309
  by (simp add: enum_def[abs_def])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   310
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   311
lemma base_in_s: "base \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   312
  unfolding s_eq by (subst enum_0[symmetric]) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   313
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   314
lemma enum_in: "i \<le> n \<Longrightarrow> enum i \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   315
  unfolding s_eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   316
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   317
lemma one_step:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   318
  assumes a: "a \<in> s" "j < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   319
  assumes *: "\<And>a'. a' \<in> s \<Longrightarrow> a' \<noteq> a \<Longrightarrow> a' j = p'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   320
  shows "a j \<noteq> p'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   321
proof
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   322
  assume "a j = p'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   323
  with * a have "\<And>a'. a' \<in> s \<Longrightarrow> a' j = p'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   324
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   325
  then have "\<And>i. i \<le> n \<Longrightarrow> enum i j = p'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   326
    unfolding s_eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   327
  from this[of 0] this[of n] have "j \<notin> upd ` {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   328
    by (auto simp: enum_def fun_eq_iff split: split_if_asm)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   329
  with upd `j < n` show False
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   330
    by (auto simp: bij_betw_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   331
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   332
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   333
lemma upd_inj: "i < n \<Longrightarrow> j < n \<Longrightarrow> upd i = upd j \<longleftrightarrow> i = j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   334
  using upd by (auto simp: bij_betw_def inj_on_iff)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   335
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   336
lemma upd_surj: "upd ` {..< n} = {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   337
  using upd by (auto simp: bij_betw_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   338
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   339
lemma in_upd_image: "A \<subseteq> {..< n} \<Longrightarrow> i < n \<Longrightarrow> upd i \<in> upd ` A \<longleftrightarrow> i \<in> A"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   340
  using inj_on_image_mem_iff[of upd "{..< n}" A i ] upd
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   341
  by (auto simp: bij_betw_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   342
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   343
lemma enum_inj: "i \<le> n \<Longrightarrow> j \<le> n \<Longrightarrow> enum i = enum j \<longleftrightarrow> i = j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   344
  using inj_enum by (auto simp: inj_on_iff)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   345
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   346
lemma in_enum_image: "A \<subseteq> {.. n} \<Longrightarrow> i \<le> n \<Longrightarrow> enum i \<in> enum ` A \<longleftrightarrow> i \<in> A"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   347
  using inj_on_image_mem_iff[OF inj_enum, of A i] by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   348
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   349
lemma enum_mono: "i \<le> n \<Longrightarrow> j \<le> n \<Longrightarrow> enum i \<le> enum j \<longleftrightarrow> i \<le> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   350
  by (auto simp: enum_def le_fun_def in_upd_image Ball_def[symmetric])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   351
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   352
lemma enum_strict_mono: "i \<le> n \<Longrightarrow> j \<le> n \<Longrightarrow> enum i < enum j \<longleftrightarrow> i < j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   353
  using enum_mono[of i j] enum_inj[of i j] by (auto simp add: le_less)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   354
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   355
lemma chain: "a \<in> s \<Longrightarrow> b \<in> s \<Longrightarrow> a \<le> b \<or> b \<le> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   356
  by (auto simp: s_eq enum_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   357
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   358
lemma less: "a \<in> s \<Longrightarrow> b \<in> s \<Longrightarrow> a i < b i \<Longrightarrow> a < b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   359
  using chain[of a b] by (auto simp: less_fun_def le_fun_def not_le[symmetric])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   360
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   361
lemma enum_0_bot: "a \<in> s \<Longrightarrow> a = enum 0 \<longleftrightarrow> (\<forall>a'\<in>s. a \<le> a')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   362
  unfolding s_eq by (auto simp: enum_mono Ball_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   363
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   364
lemma enum_n_top: "a \<in> s \<Longrightarrow> a = enum n \<longleftrightarrow> (\<forall>a'\<in>s. a' \<le> a)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   365
  unfolding s_eq by (auto simp: enum_mono Ball_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   366
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   367
lemma enum_Suc: "i < n \<Longrightarrow> enum (Suc i) = (enum i)(upd i := Suc (enum i (upd i)))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   368
  by (auto simp: fun_eq_iff enum_def upd_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   369
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   370
lemma enum_eq_p: "i \<le> n \<Longrightarrow> n \<le> j \<Longrightarrow> enum i j = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   371
  by (induct i) (auto simp: enum_Suc enum_0 base_out upd_space not_less[symmetric])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   372
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   373
lemma out_eq_p: "a \<in> s \<Longrightarrow> n \<le> j \<Longrightarrow> a j = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   374
  unfolding s_eq by (auto simp add: enum_eq_p)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   375
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   376
lemma s_le_p: "a \<in> s \<Longrightarrow> a j \<le> p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   377
  using out_eq_p[of a j] s_space by (cases "j < n") auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   378
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   379
lemma le_Suc_base: "a \<in> s \<Longrightarrow> a j \<le> Suc (base j)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   380
  unfolding s_eq by (auto simp: enum_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   381
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   382
lemma base_le: "a \<in> s \<Longrightarrow> base j \<le> a j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   383
  unfolding s_eq by (auto simp: enum_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   384
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   385
lemma enum_le_p: "i \<le> n \<Longrightarrow> j < n \<Longrightarrow> enum i j \<le> p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   386
  using enum_in[of i] s_space by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   387
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   388
lemma enum_less: "a \<in> s \<Longrightarrow> i < n \<Longrightarrow> enum i < a \<longleftrightarrow> enum (Suc i) \<le> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   389
  unfolding s_eq by (auto simp: enum_strict_mono enum_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   390
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   391
lemma ksimplex_0:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   392
  "n = 0 \<Longrightarrow> s = {(\<lambda>x. p)}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   393
  using s_eq enum_def base_out by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   394
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   395
lemma replace_0:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   396
  assumes "j < n" "a \<in> s" and p: "\<forall>x\<in>s - {a}. x j = 0" and "x \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   397
  shows "x \<le> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   398
proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   399
  assume "x \<noteq> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   400
  have "a j \<noteq> 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   401
    using assms by (intro one_step[where a=a]) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   402
  with less[OF `x\<in>s` `a\<in>s`, of j] p[rule_format, of x] `x \<in> s` `x \<noteq> a`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   403
  show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   404
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   405
qed simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   406
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   407
lemma replace_1:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   408
  assumes "j < n" "a \<in> s" and p: "\<forall>x\<in>s - {a}. x j = p" and "x \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   409
  shows "a \<le> x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   410
proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   411
  assume "x \<noteq> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   412
  have "a j \<noteq> p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   413
    using assms by (intro one_step[where a=a]) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   414
  with enum_le_p[of _ j] `j < n` `a\<in>s`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   415
  have "a j < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   416
    by (auto simp: less_le s_eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   417
  with less[OF `a\<in>s` `x\<in>s`, of j] p[rule_format, of x] `x \<in> s` `x \<noteq> a`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   418
  show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   419
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   420
qed simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   421
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   422
end
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   423
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   424
locale kuhn_simplex_pair = s: kuhn_simplex p n b_s u_s s + t: kuhn_simplex p n b_t u_t t
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   425
  for p n b_s u_s s b_t u_t t
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   426
begin
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   427
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   428
lemma enum_eq:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   429
  assumes l: "i \<le> l" "l \<le> j" and "j + d \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   430
  assumes eq: "s.enum ` {i .. j} = t.enum ` {i + d .. j + d}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   431
  shows "s.enum l = t.enum (l + d)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   432
using l proof (induct l rule: dec_induct)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   433
  case base
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   434
  then have s: "s.enum i \<in> t.enum ` {i + d .. j + d}" and t: "t.enum (i + d) \<in> s.enum ` {i .. j}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   435
    using eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   436
  from t `i \<le> j` `j + d \<le> n` have "s.enum i \<le> t.enum (i + d)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   437
    by (auto simp: s.enum_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   438
  moreover from s `i \<le> j` `j + d \<le> n` have "t.enum (i + d) \<le> s.enum i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   439
    by (auto simp: t.enum_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   440
  ultimately show ?case
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   441
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   442
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   443
  case (step l)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   444
  moreover from step.prems `j + d \<le> n` have
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   445
      "s.enum l < s.enum (Suc l)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   446
      "t.enum (l + d) < t.enum (Suc l + d)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   447
    by (simp_all add: s.enum_strict_mono t.enum_strict_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   448
  moreover have
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   449
      "s.enum (Suc l) \<in> t.enum ` {i + d .. j + d}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   450
      "t.enum (Suc l + d) \<in> s.enum ` {i .. j}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   451
    using step `j + d \<le> n` eq by (auto simp: s.enum_inj t.enum_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   452
  ultimately have "s.enum (Suc l) = t.enum (Suc (l + d))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   453
    using `j + d \<le> n`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   454
    by (intro antisym s.enum_less[THEN iffD1] t.enum_less[THEN iffD1]) 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   455
       (auto intro!: s.enum_in t.enum_in)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   456
  then show ?case by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   457
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   458
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   459
lemma ksimplex_eq_bot:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   460
  assumes a: "a \<in> s" "\<And>a'. a' \<in> s \<Longrightarrow> a \<le> a'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   461
  assumes b: "b \<in> t" "\<And>b'. b' \<in> t \<Longrightarrow> b \<le> b'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   462
  assumes eq: "s - {a} = t - {b}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   463
  shows "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   464
proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   465
  assume "n = 0" with s.ksimplex_0 t.ksimplex_0 show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   466
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   467
  assume "n \<noteq> 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   468
  have "s.enum 0 = (s.enum (Suc 0)) (u_s 0 := s.enum (Suc 0) (u_s 0) - 1)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   469
       "t.enum 0 = (t.enum (Suc 0)) (u_t 0 := t.enum (Suc 0) (u_t 0) - 1)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   470
    using `n \<noteq> 0` by (simp_all add: s.enum_Suc t.enum_Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   471
  moreover have e0: "a = s.enum 0" "b = t.enum 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   472
    using a b by (simp_all add: s.enum_0_bot t.enum_0_bot)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   473
  moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   474
  { fix j assume "0 < j" "j \<le> n" 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   475
    moreover have "s - {a} = s.enum ` {Suc 0 .. n}" "t - {b} = t.enum ` {Suc 0 .. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   476
      unfolding s.s_eq t.s_eq e0 by (auto simp: s.enum_inj t.enum_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   477
    ultimately have "s.enum j = t.enum j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   478
      using enum_eq[of "1" j n 0] eq by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   479
  note enum_eq = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   480
  then have "s.enum (Suc 0) = t.enum (Suc 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   481
    using `n \<noteq> 0` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   482
  moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   483
  { fix j assume "Suc j < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   484
    with enum_eq[of "Suc j"] enum_eq[of "Suc (Suc j)"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   485
    have "u_s (Suc j) = u_t (Suc j)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   486
      using s.enum_Suc[of "Suc j"] t.enum_Suc[of "Suc j"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   487
      by (auto simp: fun_eq_iff split: split_if_asm) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   488
  then have "\<And>j. 0 < j \<Longrightarrow> j < n \<Longrightarrow> u_s j = u_t j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   489
    by (auto simp: gr0_conv_Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   490
  with `n \<noteq> 0` have "u_t 0 = u_s 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   491
    by (intro bij_betw_singleton_eq[OF t.upd s.upd, of 0]) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   492
  ultimately have "a = b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   493
    by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   494
  with assms show "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   495
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   496
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   497
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   498
lemma ksimplex_eq_top:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   499
  assumes a: "a \<in> s" "\<And>a'. a' \<in> s \<Longrightarrow> a' \<le> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   500
  assumes b: "b \<in> t" "\<And>b'. b' \<in> t \<Longrightarrow> b' \<le> b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   501
  assumes eq: "s - {a} = t - {b}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   502
  shows "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   503
proof (cases n)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   504
  assume "n = 0" with s.ksimplex_0 t.ksimplex_0 show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   505
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   506
  case (Suc n')
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   507
  have "s.enum n = (s.enum n') (u_s n' := Suc (s.enum n' (u_s n')))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   508
       "t.enum n = (t.enum n') (u_t n' := Suc (t.enum n' (u_t n')))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   509
    using Suc by (simp_all add: s.enum_Suc t.enum_Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   510
  moreover have en: "a = s.enum n" "b = t.enum n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   511
    using a b by (simp_all add: s.enum_n_top t.enum_n_top)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   512
  moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   513
  { fix j assume "j < n" 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   514
    moreover have "s - {a} = s.enum ` {0 .. n'}" "t - {b} = t.enum ` {0 .. n'}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   515
      unfolding s.s_eq t.s_eq en by (auto simp: s.enum_inj t.enum_inj Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   516
    ultimately have "s.enum j = t.enum j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   517
      using enum_eq[of "0" j n' 0] eq Suc by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   518
  note enum_eq = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   519
  then have "s.enum n' = t.enum n'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   520
    using Suc by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   521
  moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   522
  { fix j assume "j < n'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   523
    with enum_eq[of j] enum_eq[of "Suc j"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   524
    have "u_s j = u_t j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   525
      using s.enum_Suc[of j] t.enum_Suc[of j]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   526
      by (auto simp: Suc fun_eq_iff split: split_if_asm) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   527
  then have "\<And>j. j < n' \<Longrightarrow> u_s j = u_t j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   528
    by (auto simp: gr0_conv_Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   529
  then have "u_t n' = u_s n'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   530
    by (intro bij_betw_singleton_eq[OF t.upd s.upd, of n']) (auto simp: Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   531
  ultimately have "a = b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   532
    by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   533
  with assms show "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   534
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   535
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   536
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   537
end
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   538
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   539
inductive ksimplex for p n :: nat where
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   540
  ksimplex: "kuhn_simplex p n base upd s \<Longrightarrow> ksimplex p n s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   541
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   542
lemma finite_ksimplexes: "finite {s. ksimplex p n s}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   543
proof (rule finite_subset)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   544
  { fix a s assume "ksimplex p n s" "a \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   545
    then obtain b u where "kuhn_simplex p n b u s" by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   546
    then interpret kuhn_simplex p n b u s .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   547
    from s_space `a \<in> s` out_eq_p[OF `a \<in> s`]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   548
    have "a \<in> (\<lambda>f x. if n \<le> x then p else f x) ` ({..< n} \<rightarrow>\<^sub>E {.. p})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   549
      by (auto simp: image_iff subset_eq Pi_iff split: split_if_asm
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   550
               intro!: bexI[of _ "restrict a {..< n}"]) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   551
  then show "{s. ksimplex p n s} \<subseteq> Pow ((\<lambda>f x. if n \<le> x then p else f x) ` ({..< n} \<rightarrow>\<^sub>E {.. p}))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   552
    by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   553
qed (simp add: finite_PiE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   554
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   555
lemma ksimplex_card:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   556
  assumes "ksimplex p n s" shows "card s = Suc n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   557
using assms proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   558
  case (ksimplex u b)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   559
  then interpret kuhn_simplex p n u b s .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   560
  show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   561
    by (simp add: card_image s_eq inj_enum)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   562
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   563
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   564
lemma simplex_top_face:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   565
  assumes "0 < p" "\<forall>x\<in>s'. x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   566
  shows "ksimplex p n s' \<longleftrightarrow> (\<exists>s a. ksimplex p (Suc n) s \<and> a \<in> s \<and> s' = s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   567
  using assms
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   568
proof safe
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   569
  fix s a assume "ksimplex p (Suc n) s" and a: "a \<in> s" and na: "\<forall>x\<in>s - {a}. x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   570
  then show "ksimplex p n (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   571
  proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   572
    case (ksimplex base upd)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   573
    then interpret kuhn_simplex p "Suc n" base upd "s" .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   574
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   575
    have "a n < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   576
      using one_step[of a n p] na `a\<in>s` s_space by (auto simp: less_le)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   577
    then have "a = enum 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   578
      using `a \<in> s` na by (subst enum_0_bot) (auto simp: le_less intro!: less[of a _ n])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   579
    then have s_eq: "s - {a} = enum ` Suc ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   580
      using s_eq by (simp add: atMost_Suc_eq_insert_0 insert_ident Zero_notin_Suc in_enum_image subset_eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   581
    then have "enum 1 \<in> s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   582
      by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   583
    then have "upd 0 = n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   584
      using `a n < p` `a = enum 0` na[rule_format, of "enum 1"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   585
      by (auto simp: fun_eq_iff enum_Suc split: split_if_asm)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   586
    then have "bij_betw upd (Suc ` {..< n}) {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   587
      using upd
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   588
      by (subst notIn_Un_bij_betw3[where b=0])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   589
         (auto simp: lessThan_Suc[symmetric] lessThan_Suc_eq_insert_0)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   590
    then have "bij_betw (upd\<circ>Suc) {..<n} {..<n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   591
      by (rule bij_betw_trans[rotated]) (auto simp: bij_betw_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   592
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   593
    have "a n = p - 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   594
      using enum_Suc[of 0] na[rule_format, OF `enum 1 \<in> s - {a}`] `a = enum 0` by (auto simp: `upd 0 = n`)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   595
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   596
    show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   597
    proof (rule ksimplex.intros, default)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   598
      show "bij_betw (upd\<circ>Suc) {..< n} {..< n}" by fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   599
      show "base(n := p) \<in> {..<n} \<rightarrow> {..<p}" "\<And>i. n\<le>i \<Longrightarrow> (base(n := p)) i = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   600
        using base base_out by (auto simp: Pi_iff)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   601
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   602
      have "\<And>i. Suc ` {..< i} = {..< Suc i} - {0}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   603
        by (auto simp: image_iff Ball_def) arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   604
      then have upd_Suc: "\<And>i. i \<le> n \<Longrightarrow> (upd\<circ>Suc) ` {..< i} = upd ` {..< Suc i} - {n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   605
        using `upd 0 = n`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   606
        by (simp add: image_comp[symmetric] inj_on_image_set_diff[OF inj_upd])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   607
      have n_in_upd: "\<And>i. n \<in> upd ` {..< Suc i}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   608
        using `upd 0 = n` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   609
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   610
      def f' \<equiv> "\<lambda>i j. if j \<in> (upd\<circ>Suc)`{..< i} then Suc ((base(n := p)) j) else (base(n := p)) j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   611
      { fix x i assume i[arith]: "i \<le> n" then have "enum (Suc i) x = f' i x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   612
          unfolding f'_def enum_def using `a n < p` `a = enum 0` `upd 0 = n` `a n = p - 1`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   613
          by (simp add: upd_Suc enum_0 n_in_upd) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   614
      then show "s - {a} = f' ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   615
        unfolding s_eq image_comp by (intro image_cong) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   616
    qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   617
  qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   618
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   619
  assume "ksimplex p n s'" and *: "\<forall>x\<in>s'. x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   620
  then show "\<exists>s a. ksimplex p (Suc n) s \<and> a \<in> s \<and> s' = s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   621
  proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   622
    case (ksimplex base upd)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   623
    then interpret kuhn_simplex p n base upd s' .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   624
    def b \<equiv> "base (n := p - 1)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   625
    def u \<equiv> "\<lambda>i. case i of 0 \<Rightarrow> n | Suc i \<Rightarrow> upd i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   626
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   627
    have "ksimplex p (Suc n) (s' \<union> {b})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   628
    proof (rule ksimplex.intros, default)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   629
      show "b \<in> {..<Suc n} \<rightarrow> {..<p}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   630
        using base `0 < p` unfolding lessThan_Suc b_def by (auto simp: PiE_iff)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   631
      show "\<And>i. Suc n \<le> i \<Longrightarrow> b i = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   632
        using base_out by (auto simp: b_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   633
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   634
      have "bij_betw u (Suc ` {..< n} \<union> {0}) ({..<n} \<union> {u 0})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   635
        using upd
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   636
        by (intro notIn_Un_bij_betw) (auto simp: u_def bij_betw_def image_comp comp_def inj_on_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   637
      then show "bij_betw u {..<Suc n} {..<Suc n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   638
        by (simp add: u_def lessThan_Suc[symmetric] lessThan_Suc_eq_insert_0)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   639
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   640
      def f' \<equiv> "\<lambda>i j. if j \<in> u`{..< i} then Suc (b j) else b j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   641
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   642
      have u_eq: "\<And>i. i \<le> n \<Longrightarrow> u ` {..< Suc i} = upd ` {..< i} \<union> { n }"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   643
        by (auto simp: u_def image_iff upd_inj Ball_def split: nat.split) arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   644
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   645
      { fix x have "x \<le> n \<Longrightarrow> n \<notin> upd ` {..<x}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   646
          using upd_space by (simp add: image_iff neq_iff) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   647
      note n_not_upd = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   648
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   649
      have *: "f' ` {.. Suc n} = f' ` (Suc ` {.. n} \<union> {0})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   650
        unfolding atMost_Suc_eq_insert_0 by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   651
      also have "\<dots> = (f' \<circ> Suc) ` {.. n} \<union> {b}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   652
        by (auto simp: f'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   653
      also have "(f' \<circ> Suc) ` {.. n} = s'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   654
        using `0 < p` base_out[of n]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   655
        unfolding s_eq enum_def[abs_def] f'_def[abs_def] upd_space
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   656
        by (intro image_cong) (simp_all add: u_eq b_def fun_eq_iff n_not_upd)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   657
      finally show "s' \<union> {b} = f' ` {.. Suc n}" ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   658
    qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   659
    moreover have "b \<notin> s'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   660
      using * `0 < p` by (auto simp: b_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   661
    ultimately show ?thesis by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   662
  qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   663
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   664
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   665
lemma ksimplex_replace_0:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   666
  assumes s: "ksimplex p n s" and a: "a \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   667
  assumes j: "j < n" and p: "\<forall>x\<in>s - {a}. x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   668
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   669
  using s
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   670
proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   671
  case (ksimplex b_s u_s)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   672
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   673
  { fix t b assume "ksimplex p n t" 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   674
    then obtain b_t u_t where "kuhn_simplex p n b_t u_t t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   675
      by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   676
    interpret kuhn_simplex_pair p n b_s u_s s b_t u_t t
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   677
      by intro_locales fact+
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   678
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   679
    assume b: "b \<in> t" "t - {b} = s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   680
    with a j p s.replace_0[of _ a] t.replace_0[of _ b] have "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   681
      by (intro ksimplex_eq_top[of a b]) auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   682
  then have "{s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = {s}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   683
    using s `a \<in> s` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   684
  then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   685
    by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   686
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   687
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   688
lemma ksimplex_replace_1:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   689
  assumes s: "ksimplex p n s" and a: "a \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   690
  assumes j: "j < n" and p: "\<forall>x\<in>s - {a}. x j = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   691
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   692
  using s
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   693
proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   694
  case (ksimplex b_s u_s)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   695
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   696
  { fix t b assume "ksimplex p n t" 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   697
    then obtain b_t u_t where "kuhn_simplex p n b_t u_t t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   698
      by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   699
    interpret kuhn_simplex_pair p n b_s u_s s b_t u_t t
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   700
      by intro_locales fact+
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   701
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   702
    assume b: "b \<in> t" "t - {b} = s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   703
    with a j p s.replace_1[of _ a] t.replace_1[of _ b] have "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   704
      by (intro ksimplex_eq_bot[of a b]) auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   705
  then have "{s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = {s}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   706
    using s `a \<in> s` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   707
  then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   708
    by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   709
qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   710
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   711
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))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   712
  by (auto simp add: card_Suc_eq eval_nat_numeral)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   713
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   714
lemma ksimplex_replace_2:
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   715
  assumes s: "ksimplex p n s" and "a \<in> s" and "n \<noteq> 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   716
    and lb: "\<forall>j<n. \<exists>x\<in>s - {a}. x j \<noteq> 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   717
    and ub: "\<forall>j<n. \<exists>x\<in>s - {a}. x j \<noteq> p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   718
  shows "card {s'. ksimplex p n s' \<and> (\<exists>b\<in>s'. s' - {b} = s - {a})} = 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   719
  using s
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   720
proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   721
  case (ksimplex base upd)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   722
  then interpret kuhn_simplex p n base upd s .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   723
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   724
  from `a \<in> s` obtain i where "i \<le> n" "a = enum i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   725
    unfolding s_eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   726
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   727
  from `i \<le> n` have "i = 0 \<or> i = n \<or> (0 < i \<and> i < n)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   728
    by linarith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   729
  then have "\<exists>!s'. s' \<noteq> s \<and> ksimplex p n s' \<and> (\<exists>b\<in>s'. s - {a} = s'- {b})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   730
  proof (elim disjE conjE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   731
    assume "i = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   732
    def rot \<equiv> "\<lambda>i. if i + 1 = n then 0 else i + 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   733
    let ?upd = "upd \<circ> rot"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   734
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   735
    have rot: "bij_betw rot {..< n} {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   736
      by (auto simp: bij_betw_def inj_on_def image_iff Ball_def rot_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   737
         arith+
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   738
    from rot upd have "bij_betw ?upd {..<n} {..<n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   739
      by (rule bij_betw_trans)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   740
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   741
    def f' \<equiv> "\<lambda>i j. if j \<in> ?upd`{..< i} then Suc (enum (Suc 0) j) else enum (Suc 0) j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   742
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   743
    interpret b: kuhn_simplex p n "enum (Suc 0)" "upd \<circ> rot" "f' ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   744
    proof
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   745
      from `a = enum i` ub `n \<noteq> 0` `i = 0`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   746
      obtain i' where "i' \<le> n" "enum i' \<noteq> enum 0" "enum i' (upd 0) \<noteq> p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   747
        unfolding s_eq by (auto intro: upd_space simp: enum_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   748
      then have "enum 1 \<le> enum i'" "enum i' (upd 0) < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   749
        using enum_le_p[of i' "upd 0"] by (auto simp add: enum_inj enum_mono upd_space)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   750
      then have "enum 1 (upd 0) < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   751
        by (auto simp add: le_fun_def intro: le_less_trans)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   752
      then show "enum (Suc 0) \<in> {..<n} \<rightarrow> {..<p}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   753
        using base `n \<noteq> 0` by (auto simp add: enum_0 enum_Suc PiE_iff extensional_def upd_space)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   754
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   755
      { fix i assume "n \<le> i" then show "enum (Suc 0) i = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   756
        using `n \<noteq> 0` by (auto simp: enum_eq_p) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   757
      show "bij_betw ?upd {..<n} {..<n}" by fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   758
    qed (simp add: f'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   759
    have ks_f': "ksimplex p n (f' ` {.. n})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   760
      by rule unfold_locales
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   761
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   762
    have b_enum: "b.enum = f'" unfolding f'_def b.enum_def[abs_def] ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   763
    with b.inj_enum have inj_f': "inj_on f' {.. n}" by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   764
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   765
    have [simp]: "\<And>j. j < n \<Longrightarrow> rot ` {..< j} = {0 <..< Suc j}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   766
      by (auto simp: rot_def image_iff Ball_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   767
         arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   768
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   769
    { fix j assume j: "j < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   770
      from j `n \<noteq> 0` have "f' j = enum (Suc j)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   771
        by (auto simp add: f'_def enum_def upd_inj in_upd_image image_comp[symmetric] fun_eq_iff) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   772
    note f'_eq_enum = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   773
    then have "enum ` Suc ` {..< n} = f' ` {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   774
      by (force simp: enum_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   775
    also have "Suc ` {..< n} = {.. n} - {0}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   776
      by (auto simp: image_iff Ball_def) arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   777
    also have "{..< n} = {.. n} - {n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   778
      by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   779
    finally have eq: "s - {a} = f' ` {.. n} - {f' n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   780
      unfolding s_eq `a = enum i` `i = 0`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   781
      by (simp add: inj_on_image_set_diff[OF inj_enum] inj_on_image_set_diff[OF inj_f'])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   782
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   783
    have "enum 0 < f' 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   784
      using `n \<noteq> 0` by (simp add: enum_strict_mono f'_eq_enum)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   785
    also have "\<dots> < f' n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   786
      using `n \<noteq> 0` b.enum_strict_mono[of 0 n] unfolding b_enum by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   787
    finally have "a \<noteq> f' n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   788
      using `a = enum i` `i = 0` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   789
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   790
    { fix t c assume "ksimplex p n t" "c \<in> t" and eq_sma: "s - {a} = t - {c}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   791
      obtain b u where "kuhn_simplex p n b u t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   792
        using `ksimplex p n t` by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   793
      then interpret t: kuhn_simplex p n b u t .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   794
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   795
      { fix x assume "x \<in> s" "x \<noteq> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   796
         then have "x (upd 0) = enum (Suc 0) (upd 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   797
           by (auto simp: `a = enum i` `i = 0` s_eq enum_def enum_inj) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   798
      then have eq_upd0: "\<forall>x\<in>t-{c}. x (upd 0) = enum (Suc 0) (upd 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   799
        unfolding eq_sma[symmetric] by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   800
      then have "c (upd 0) \<noteq> enum (Suc 0) (upd 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   801
        using `n \<noteq> 0` by (intro t.one_step[OF `c\<in>t` ]) (auto simp: upd_space)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   802
      then have "c (upd 0) < enum (Suc 0) (upd 0) \<or> c (upd 0) > enum (Suc 0) (upd 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   803
        by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   804
      then have "t = s \<or> t = f' ` {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   805
      proof (elim disjE conjE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   806
        assume *: "c (upd 0) < enum (Suc 0) (upd 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   807
        interpret st: kuhn_simplex_pair p n base upd s b u t ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   808
        { fix x assume "x \<in> t" with * `c\<in>t` eq_upd0[rule_format, of x] have "c \<le> x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   809
            by (auto simp: le_less intro!: t.less[of _ _ "upd 0"]) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   810
        note top = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   811
        have "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   812
          using `a = enum i` `i = 0` `c \<in> t`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   813
          by (intro st.ksimplex_eq_bot[OF _ _ _ _ eq_sma])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   814
             (auto simp: s_eq enum_mono t.s_eq t.enum_mono top)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   815
        then show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   816
      next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   817
        assume *: "c (upd 0) > enum (Suc 0) (upd 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   818
        interpret st: kuhn_simplex_pair p n "enum (Suc 0)" "upd \<circ> rot" "f' ` {.. n}" b u t ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   819
        have eq: "f' ` {..n} - {f' n} = t - {c}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   820
          using eq_sma eq by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   821
        { fix x assume "x \<in> t" with * `c\<in>t` eq_upd0[rule_format, of x] have "x \<le> c"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   822
            by (auto simp: le_less intro!: t.less[of _ _ "upd 0"]) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   823
        note top = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   824
        have "f' ` {..n} = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   825
          using `a = enum i` `i = 0` `c \<in> t`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   826
          by (intro st.ksimplex_eq_top[OF _ _ _ _ eq])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   827
             (auto simp: b.s_eq b.enum_mono t.s_eq t.enum_mono b_enum[symmetric] top)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   828
        then show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   829
      qed }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   830
    with ks_f' eq `a \<noteq> f' n` `n \<noteq> 0` show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   831
      apply (intro ex1I[of _ "f' ` {.. n}"])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   832
      apply auto []
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   833
      apply metis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   834
      done
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   835
  next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   836
    assume "i = n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   837
    from `n \<noteq> 0` obtain n' where n': "n = Suc n'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   838
      by (cases n) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   839
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   840
    def rot \<equiv> "\<lambda>i. case i of 0 \<Rightarrow> n' | Suc i \<Rightarrow> i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   841
    let ?upd = "upd \<circ> rot"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   842
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   843
    have rot: "bij_betw rot {..< n} {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   844
      by (auto simp: bij_betw_def inj_on_def image_iff Bex_def rot_def n' split: nat.splits)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   845
         arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   846
    from rot upd have "bij_betw ?upd {..<n} {..<n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   847
      by (rule bij_betw_trans)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   848
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   849
    def b \<equiv> "base (upd n' := base (upd n') - 1)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   850
    def f' \<equiv> "\<lambda>i j. if j \<in> ?upd`{..< i} then Suc (b j) else b j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   851
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   852
    interpret b: kuhn_simplex p n b "upd \<circ> rot" "f' ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   853
    proof
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   854
      { fix i assume "n \<le> i" then show "b i = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   855
          using base_out[of i] upd_space[of n'] by (auto simp: b_def n') }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   856
      show "b \<in> {..<n} \<rightarrow> {..<p}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   857
        using base `n \<noteq> 0` upd_space[of n']
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   858
        by (auto simp: b_def PiE_def Pi_iff Ball_def upd_space extensional_def n')
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   859
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   860
      show "bij_betw ?upd {..<n} {..<n}" by fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   861
    qed (simp add: f'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   862
    have f': "b.enum = f'" unfolding f'_def b.enum_def[abs_def] ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   863
    have ks_f': "ksimplex p n (b.enum ` {.. n})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   864
      unfolding f' by rule unfold_locales
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   865
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   866
    have "0 < n" 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   867
      using `n \<noteq> 0` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   868
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   869
    { from `a = enum i` `n \<noteq> 0` `i = n` lb upd_space[of n']
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   870
      obtain i' where "i' \<le> n" "enum i' \<noteq> enum n" "0 < enum i' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   871
        unfolding s_eq by (auto simp: enum_inj n')
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   872
      moreover have "enum i' (upd n') = base (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   873
        unfolding enum_def using `i' \<le> n` `enum i' \<noteq> enum n` by (auto simp: n' upd_inj enum_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   874
      ultimately have "0 < base (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   875
        by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   876
    then have benum1: "b.enum (Suc 0) = base"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   877
      unfolding b.enum_Suc[OF `0<n`] b.enum_0 by (auto simp: b_def rot_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   878
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   879
    have [simp]: "\<And>j. Suc j < n \<Longrightarrow> rot ` {..< Suc j} = {n'} \<union> {..< j}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   880
      by (auto simp: rot_def image_iff Ball_def split: nat.splits)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   881
    have rot_simps: "\<And>j. rot (Suc j) = j" "rot 0 = n'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   882
      by (simp_all add: rot_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   883
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   884
    { fix j assume j: "Suc j \<le> n" then have "b.enum (Suc j) = enum j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   885
        by (induct j) (auto simp add: benum1 enum_0 b.enum_Suc enum_Suc rot_simps) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   886
    note b_enum_eq_enum = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   887
    then have "enum ` {..< n} = b.enum ` Suc ` {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   888
      by (auto simp add: image_comp intro!: image_cong)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   889
    also have "Suc ` {..< n} = {.. n} - {0}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   890
      by (auto simp: image_iff Ball_def) arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   891
    also have "{..< n} = {.. n} - {n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   892
      by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   893
    finally have eq: "s - {a} = b.enum ` {.. n} - {b.enum 0}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   894
      unfolding s_eq `a = enum i` `i = n`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   895
      using inj_on_image_set_diff[OF inj_enum order_refl, of "{n}"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   896
            inj_on_image_set_diff[OF b.inj_enum order_refl, of "{0}"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   897
      by (simp add: comp_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   898
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   899
    have "b.enum 0 \<le> b.enum n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   900
      by (simp add: b.enum_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   901
    also have "b.enum n < enum n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   902
      using `n \<noteq> 0` by (simp add: enum_strict_mono b_enum_eq_enum n')
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   903
    finally have "a \<noteq> b.enum 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   904
      using `a = enum i` `i = n` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   905
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   906
    { fix t c assume "ksimplex p n t" "c \<in> t" and eq_sma: "s - {a} = t - {c}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   907
      obtain b' u where "kuhn_simplex p n b' u t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   908
        using `ksimplex p n t` by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   909
      then interpret t: kuhn_simplex p n b' u t .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   910
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   911
      { fix x assume "x \<in> s" "x \<noteq> a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   912
         then have "x (upd n') = enum n' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   913
           by (auto simp: `a = enum i` n' `i = n` s_eq enum_def enum_inj in_upd_image) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   914
      then have eq_upd0: "\<forall>x\<in>t-{c}. x (upd n') = enum n' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   915
        unfolding eq_sma[symmetric] by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   916
      then have "c (upd n') \<noteq> enum n' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   917
        using `n \<noteq> 0` by (intro t.one_step[OF `c\<in>t` ]) (auto simp: n' upd_space[unfolded n'])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   918
      then have "c (upd n') < enum n' (upd n') \<or> c (upd n') > enum n' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   919
        by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   920
      then have "t = s \<or> t = b.enum ` {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   921
      proof (elim disjE conjE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   922
        assume *: "c (upd n') > enum n' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   923
        interpret st: kuhn_simplex_pair p n base upd s b' u t ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   924
        { fix x assume "x \<in> t" with * `c\<in>t` eq_upd0[rule_format, of x] have "x \<le> c"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   925
            by (auto simp: le_less intro!: t.less[of _ _ "upd n'"]) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   926
        note top = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   927
        have "s = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   928
          using `a = enum i` `i = n` `c \<in> t`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   929
          by (intro st.ksimplex_eq_top[OF _ _ _ _ eq_sma])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   930
             (auto simp: s_eq enum_mono t.s_eq t.enum_mono top)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   931
        then show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   932
      next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   933
        assume *: "c (upd n') < enum n' (upd n')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   934
        interpret st: kuhn_simplex_pair p n b "upd \<circ> rot" "f' ` {.. n}" b' u t ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   935
        have eq: "f' ` {..n} - {b.enum 0} = t - {c}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   936
          using eq_sma eq f' by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   937
        { fix x assume "x \<in> t" with * `c\<in>t` eq_upd0[rule_format, of x] have "c \<le> x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   938
            by (auto simp: le_less intro!: t.less[of _ _ "upd n'"]) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   939
        note bot = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   940
        have "f' ` {..n} = t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   941
          using `a = enum i` `i = n` `c \<in> t`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   942
          by (intro st.ksimplex_eq_bot[OF _ _ _ _ eq])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   943
             (auto simp: b.s_eq b.enum_mono t.s_eq t.enum_mono bot)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   944
        with f' show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   945
      qed }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   946
    with ks_f' eq `a \<noteq> b.enum 0` `n \<noteq> 0` show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   947
      apply (intro ex1I[of _ "b.enum ` {.. n}"])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   948
      apply auto []
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   949
      apply metis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   950
      done
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   951
  next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   952
    assume i: "0 < i" "i < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   953
    def i' \<equiv> "i - 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   954
    with i have "Suc i' < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   955
      by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   956
    with i have Suc_i': "Suc i' = i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   957
      by (simp add: i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   958
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   959
    let ?upd = "Fun.swap i' i upd"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   960
    from i upd have "bij_betw ?upd {..< n} {..< n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   961
      by (subst bij_betw_swap_iff) (auto simp: i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   962
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   963
    def f' \<equiv> "\<lambda>i j. if j \<in> ?upd`{..< i} then Suc (base j) else base j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   964
    interpret b: kuhn_simplex p n base ?upd "f' ` {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   965
    proof
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   966
      show "base \<in> {..<n} \<rightarrow> {..<p}" by fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   967
      { fix i assume "n \<le> i" then show "base i = p" by fact }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   968
      show "bij_betw ?upd {..<n} {..<n}" by fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   969
    qed (simp add: f'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   970
    have f': "b.enum = f'" unfolding f'_def b.enum_def[abs_def] ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   971
    have ks_f': "ksimplex p n (b.enum ` {.. n})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   972
      unfolding f' by rule unfold_locales
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   973
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   974
    have "{i} \<subseteq> {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   975
      using i by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   976
    { fix j assume "j \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   977
      moreover have "j < i \<or> i = j \<or> i < j" by arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   978
      moreover note i
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   979
      ultimately have "enum j = b.enum j \<longleftrightarrow> j \<noteq> i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   980
        unfolding enum_def[abs_def] b.enum_def[abs_def]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   981
        by (auto simp add: fun_eq_iff swap_image i'_def
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   982
                           in_upd_image inj_on_image_set_diff[OF inj_upd]) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   983
    note enum_eq_benum = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   984
    then have "enum ` ({.. n} - {i}) = b.enum ` ({.. n} - {i})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   985
      by (intro image_cong) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   986
    then have eq: "s - {a} = b.enum ` {.. n} - {b.enum i}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   987
      unfolding s_eq `a = enum i`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   988
      using inj_on_image_set_diff[OF inj_enum order_refl `{i} \<subseteq> {..n}`]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   989
            inj_on_image_set_diff[OF b.inj_enum order_refl `{i} \<subseteq> {..n}`]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   990
      by (simp add: comp_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   991
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   992
    have "a \<noteq> b.enum i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   993
      using `a = enum i` enum_eq_benum i by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   994
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   995
    { fix t c assume "ksimplex p n t" "c \<in> t" and eq_sma: "s - {a} = t - {c}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   996
      obtain b' u where "kuhn_simplex p n b' u t"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   997
        using `ksimplex p n t` by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   998
      then interpret t: kuhn_simplex p n b' u t .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
   999
      have "enum i' \<in> s - {a}" "enum (i + 1) \<in> s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1000
        using `a = enum i` i enum_in by (auto simp: enum_inj i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1001
      then obtain l k where
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1002
        l: "t.enum l = enum i'" "l \<le> n" "t.enum l \<noteq> c" and
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1003
        k: "t.enum k = enum (i + 1)" "k \<le> n" "t.enum k \<noteq> c"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1004
        unfolding eq_sma by (auto simp: t.s_eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1005
      with i have "t.enum l < t.enum k"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1006
        by (simp add: enum_strict_mono i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1007
      with `l \<le> n` `k \<le> n` have "l < k"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1008
        by (simp add: t.enum_strict_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1009
      { assume "Suc l = k"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1010
        have "enum (Suc (Suc i')) = t.enum (Suc l)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1011
          using i by (simp add: k `Suc l = k` i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1012
        then have False
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1013
          using `l < k` `k \<le> n` `Suc i' < n`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1014
          by (auto simp: t.enum_Suc enum_Suc l upd_inj fun_eq_iff split: split_if_asm)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1015
             (metis Suc_lessD n_not_Suc_n upd_inj) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1016
      with `l < k` have "Suc l < k"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1017
        by arith
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1018
      have c_eq: "c = t.enum (Suc l)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1019
      proof (rule ccontr)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1020
        assume "c \<noteq> t.enum (Suc l)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1021
        then have "t.enum (Suc l) \<in> s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1022
          using `l < k` `k \<le> n` by (simp add: t.s_eq eq_sma)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1023
        then obtain j where "t.enum (Suc l) = enum j" "j \<le> n" "enum j \<noteq> enum i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1024
          unfolding s_eq `a = enum i` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1025
        with i have "t.enum (Suc l) \<le> t.enum l \<or> t.enum k \<le> t.enum (Suc l)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1026
          by (auto simp add: i'_def enum_mono enum_inj l k)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1027
        with `Suc l < k` `k \<le> n` show False
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1028
          by (simp add: t.enum_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1029
      qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1030
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1031
      { have "t.enum (Suc (Suc l)) \<in> s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1032
          unfolding eq_sma c_eq t.s_eq using `Suc l < k` `k \<le> n` by (auto simp: t.enum_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1033
        then obtain j where eq: "t.enum (Suc (Suc l)) = enum j" and "j \<le> n" "j \<noteq> i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1034
          by (auto simp: s_eq `a = enum i`)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1035
        moreover have "enum i' < t.enum (Suc (Suc l))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1036
          unfolding l(1)[symmetric] using `Suc l < k` `k \<le> n` by (auto simp: t.enum_strict_mono)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1037
        ultimately have "i' < j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1038
          using i by (simp add: enum_strict_mono i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1039
        with `j \<noteq> i` `j \<le> n` have "t.enum k \<le> t.enum (Suc (Suc l))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1040
          unfolding i'_def by (simp add: enum_mono k eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1041
        then have "k \<le> Suc (Suc l)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1042
          using `k \<le> n` `Suc l < k` by (simp add: t.enum_mono) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1043
      with `Suc l < k` have "Suc (Suc l) = k" by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1044
      then have "enum (Suc (Suc i')) = t.enum (Suc (Suc l))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1045
        using i by (simp add: k i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1046
      also have "\<dots> = (enum i') (u l := Suc (enum i' (u l)), u (Suc l) := Suc (enum i' (u (Suc l))))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1047
        using `Suc l < k` `k \<le> n` by (simp add: t.enum_Suc l t.upd_inj)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1048
      finally have "(u l = upd i' \<and> u (Suc l) = upd (Suc i')) \<or> 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1049
        (u l = upd (Suc i') \<and> u (Suc l) = upd i')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1050
        using `Suc i' < n` by (auto simp: enum_Suc fun_eq_iff split: split_if_asm)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1051
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1052
      then have "t = s \<or> t = b.enum ` {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1053
      proof (elim disjE conjE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1054
        assume u: "u l = upd i'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1055
        have "c = t.enum (Suc l)" unfolding c_eq ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1056
        also have "t.enum (Suc l) = enum (Suc i')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1057
          using u `l < k` `k \<le> n` `Suc i' < n` by (simp add: enum_Suc t.enum_Suc l)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1058
        also have "\<dots> = a"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1059
          using `a = enum i` i by (simp add: i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1060
        finally show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1061
          using eq_sma `a \<in> s` `c \<in> t` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1062
      next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1063
        assume u: "u l = upd (Suc i')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1064
        def B \<equiv> "b.enum ` {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1065
        have "b.enum i' = enum i'"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1066
          using enum_eq_benum[of i'] i by (auto simp add: i'_def gr0_conv_Suc)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1067
        have "c = t.enum (Suc l)" unfolding c_eq ..
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1068
        also have "t.enum (Suc l) = b.enum (Suc i')"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1069
          using u `l < k` `k \<le> n` `Suc i' < n`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1070
          by (simp_all add: enum_Suc t.enum_Suc l b.enum_Suc `b.enum i' = enum i'` swap_apply1)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1071
             (simp add: Suc_i')
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1072
        also have "\<dots> = b.enum i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1073
          using i by (simp add: i'_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1074
        finally have "c = b.enum i" .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1075
        then have "t - {c} = B - {c}" "c \<in> B"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1076
          unfolding eq_sma[symmetric] eq B_def using i by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1077
        with `c \<in> t` have "t = B"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1078
          by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1079
        then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1080
          by (simp add: B_def)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1081
      qed }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1082
    with ks_f' eq `a \<noteq> b.enum i` `n \<noteq> 0` `i \<le> n` show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1083
      apply (intro ex1I[of _ "b.enum ` {.. n}"])
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1084
      apply auto []
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1085
      apply metis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1086
      done
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1087
  qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1088
  then show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1089
    using s `a \<in> s` by (simp add: card_2_exists Ex1_def) metis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1090
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1091
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1092
text {* Hence another step towards concreteness. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1093
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1094
lemma kuhn_simplex_lemma:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1095
  assumes "\<forall>s. ksimplex p (Suc n) s \<longrightarrow> rl ` s \<subseteq> {.. Suc n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1096
    and "odd (card {f. \<exists>s a. ksimplex p (Suc n) s \<and> a \<in> s \<and> (f = s - {a}) \<and>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1097
      rl ` f = {..n} \<and> ((\<exists>j\<le>n. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<le>n. \<forall>x\<in>f. x j = p))})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1098
  shows "odd (card {s. ksimplex p (Suc n) s \<and> rl ` s = {..Suc n}})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1099
proof (rule kuhn_complete_lemma[OF finite_ksimplexes refl, unfolded mem_Collect_eq,
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1100
    where bnd="\<lambda>f. (\<exists>j\<in>{..n}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{..n}. \<forall>x\<in>f. x j = p)"],
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1101
    safe del: notI)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1102
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1103
  have *: "\<And>x y. x = y \<Longrightarrow> odd (card x) \<Longrightarrow> odd (card y)"
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1104
    by auto
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1105
  show "odd (card {f. (\<exists>s\<in>{s. ksimplex p (Suc n) s}. \<exists>a\<in>s. f = s - {a}) \<and>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1106
    rl ` f = {..n} \<and> ((\<exists>j\<in>{..n}. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<in>{..n}. \<forall>x\<in>f. x j = p))})"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1107
    apply (rule *[OF _ assms(2)])
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1108
    apply (auto simp: atLeast0AtMost)
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1109
    done
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1110
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1111
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1112
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1113
  fix s assume s: "ksimplex p (Suc n) s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1114
  then show "card s = n + 2"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1115
    by (simp add: ksimplex_card)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1116
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1117
  fix a assume a: "a \<in> s" then show "rl a \<le> Suc n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1118
    using assms(1) s by (auto simp: subset_eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1119
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1120
  let ?S = "{t. ksimplex p (Suc n) t \<and> (\<exists>b\<in>t. s - {a} = t - {b})}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1121
  { fix j assume j: "j \<le> n" "\<forall>x\<in>s - {a}. x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1122
    with s a show "card ?S = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1123
      using ksimplex_replace_0[of p "n + 1" s a j]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1124
      by (subst eq_commute) simp }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1125
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1126
  { fix j assume j: "j \<le> n" "\<forall>x\<in>s - {a}. x j = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1127
    with s a show "card ?S = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1128
      using ksimplex_replace_1[of p "n + 1" s a j]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1129
      by (subst eq_commute) simp }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1130
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1131
  { assume "card ?S \<noteq> 2" "\<not> (\<exists>j\<in>{..n}. \<forall>x\<in>s - {a}. x j = p)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1132
    with s a show "\<exists>j\<in>{..n}. \<forall>x\<in>s - {a}. x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1133
      using ksimplex_replace_2[of p "n + 1" s a]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1134
      by (subst (asm) eq_commute) auto }
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1135
qed
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1136
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1137
subsection {* Reduced labelling *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1138
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1139
definition reduced :: "nat \<Rightarrow> (nat \<Rightarrow> nat) \<Rightarrow> nat" where "reduced n x = (LEAST k. k = n \<or> x k \<noteq> 0)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1140
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1141
lemma reduced_labelling:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1142
  shows "reduced n x \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1143
    and "\<forall>i<reduced n x. x i = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1144
    and "reduced n x = n \<or> x (reduced n x) \<noteq> 0"
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1145
proof -
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1146
  show "reduced n x \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1147
    unfolding reduced_def by (rule LeastI2_wellorder[where a=n]) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1148
  show "\<forall>i<reduced n x. x i = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1149
    unfolding reduced_def by (rule LeastI2_wellorder[where a=n]) fastforce+
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1150
  show "reduced n x = n \<or> x (reduced n x) \<noteq> 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1151
    unfolding reduced_def by (rule LeastI2_wellorder[where a=n]) fastforce+
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1152
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1153
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1154
lemma reduced_labelling_unique:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1155
  "r \<le> n \<Longrightarrow> \<forall>i<r. x i = 0 \<Longrightarrow> r = n \<or> x r \<noteq> 0 \<Longrightarrow> reduced n x = r"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1156
 unfolding reduced_def by (rule LeastI2_wellorder[where a=n]) (metis le_less not_le)+
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1157
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1158
lemma reduced_labelling_zero: "j < n \<Longrightarrow> x j = 0 \<Longrightarrow> reduced n x \<noteq> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1159
  using reduced_labelling[of n x] 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
  1160
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1161
lemma reduce_labelling_zero[simp]: "reduced 0 x = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1162
  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
  1163
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1164
lemma reduced_labelling_nonzero: "j < n \<Longrightarrow> x j \<noteq> 0 \<Longrightarrow> reduced n x \<le> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1165
  using reduced_labelling[of n x] by (elim allE[where x=j]) auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1166
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1167
lemma reduced_labelling_Suc: "reduced (Suc n) x \<noteq> Suc n \<Longrightarrow> reduced (Suc n) x = reduced n x"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1168
  using reduced_labelling[of "Suc n" x]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1169
  by (intro reduced_labelling_unique[symmetric]) auto
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1170
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1171
lemma complete_face_top:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1172
  assumes "\<forall>x\<in>f. \<forall>j\<le>n. x j = 0 \<longrightarrow> lab x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1173
    and "\<forall>x\<in>f. \<forall>j\<le>n. x j = p \<longrightarrow> lab x j = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1174
    and eq: "(reduced (Suc n) \<circ> lab) ` f = {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1175
  shows "((\<exists>j\<le>n. \<forall>x\<in>f. x j = 0) \<or> (\<exists>j\<le>n. \<forall>x\<in>f. x j = p)) \<longleftrightarrow> (\<forall>x\<in>f. x n = p)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1176
proof (safe del: disjCI)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1177
  fix x j assume j: "j \<le> n" "\<forall>x\<in>f. x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1178
  { fix x assume "x \<in> f" with assms j have "reduced (Suc n) (lab x) \<noteq> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1179
      by (intro reduced_labelling_zero) auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1180
  moreover have "j \<in> (reduced (Suc n) \<circ> lab) ` f"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1181
    using j eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1182
  ultimately show "x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1183
    by force
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1184
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1185
  fix x j assume j: "j \<le> n" "\<forall>x\<in>f. x j = p" and x: "x \<in> f"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1186
  have "j = n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1187
  proof (rule ccontr)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1188
    assume "\<not> ?thesis"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1189
    { fix x assume "x \<in> f"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1190
      with assms j have "reduced (Suc n) (lab x) \<le> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1191
        by (intro reduced_labelling_nonzero) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1192
      then have "reduced (Suc n) (lab x) \<noteq> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1193
        using `j \<noteq> n` `j \<le> n` by simp }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1194
    moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1195
    have "n \<in> (reduced (Suc n) \<circ> lab) ` f" 
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1196
      using eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1197
    ultimately show False
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1198
      by force
53186
0f4d9df1eaec tuned proofs;
wenzelm
parents: 53185
diff changeset
  1199
  qed
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1200
  moreover have "j \<in> (reduced (Suc n) \<circ> lab) ` f"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1201
    using j eq by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1202
  ultimately show "x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1203
    using j x by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1204
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
  1205
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1206
text {* Hence we get just about the nice induction. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1207
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1208
lemma kuhn_induction:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1209
  assumes "0 < p"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1210
    and lab_0: "\<forall>x. \<forall>j\<le>n. (\<forall>j. x j \<le> p) \<and> x j = 0 \<longrightarrow> lab x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1211
    and lab_1: "\<forall>x. \<forall>j\<le>n. (\<forall>j. x j \<le> p) \<and> x j = p \<longrightarrow> lab x j = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1212
    and odd: "odd (card {s. ksimplex p n s \<and> (reduced n\<circ>lab) ` s = {..n}})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1213
  shows "odd (card {s. ksimplex p (Suc n) s \<and> (reduced (Suc n)\<circ>lab) ` s = {..Suc n}})"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1214
proof -
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1215
  let ?rl = "reduced (Suc n) \<circ> lab" and ?ext = "\<lambda>f v. \<exists>j\<le>n. \<forall>x\<in>f. x j = v"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1216
  let ?ext = "\<lambda>s. (\<exists>j\<le>n. \<forall>x\<in>s. x j = 0) \<or> (\<exists>j\<le>n. \<forall>x\<in>s. x j = p)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1217
  have "\<forall>s. ksimplex p (Suc n) s \<longrightarrow> ?rl ` s \<subseteq> {..Suc n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1218
    by (simp add: reduced_labelling subset_eq)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1219
  moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1220
  have "{s. ksimplex p n s \<and> (reduced n \<circ> lab) ` s = {..n}} =
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1221
        {f. \<exists>s a. ksimplex p (Suc n) s \<and> a \<in> s \<and> f = s - {a} \<and> ?rl ` f = {..n} \<and> ?ext f}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1222
  proof (intro set_eqI, safe del: disjCI equalityI disjE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1223
    fix s assume s: "ksimplex p n s" and rl: "(reduced n \<circ> lab) ` s = {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1224
    from s obtain u b where "kuhn_simplex p n u b s" by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1225
    then interpret kuhn_simplex p n u b s .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1226
    have all_eq_p: "\<forall>x\<in>s. x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1227
      by (auto simp: out_eq_p)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1228
    moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1229
    { fix x assume "x \<in> s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1230
      with lab_1[rule_format, of n x] all_eq_p s_le_p[of x]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1231
      have "?rl x \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1232
        by (auto intro!: reduced_labelling_nonzero)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1233
      then have "?rl x = reduced n (lab x)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1234
        by (auto intro!: reduced_labelling_Suc) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1235
    then have "?rl ` s = {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1236
      using rl by (simp cong: image_cong)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1237
    moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1238
    obtain t a where "ksimplex p (Suc n) t" "a \<in> t" "s = t - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1239
      using s unfolding simplex_top_face[OF `0 < p` all_eq_p] by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1240
    ultimately
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1241
    show "\<exists>t a. ksimplex p (Suc n) t \<and> a \<in> t \<and> s = t - {a} \<and> ?rl ` s = {..n} \<and> ?ext s"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1242
      by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1243
  next
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1244
    fix x s a assume s: "ksimplex p (Suc n) s" and rl: "?rl ` (s - {a}) = {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1245
      and a: "a \<in> s" and "?ext (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1246
    from s obtain u b where "kuhn_simplex p (Suc n) u b s" by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1247
    then interpret kuhn_simplex p "Suc n" u b s .
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1248
    have all_eq_p: "\<forall>x\<in>s. x (Suc n) = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1249
      by (auto simp: out_eq_p)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1250
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1251
    { fix x assume "x \<in> s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1252
      then have "?rl x \<in> ?rl ` (s - {a})"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1253
        by auto
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1254
      then have "?rl x \<le> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1255
        unfolding rl by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1256
      then have "?rl x = reduced n (lab x)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1257
        by (auto intro!: reduced_labelling_Suc) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1258
    then show rl': "(reduced n\<circ>lab) ` (s - {a}) = {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1259
      unfolding rl[symmetric] by (intro image_cong) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1260
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1261
    from `?ext (s - {a})`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1262
    have all_eq_p: "\<forall>x\<in>s - {a}. x n = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1263
    proof (elim disjE exE conjE)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1264
      fix j assume "j \<le> n" "\<forall>x\<in>s - {a}. x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1265
      with lab_0[rule_format, of j] all_eq_p s_le_p
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1266
      have "\<And>x. x \<in> s - {a} \<Longrightarrow> reduced (Suc n) (lab x) \<noteq> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1267
        by (intro reduced_labelling_zero) auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1268
      moreover have "j \<in> ?rl ` (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1269
        using `j \<le> n` unfolding rl by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1270
      ultimately show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1271
        by force
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1272
    next
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1273
      fix j assume "j \<le> n" and eq_p: "\<forall>x\<in>s - {a}. x j = p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1274
      show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1275
      proof cases
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1276
        assume "j = n" with eq_p show ?thesis by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1277
      next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1278
        assume "j \<noteq> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1279
        { fix x assume x: "x \<in> s - {a}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1280
          have "reduced n (lab x) \<le> j"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1281
          proof (rule reduced_labelling_nonzero)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1282
            show "lab x j \<noteq> 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1283
              using lab_1[rule_format, of j x] x s_le_p[of x] eq_p `j \<le> n` by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1284
            show "j < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1285
              using `j \<le> n` `j \<noteq> n` by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1286
          qed
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1287
          then have "reduced n (lab x) \<noteq> n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1288
            using `j \<le> n` `j \<noteq> n` by simp }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1289
        moreover have "n \<in> (reduced n\<circ>lab) ` (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1290
          unfolding rl' by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1291
        ultimately show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1292
          by force
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1293
      qed
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1294
    qed
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1295
    show "ksimplex p n (s - {a})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1296
      unfolding simplex_top_face[OF `0 < p` all_eq_p] using s a by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1297
  qed
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1298
  ultimately show ?thesis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1299
    using assms by (intro kuhn_simplex_lemma) auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1300
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1301
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1302
text {* And so we get the final combinatorial result. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1303
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1304
lemma ksimplex_0: "ksimplex p 0 s \<longleftrightarrow> s = {(\<lambda>x. p)}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1305
proof
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1306
  assume "ksimplex p 0 s" then show "s = {(\<lambda>x. p)}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1307
    by (blast dest: kuhn_simplex.ksimplex_0 elim: ksimplex.cases)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1308
next
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1309
  assume s: "s = {(\<lambda>x. p)}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1310
  show "ksimplex p 0 s"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1311
  proof (intro ksimplex, unfold_locales)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1312
    show "(\<lambda>_. p) \<in> {..<0::nat} \<rightarrow> {..<p}" by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1313
    show "bij_betw id {..<0} {..<0}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1314
      by simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1315
  qed (auto simp: s)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1316
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1317
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1318
lemma kuhn_combinatorial:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1319
  assumes "0 < p"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1320
    and "\<forall>x j. (\<forall>j. x j \<le> p) \<and> j < n \<and> x j = 0 \<longrightarrow> lab x j = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1321
    and "\<forall>x j. (\<forall>j. x j \<le> p) \<and> j < n  \<and> x j = p \<longrightarrow> lab x j = 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1322
  shows "odd (card {s. ksimplex p n s \<and> (reduced n\<circ>lab) ` s = {..n}})"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1323
    (is "odd (card (?M n))")
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1324
  using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1325
proof (induct n)
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1326
  case 0 then show ?case
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1327
    by (simp add: ksimplex_0 cong: conj_cong)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1328
next
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1329
  case (Suc n)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1330
  then have "odd (card (?M n))"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1331
    by force
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1332
  with Suc show ?case
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1333
    using kuhn_induction[of p n] by (auto simp: comp_def)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1334
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1335
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1336
lemma kuhn_lemma:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1337
  fixes n p :: nat
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1338
  assumes "0 < p"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1339
    and "\<forall>x. (\<forall>i<n. x i \<le> p) \<longrightarrow> (\<forall>i<n. label x i = (0::nat) \<or> label x i = 1)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1340
    and "\<forall>x. (\<forall>i<n. x i \<le> p) \<longrightarrow> (\<forall>i<n. x i = 0 \<longrightarrow> label x i = 0)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1341
    and "\<forall>x. (\<forall>i<n. x i \<le> p) \<longrightarrow> (\<forall>i<n. x i = p \<longrightarrow> label x i = 1)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1342
  obtains q where "\<forall>i<n. q i < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1343
    and "\<forall>i<n. \<exists>r s. (\<forall>j<n. q j \<le> r j \<and> r j \<le> q j + 1) \<and> (\<forall>j<n. q j \<le> s j \<and> s j \<le> q j + 1) \<and> label r i \<noteq> label s i"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1344
proof -
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1345
  let ?rl = "reduced n\<circ>label"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1346
  let ?A = "{s. ksimplex p n s \<and> ?rl ` s = {..n}}"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1347
  have "odd (card ?A)"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1348
    using assms by (intro kuhn_combinatorial[of p n label]) auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1349
  then have "?A \<noteq> {}"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1350
    by (intro notI) simp
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1351
  then obtain s b u where "kuhn_simplex p n b u s" and rl: "?rl ` s = {..n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1352
    by (auto elim: ksimplex.cases)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1353
  interpret kuhn_simplex p n b u s by fact
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1354
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1355
  show ?thesis
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1356
  proof (intro that[of b] allI impI)
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1357
    fix i assume "i < n" then show "b i < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1358
      using base by auto
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1359
  next
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1360
    case goal2
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1361
    then have "i \<in> {.. n}" "Suc i \<in> {.. n}"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1362
      by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1363
    then obtain u v where u: "u \<in> s" "Suc i = ?rl u" and v: "v \<in> s" "i = ?rl v"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1364
      unfolding rl[symmetric] by blast
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1365
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1366
    have "label u i \<noteq> label v i"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1367
      using reduced_labelling [of n "label u"] reduced_labelling [of n "label v"]
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1368
        u(2)[symmetric] v(2)[symmetric] `i < n`
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1369
      by auto
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1370
    moreover
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1371
    { fix j assume "j < n"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1372
      then have "b j \<le> u j" "u j \<le> b j + 1" "b j \<le> v j" "v j \<le> b j + 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1373
        using base_le[OF `u\<in>s`] le_Suc_base[OF `u\<in>s`] base_le[OF `v\<in>s`] le_Suc_base[OF `v\<in>s`] by auto }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1374
    ultimately show ?case
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1375
      by blast
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1376
  qed
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1377
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1378
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1379
subsection {* The main result for the unit cube *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1380
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1381
lemma kuhn_labelling_lemma':
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1382
  assumes "(\<forall>x::nat\<Rightarrow>real. P x \<longrightarrow> P (f x))"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1383
    and "\<forall>x. P x \<longrightarrow> (\<forall>i::nat. Q i \<longrightarrow> 0 \<le> x i \<and> x i \<le> 1)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1384
  shows "\<exists>l. (\<forall>x i. l x i \<le> (1::nat)) \<and>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1385
             (\<forall>x i. P x \<and> Q i \<and> x i = 0 \<longrightarrow> l x i = 0) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1386
             (\<forall>x i. P x \<and> Q i \<and> x i = 1 \<longrightarrow> l x i = 1) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1387
             (\<forall>x i. P x \<and> Q i \<and> l x i = 0 \<longrightarrow> x i \<le> f x i) \<and>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1388
             (\<forall>x i. P x \<and> Q i \<and> l x i = 1 \<longrightarrow> f x i \<le> x i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1389
proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1390
  have and_forall_thm: "\<And>P Q. (\<forall>x. P x) \<and> (\<forall>x. Q x) \<longleftrightarrow> (\<forall>x. P x \<and> Q x)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1391
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1392
  have *: "\<forall>x y::real. 0 \<le> x \<and> x \<le> 1 \<and> 0 \<le> y \<and> y \<le> 1 \<longrightarrow> x \<noteq> 1 \<and> x \<le> y \<or> x \<noteq> 0 \<and> y \<le> x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1393
    by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1394
  show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1395
    unfolding and_forall_thm
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1396
    apply (subst choice_iff[symmetric])+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1397
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1398
    apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1399
  proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1400
    case goal1
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1401
    let ?R = "\<lambda>y::nat.
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1402
      (P x \<and> Q xa \<and> x xa = 0 \<longrightarrow> y = 0) \<and>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1403
      (P x \<and> Q xa \<and> x xa = 1 \<longrightarrow> y = 1) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1404
      (P x \<and> Q xa \<and> y = 0 \<longrightarrow> x xa \<le> (f x) xa) \<and>
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1405
      (P x \<and> Q xa \<and> y = 1 \<longrightarrow> (f x) xa \<le> x xa)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1406
    {
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1407
      assume "P x" and "Q xa"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1408
      then have "0 \<le> f x xa \<and> f x xa \<le> 1"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1409
        using assms(2)[rule_format,of "f x" xa]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1410
        apply (drule_tac assms(1)[rule_format])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1411
        apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1412
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1413
    }
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1414
    then have "?R 0 \<or> ?R 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1415
      by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1416
    then show ?case
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1417
      by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1418
  qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1419
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1420
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1421
definition unit_cube :: "'a::euclidean_space set"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1422
  where "unit_cube = {x. \<forall>i\<in>Basis. 0 \<le> x \<bullet> i \<and> x \<bullet> i \<le> 1}"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1423
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1424
lemma mem_unit_cube: "x \<in> unit_cube \<longleftrightarrow> (\<forall>i\<in>Basis. 0 \<le> x \<bullet> i \<and> x \<bullet> i \<le> 1)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1425
  unfolding unit_cube_def by simp
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1426
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1427
lemma bounded_unit_cube: "bounded unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1428
  unfolding bounded_def
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1429
proof (intro exI ballI)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1430
  fix y :: 'a assume y: "y \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1431
  have "dist 0 y = norm y" by (rule dist_0_norm)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1432
  also have "\<dots> = norm (\<Sum>i\<in>Basis. (y \<bullet> i) *\<^sub>R i)" unfolding euclidean_representation ..
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1433
  also have "\<dots> \<le> (\<Sum>i\<in>Basis. norm ((y \<bullet> i) *\<^sub>R i))" by (rule norm_setsum)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1434
  also have "\<dots> \<le> (\<Sum>i::'a\<in>Basis. 1)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1435
    by (rule setsum_mono, simp add: y [unfolded mem_unit_cube])
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1436
  finally show "dist 0 y \<le> (\<Sum>i::'a\<in>Basis. 1)" .
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1437
qed
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1438
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1439
lemma closed_unit_cube: "closed unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1440
  unfolding unit_cube_def Collect_ball_eq Collect_conj_eq
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1441
  by (rule closed_INT, auto intro!: closed_Collect_le)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1442
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1443
lemma compact_unit_cube: "compact unit_cube" (is "compact ?C")
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1444
  unfolding compact_eq_seq_compact_metric
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1445
  using bounded_unit_cube closed_unit_cube
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1446
  by (rule bounded_closed_imp_seq_compact)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1447
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
  1448
lemma brouwer_cube:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1449
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1450
  assumes "continuous_on unit_cube f"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1451
    and "f ` unit_cube \<subseteq> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1452
  shows "\<exists>x\<in>unit_cube. f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1453
proof (rule ccontr)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1454
  def n \<equiv> "DIM('a)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1455
  have n: "1 \<le> n" "0 < n" "n \<noteq> 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1456
    unfolding n_def by (auto simp add: Suc_le_eq DIM_positive)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1457
  assume "\<not> ?thesis"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1458
  then have *: "\<not> (\<exists>x\<in>unit_cube. f x - x = 0)"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1459
    by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1460
  obtain d where
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1461
      d: "d > 0" "\<And>x. x \<in> unit_cube \<Longrightarrow> d \<le> norm (f x - x)"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1462
    apply (rule brouwer_compactness_lemma[OF compact_unit_cube _ *])
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1463
    apply (rule continuous_on_intros assms)+
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1464
    apply blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1465
    done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1466
  have *: "\<forall>x. x \<in> unit_cube \<longrightarrow> f x \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1467
    "\<forall>x. x \<in> (unit_cube::'a set) \<longrightarrow> (\<forall>i\<in>Basis. True \<longrightarrow> 0 \<le> x \<bullet> i \<and> x \<bullet> i \<le> 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1468
    using assms(2)[unfolded image_subset_iff Ball_def]
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1469
    unfolding mem_unit_cube
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1470
    by auto
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1471
  obtain label :: "'a \<Rightarrow> 'a \<Rightarrow> nat" where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1472
    "\<forall>x. \<forall>i\<in>Basis. label x i \<le> 1"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1473
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> x \<bullet> i = 0 \<longrightarrow> label x i = 0"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1474
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> x \<bullet> i = 1 \<longrightarrow> label x i = 1"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1475
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> label x i = 0 \<longrightarrow> x \<bullet> i \<le> f x \<bullet> i"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1476
    "\<forall>x. \<forall>i\<in>Basis. x \<in> unit_cube \<and> True \<and> label x i = 1 \<longrightarrow> f x \<bullet> i \<le> x \<bullet> i"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1477
    using kuhn_labelling_lemma[OF *] by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1478
  note label = this [rule_format]
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1479
  have lem1: "\<forall>x\<in>unit_cube. \<forall>y\<in>unit_cube. \<forall>i\<in>Basis. label x i \<noteq> label y i \<longrightarrow>
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1480
    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
  1481
  proof safe
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1482
    fix x y :: 'a
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1483
    assume x: "x \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1484
    assume y: "y \<in> unit_cube"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1485
    fix i
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1486
    assume i: "label x i \<noteq> label y i" "i \<in> Basis"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1487
    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
  1488
      abs (fx - x) \<le> abs (fy - fx) + abs (y - x)" by auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1489
    have "\<bar>(f x - x) \<bullet> i\<bar> \<le> abs ((f y - f x)\<bullet>i) + abs ((y - x)\<bullet>i)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50514
diff changeset
  1490
      unfolding inner_simps
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1491
      apply (rule *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1492
      apply (cases "label x i = 0")
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1493
      apply (rule disjI1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1494
      apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1495
      prefer 3
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1496
      apply (rule disjI2)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1497
      apply rule
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1498
    proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1499
      assume lx: "label x i = 0"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1500
      then have ly: "label y i = 1"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1501
        using i label(1)[of i y]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1502
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1503
      show "x \<bullet> i \<le> f x \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1504
        apply (rule label(4)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1505
        using x y lx i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1506
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1507
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1508
      show "f y \<bullet> i \<le> y \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1509
        apply (rule label(5)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1510
        using x y ly i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1511
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1512
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1513
    next
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1514
      assume "label x i \<noteq> 0"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1515
      then have l: "label x i = 1" "label y i = 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1516
        using i label(1)[of i x] label(1)[of i y]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1517
        by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1518
      show "f x \<bullet> i \<le> x \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1519
        apply (rule label(5)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1520
        using x y l i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1521
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1522
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1523
      show "y \<bullet> i \<le> f y \<bullet> i"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1524
        apply (rule label(4)[rule_format])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1525
        using x y l i(2)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1526
        apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1527
        done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1528
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1529
    also have "\<dots> \<le> norm (f y - f x) + norm (y - x)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1530
      apply (rule add_mono)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1531
      apply (rule Basis_le_norm[OF i(2)])+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1532
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1533
    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
  1534
      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
  1535
  qed
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1536
  have "\<exists>e>0. \<forall>x\<in>unit_cube. \<forall>y\<in>unit_cube. \<forall>z\<in>unit_cube. \<forall>i\<in>Basis.
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1537
    norm (x - z) < e \<and> norm (y - z) < e \<and> label x i \<noteq> label y i \<longrightarrow>
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1538
      abs ((f(z) - z)\<bullet>i) < d / (real n)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1539
  proof -
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1540
    have d': "d / real n / 8 > 0"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1541
      apply (rule divide_pos_pos)+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1542
      using d(1)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1543
      unfolding n_def
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1544
      apply (auto simp:  DIM_positive)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1545
      done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1546
    have *: "uniformly_continuous_on unit_cube f"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1547
      by (rule compact_uniformly_continuous[OF assms(1) compact_unit_cube])
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1548
    obtain e where e:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1549
        "e > 0"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1550
        "\<And>x x'. x \<in> unit_cube \<Longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1551
          x' \<in> unit_cube \<Longrightarrow>
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1552
          norm (x' - x) < e \<Longrightarrow>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1553
          norm (f x' - f x) < d / real n / 8"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1554
      using *[unfolded uniformly_continuous_on_def,rule_format,OF d']
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1555
      unfolding dist_norm
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1556
      by blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1557
    show ?thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1558
      apply (rule_tac x="min (e/2) (d/real n/8)" in exI)
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1559
      apply safe
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1560
    proof -
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1561
      show "0 < min (e / 2) (d / real n / 8)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1562
        using d' e by auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1563
      fix x y z i
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1564
      assume as:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1565
        "x \<in> unit_cube" "y \<in> unit_cube" "z \<in> unit_cube"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  1566
        "norm (x - z) < min (e / 2) (d / real n / 8)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1567
        "norm (y - z) < min (e / 2) (d / real n / 8)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1568
        "label x i \<noteq> label y i"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1569
      assume i: "i \<in> Basis"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1570
      have *: "\<And>z fz x fx n1 n2 n3 n4 d4 d :: real. abs(fx - x) \<le> n1 + n2 \<Longrightarrow>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1571
        abs (fx - fz) \<le> n3 \<Longrightarrow> abs (x - z) \<le> n4 \<Longrightarrow>
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1572
        n1 < d4 \<Longrightarrow> n2 < 2 * d4 \<Longrightarrow> n3 < d4 \<Longrightarrow> n4 < d4 \<Longrightarrow>
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1573
        (8 * d4 = d) \<Longrightarrow> abs(fz - z) < d"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1574
        by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1575
      show "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1576
        unfolding inner_simps
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1577
      proof (rule *)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1578
        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
  1579
          apply (rule lem1[rule_format])
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1580
          using as i
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1581
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1582
          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
  1583
        show "\<bar>f x \<bullet> i - f z \<bullet> i\<bar> \<le> norm (f x - f z)" "\<bar>x \<bullet> i - z \<bullet> i\<bar> \<le> norm (x - z)"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1584
          unfolding inner_diff_left[symmetric]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1585
          by (rule Basis_le_norm[OF i])+
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1586
        have tria: "norm (y - x) \<le> norm (y - z) + norm (x - z)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1587
          using dist_triangle[of y x z, unfolded dist_norm]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1588
          unfolding norm_minus_commute
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1589
          by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1590
        also have "\<dots> < e / 2 + e / 2"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1591
          apply (rule add_strict_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1592
          using as(4,5)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1593
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1594
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1595
        finally show "norm (f y - f x) < d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1596
          apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1597
          apply (rule e(2))
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1598
          using as
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1599
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1600
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1601
        have "norm (y - z) + norm (x - z) < d / real n / 8 + d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1602
          apply (rule add_strict_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1603
          using as
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1604
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1605
          done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1606
        then show "norm (y - x) < 2 * (d / real n / 8)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1607
          using tria
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1608
          by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1609
        show "norm (f x - f z) < d / real n / 8"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1610
          apply (rule e(2))
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1611
          using as e(1)
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1612
          apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1613
          done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1614
      qed (insert as, auto)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1615
    qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1616
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1617
  then
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1618
  obtain e where e:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1619
    "e > 0"
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1620
    "\<And>x y z i. x \<in> unit_cube \<Longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1621
      y \<in> unit_cube \<Longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1622
      z \<in> unit_cube \<Longrightarrow>
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1623
      i \<in> Basis \<Longrightarrow>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1624
      norm (x - z) < e \<and> norm (y - z) < e \<and> label x i \<noteq> label y i \<Longrightarrow>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1625
      \<bar>(f z - z) \<bullet> i\<bar> < d / real n"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1626
    by blast
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1627
  obtain p :: nat where p: "1 + real n / e \<le> real p"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1628
    using real_arch_simple ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1629
  have "1 + real n / e > 0"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1630
    apply (rule add_pos_pos)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1631
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1632
    apply (rule divide_pos_pos)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1633
    using e(1) n
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1634
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1635
    done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1636
  then have "p > 0"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1637
    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
  1638
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1639
  obtain b :: "nat \<Rightarrow> 'a" where b: "bij_betw b {..< n} 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
  1640
    by atomize_elim (auto simp: n_def intro!: finite_same_card_bij)
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1641
  def b' \<equiv> "inv_into {..< n} b"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1642
  then have b': "bij_betw b' Basis {..< 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
  1643
    using bij_betw_inv_into[OF b] by auto
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1644
  then have b'_Basis: "\<And>i. i \<in> Basis \<Longrightarrow> b' i \<in> {..< 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
  1645
    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
  1646
  have bb'[simp]:"\<And>i. i \<in> Basis \<Longrightarrow> b (b' i) = i"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1647
    unfolding b'_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1648
    using b
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1649
    by (auto simp: f_inv_into_f bij_betw_def)
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1650
  have b'b[simp]:"\<And>i. i < n \<Longrightarrow> b' (b i) = i"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1651
    unfolding b'_def
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1652
    using b
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1653
    by (auto simp: inv_into_f_eq bij_betw_def)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1654
  have *: "\<And>x :: nat. x = 0 \<or> x = 1 \<longleftrightarrow> x \<le> 1"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1655
    by auto
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1656
  have b'': "\<And>j. j < n \<Longrightarrow> b j \<in> Basis"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1657
    using b unfolding bij_betw_def by auto
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1658
  have q1: "0 < p" "\<forall>x. (\<forall>i<n. x i \<le> p) \<longrightarrow>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1659
    (\<forall>i<n. (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 0 \<or>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1660
           (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1661
    unfolding *
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1662
    using `p > 0` `n > 0`
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1663
    using label(1)[OF b'']
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1664
    by auto
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1665
  { fix x :: "nat \<Rightarrow> nat" and i assume "\<forall>i<n. x i \<le> p" "i < n" "x i = p \<or> x i = 0"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1666
    then have "(\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<in> (unit_cube::'a set)"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1667
      using b'_Basis
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1668
      by (auto simp add: mem_unit_cube inner_simps bij_betw_def zero_le_divide_iff divide_le_eq_1) }
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1669
  note cube = this
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1670
  have q2: "\<forall>x. (\<forall>i<n. x i \<le> p) \<longrightarrow> (\<forall>i<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
  1671
      (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 0)"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1672
    unfolding o_def using cube `p > 0` by (intro allI impI label(2)) (auto simp add: b'')
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1673
  have q3: "\<forall>x. (\<forall>i<n. x i \<le> p) \<longrightarrow> (\<forall>i<n. x i = 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
  1674
      (label (\<Sum>i\<in>Basis. (real (x (b' i)) / real p) *\<^sub>R i) \<circ> b) i = 1)"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1675
    using cube `p > 0` unfolding o_def by (intro allI impI label(3)) (auto simp add: b'')
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1676
  obtain q where q:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1677
      "\<forall>i<n. q i < p"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1678
      "\<forall>i<n.
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1679
         \<exists>r s. (\<forall>j<n. q j \<le> r j \<and> r j \<le> q j + 1) \<and>
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1680
               (\<forall>j<n. q j \<le> s j \<and> s j \<le> q j + 1) \<and>
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1681
               (label (\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i) \<circ> b) i \<noteq>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1682
               (label (\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i) \<circ> b) i"
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1683
    by (rule kuhn_lemma[OF q1 q2 q3])
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
  1684
  def z \<equiv> "(\<Sum>i\<in>Basis. (real (q (b' i)) / real p) *\<^sub>R i)::'a"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1685
  have "\<exists>i\<in>Basis. d / real n \<le> abs ((f z - z)\<bullet>i)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1686
  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
  1687
    have "\<forall>i\<in>Basis. q (b' i) \<in> {0..p}"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1688
      using q(1) b'
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1689
      by (auto intro: less_imp_le simp: bij_betw_def)
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1690
    then have "z \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1691
      unfolding z_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1692
      using b'_Basis
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1693
      by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_1)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1694
    then have d_fz_z: "d \<le> norm (f z - z)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1695
      by (rule d)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1696
    assume "\<not> ?thesis"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1697
    then have as: "\<forall>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar> < d / real n"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1698
      using `n > 0`
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1699
      by (auto simp add: not_le inner_diff)
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
  1700
    have "norm (f z - z) \<le> (\<Sum>i\<in>Basis. \<bar>f z \<bullet> i - z \<bullet> i\<bar>)"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1701
      unfolding inner_diff_left[symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1702
      by (rule norm_le_l1)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1703
    also have "\<dots> < (\<Sum>(i::'a) \<in> Basis. d / real n)"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1704
      apply (rule setsum_strict_mono)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1705
      using as
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1706
      apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1707
      done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1708
    also have "\<dots> = d"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1709
      using DIM_positive[where 'a='a]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1710
      by (auto simp: real_eq_of_nat n_def)
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1711
    finally show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1712
      using d_fz_z by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1713
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1714
  then obtain i where i: "i \<in> Basis" "d / real n \<le> \<bar>(f z - z) \<bullet> i\<bar>" ..
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1715
  have *: "b' i < n"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1716
    using i and b'[unfolded bij_betw_def]
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1717
    by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1718
  obtain r s where rs:
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1719
    "\<And>j. j < n \<Longrightarrow> q j \<le> r j \<and> r j \<le> q j + 1"
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1720
    "\<And>j. j < n \<Longrightarrow> q j \<le> s j \<and> s j \<le> q j + 1"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1721
    "(label (\<Sum>i\<in>Basis. (real (r (b' i)) / real p) *\<^sub>R i) \<circ> b) (b' i) \<noteq>
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1722
      (label (\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i) \<circ> b) (b' i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1723
    using q(2)[rule_format,OF *] by blast
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1724
  have b'_im: "\<And>i. i \<in> Basis \<Longrightarrow>  b' i < n"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1725
    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
  1726
  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
  1727
  have "\<And>i. i \<in> Basis \<Longrightarrow> r (b' i) \<le> p"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1728
    apply (rule order_trans)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1729
    apply (rule rs(1)[OF b'_im,THEN conjunct2])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1730
    using q(1)[rule_format,OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1731
    apply (auto simp add: Suc_le_eq)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1732
    done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1733
  then have "r' \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1734
    unfolding r'_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1735
    using b'_Basis
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1736
    by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_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
  1737
  def s' \<equiv> "(\<Sum>i\<in>Basis. (real (s (b' i)) / real p) *\<^sub>R i)::'a"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1738
  have "\<And>i. i \<in> Basis \<Longrightarrow> s (b' i) \<le> p"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1739
    apply (rule order_trans)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1740
    apply (rule rs(2)[OF b'_im, THEN conjunct2])
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1741
    using q(1)[rule_format,OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1742
    apply (auto simp add: Suc_le_eq)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1743
    done
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1744
  then have "s' \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1745
    unfolding s'_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1746
    using b'_Basis
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1747
    by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_1)
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1748
  have "z \<in> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1749
    unfolding z_def mem_unit_cube
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1750
    using b'_Basis q(1)[rule_format,OF b'_im] `p > 0`
56273
def3bbe6f2a5 cleanup auxiliary proofs for Brouwer fixpoint theorem (removes ~2400 lines)
hoelzl
parents: 56226
diff changeset
  1751
    by (auto simp add: bij_betw_def zero_le_divide_iff divide_le_eq_1 less_imp_le)
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1752
  have *: "\<And>x. 1 + real x = real (Suc x)"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1753
    by auto
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1754
  {
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1755
    have "(\<Sum>i\<in>Basis. \<bar>real (r (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1756
      apply (rule setsum_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1757
      using rs(1)[OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1758
      apply (auto simp add:* field_simps)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1759
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1760
    also have "\<dots> < e * real p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1761
      using p `e > 0` `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1762
      by (auto simp add: field_simps n_def real_of_nat_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1763
    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
  1764
  }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1765
  moreover
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1766
  {
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1767
    have "(\<Sum>i\<in>Basis. \<bar>real (s (b' i)) - real (q (b' i))\<bar>) \<le> (\<Sum>(i::'a)\<in>Basis. 1)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1768
      apply (rule setsum_mono)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1769
      using rs(2)[OF b'_im]
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1770
      apply (auto simp add:* field_simps)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1771
      done
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1772
    also have "\<dots> < e * real p"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1773
      using p `e > 0` `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1774
      by (auto simp add: field_simps n_def real_of_nat_def)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1775
    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
  1776
  }
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1777
  ultimately
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1778
  have "norm (r' - z) < e" and "norm (s' - z) < e"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1779
    unfolding r'_def s'_def z_def
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1780
    using `p > 0`
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1781
    apply (rule_tac[!] le_less_trans[OF norm_le_l1])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1782
    apply (auto simp add: field_simps setsum_divide_distrib[symmetric] inner_diff_left)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1783
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1784
  then have "\<bar>(f z - z) \<bullet> i\<bar> < d / real n"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1785
    using rs(3) i
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1786
    unfolding r'_def[symmetric] s'_def[symmetric] o_def bb'
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1787
    by (intro e(2)[OF `r'\<in>unit_cube` `s'\<in>unit_cube` `z\<in>unit_cube`]) auto
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1788
  then show False
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1789
    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
  1790
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1791
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1792
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1793
subsection {* Retractions *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1794
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1795
definition "retraction s t r \<longleftrightarrow> t \<subseteq> s \<and> continuous_on s r \<and> r ` s \<subseteq> t \<and> (\<forall>x\<in>t. r x = x)"
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1796
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1797
definition retract_of (infixl "retract'_of" 12)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1798
  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
  1799
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1800
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
  1801
  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
  1802
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1803
subsection {* Preservation of fixpoints under (more general notion of) retraction *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1804
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1805
lemma invertible_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1806
  fixes s :: "'a::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1807
    and t :: "'b::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1808
  assumes "continuous_on t i"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1809
    and "i ` t \<subseteq> s"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1810
    and "continuous_on s r"
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1811
    and "r ` s \<subseteq> t"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1812
    and "\<forall>y\<in>t. r (i y) = y"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1813
    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
  1814
    and "continuous_on t g"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1815
    and "g ` t \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1816
  obtains y where "y \<in> t" and "g y = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1817
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1818
  have "\<exists>x\<in>s. (i \<circ> g \<circ> r) x = x"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1819
    apply (rule assms(6)[rule_format])
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1820
    apply rule
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1821
    apply (rule continuous_on_compose assms)+
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1822
    apply ((rule continuous_on_subset)?, rule assms)+
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1823
    using assms(2,4,8)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1824
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1825
    apply blast
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1826
    done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1827
  then obtain x where x: "x \<in> s" "(i \<circ> g \<circ> r) x = x" ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1828
  then have *: "g (r x) \<in> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1829
    using assms(4,8) by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1830
  have "r ((i \<circ> g \<circ> r) x) = r x"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1831
    using x by auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1832
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1833
    apply (rule_tac that[of "r x"])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1834
    using x
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1835
    unfolding o_def
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1836
    unfolding assms(5)[rule_format,OF *]
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1837
    using assms(4)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1838
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1839
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1840
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1841
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1842
lemma homeomorphic_fixpoint_property:
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1843
  fixes s :: "'a::euclidean_space set"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1844
    and t :: "'b::euclidean_space set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1845
  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
  1846
  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
  1847
    (\<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
  1848
proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1849
  obtain r i where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1850
      "\<forall>x\<in>s. i (r x) = x"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1851
      "r ` s = t"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1852
      "continuous_on s r"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1853
      "\<forall>y\<in>t. r (i y) = y"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1854
      "i ` t = s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1855
      "continuous_on t i"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1856
    using assms
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1857
    unfolding homeomorphic_def homeomorphism_def
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1858
    by blast
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1859
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1860
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1861
    apply rule
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1862
    apply (rule_tac[!] allI impI)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1863
    apply (rule_tac g=g in invertible_fixpoint_property[of t i s r])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1864
    prefer 10
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1865
    apply (rule_tac g=f in invertible_fixpoint_property[of s r t i])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1866
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1867
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1868
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1869
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1870
lemma retract_fixpoint_property:
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1871
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1872
    and s :: "'a set"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1873
  assumes "t retract_of s"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1874
    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
  1875
    and "continuous_on t g"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1876
    and "g ` t \<subseteq> t"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1877
  obtains y where "y \<in> t" and "g y = y"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1878
proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1879
  obtain h where "retraction s t h"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1880
    using assms(1) unfolding retract_of_def ..
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1881
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1882
    unfolding retraction_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1883
    apply -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1884
    apply (rule invertible_fixpoint_property[OF continuous_on_id _ _ _ _ assms(2), of t h g])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1885
    prefer 7
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1886
    apply (rule_tac y = y in that)
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1887
    using assms
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1888
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1889
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1890
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1891
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1892
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1893
subsection {* The Brouwer theorem for any set with nonempty interior *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1894
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1895
lemma convex_unit_cube: "convex unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1896
  apply (rule is_interval_convex)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1897
  apply (clarsimp simp add: is_interval_def mem_unit_cube)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1898
  apply (drule (1) bspec)+
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1899
  apply auto
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1900
  done
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1901
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
  1902
lemma brouwer_weak:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1903
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1904
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1905
    and "convex s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1906
    and "interior s \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1907
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1908
    and "f ` s \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1909
  obtains x where "x \<in> s" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1910
proof -
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1911
  let ?U = "unit_cube :: 'a set"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1912
  have "\<Sum>Basis /\<^sub>R 2 \<in> interior ?U"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1913
  proof (rule interiorI)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1914
    let ?I = "(\<Inter>i\<in>Basis. {x::'a. 0 < x \<bullet> i} \<inter> {x. x \<bullet> i < 1})"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1915
    show "open ?I"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1916
      by (intro open_INT finite_Basis ballI open_Int, auto intro: open_Collect_less)
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1917
    show "\<Sum>Basis /\<^sub>R 2 \<in> ?I"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1918
      by simp
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1919
    show "?I \<subseteq> unit_cube"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1920
      unfolding unit_cube_def by force
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1921
  qed
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1922
  then have *: "interior ?U \<noteq> {}" by fast
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1923
  have *: "?U homeomorphic s"
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1924
    using homeomorphic_convex_compact[OF convex_unit_cube compact_unit_cube * assms(2,1,3)] .
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1925
  have "\<forall>f. continuous_on ?U f \<and> f ` ?U \<subseteq> ?U \<longrightarrow>
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1926
    (\<exists>x\<in>?U. f x = x)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  1927
    using brouwer_cube by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1928
  then show ?thesis
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1929
    unfolding homeomorphic_fixpoint_property[OF *]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1930
    apply (erule_tac x=f in allE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1931
    apply (erule impE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1932
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1933
    apply (erule bexE)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1934
    apply (rule_tac x=y in that)
53252
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1935
    using assms
4766fbe322b5 tuned proofs;
wenzelm
parents: 53248
diff changeset
  1936
    apply auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1937
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1938
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1939
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1940
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1941
text {* And in particular for a closed ball. *}
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  1942
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1943
lemma brouwer_ball:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1944
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1945
  assumes "e > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1946
    and "continuous_on (cball a e) f"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1947
    and "f ` cball a e \<subseteq> cball a e"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1948
  obtains x where "x \<in> cball a e" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1949
  using brouwer_weak[OF compact_cball convex_cball, of a e f]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1950
  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
  1951
  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
  1952
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1953
text {*Still more general form; could derive this directly without using the
36334
068a01b4bc56 document generation for Multivariate_Analysis
huffman
parents: 36318
diff changeset
  1954
  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
  1955
  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
  1956
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  1957
lemma brouwer:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  1958
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1959
  assumes "compact s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1960
    and "convex s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1961
    and "s \<noteq> {}"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1962
    and "continuous_on s f"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1963
    and "f ` s \<subseteq> s"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1964
  obtains x where "x \<in> s" and "f x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1965
proof -
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1966
  have "\<exists>e>0. s \<subseteq> cball 0 e"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1967
    using compact_imp_bounded[OF assms(1)]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  1968
    unfolding bounded_pos
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1969
    apply (erule_tac exE)
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  1970
    apply (rule_tac x=b in exI)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1971
    apply (auto simp add: dist_norm)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1972
    done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1973
  then obtain e where e: "e > 0" "s \<subseteq> cball 0 e"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1974
    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
  1975
  have "\<exists>x\<in> cball 0 e. (f \<circ> closest_point s) x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1976
    apply (rule_tac brouwer_ball[OF e(1), of 0 "f \<circ> closest_point s"])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1977
    apply (rule continuous_on_compose )
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1978
    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
  1979
    apply (rule continuous_on_subset[OF assms(4)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1980
    apply (insert closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3)])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1981
    defer
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1982
    using assms(5)[unfolded subset_eq]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1983
    using e(2)[unfolded subset_eq mem_cball]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1984
    apply (auto simp add: dist_norm)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1985
    done
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  1986
  then obtain x where x: "x \<in> cball 0 e" "(f \<circ> closest_point s) x = x" ..
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1987
  have *: "closest_point s x = x"
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1988
    apply (rule closest_point_self)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1989
    apply (rule assms(5)[unfolded subset_eq,THEN bspec[where x="x"], unfolded image_iff])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1990
    apply (rule_tac x="closest_point s x" in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1991
    using x
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1992
    unfolding o_def
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1993
    using closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3), of x]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1994
    apply auto
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1995
    done
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1996
  show thesis
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1997
    apply (rule_tac x="closest_point s x" in that)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1998
    unfolding x(2)[unfolded o_def]
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  1999
    apply (rule closest_point_in_set[OF compact_imp_closed[OF assms(1)] assms(3)])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2000
    using *
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2001
    apply auto
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2002
    done
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2003
qed
33741
4c414d0835ab Added derivation and Brouwer's fixpoint theorem in Multivariate Analysis (translated by Robert Himmelmann from HOL-light)
hoelzl
parents:
diff changeset
  2004
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 36587
diff changeset
  2005
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
  2006
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2007
lemma no_retraction_cball:
56117
2dbf84ee3deb remove ordered_euclidean_space constraint from brouwer/derivative lemmas;
huffman
parents: 55522
diff changeset
  2008
  fixes a :: "'a::euclidean_space"
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2009
  assumes "e > 0"
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2010
  shows "\<not> (frontier (cball a e) retract_of (cball a e))"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2011
proof
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2012
  case goal1
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2013
  have *: "\<And>xa. a - (2 *\<^sub>R a - xa) = - (a - xa)"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2014
    using scaleR_left_distrib[of 1 1 a] by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2015
  obtain x where x:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2016
      "x \<in> {x. norm (a - x) = e}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2017
      "2 *\<^sub>R a - x = x"
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2018
    apply (rule retract_fixpoint_property[OF goal1, of "\<lambda>x. scaleR 2 a - x"])
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2019
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2020
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2021
    apply (erule conjE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2022
    apply (rule brouwer_ball[OF assms])
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2023
    apply assumption+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2024
    apply (rule_tac x=x in bexI)
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2025
    apply assumption+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2026
    apply (rule continuous_on_intros)+
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2027
    unfolding frontier_cball subset_eq Ball_def image_iff
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2028
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2029
    apply rule
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2030
    apply (erule bexE)
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2031
    unfolding dist_norm
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2032
    apply (simp add: * norm_minus_commute)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55493
diff changeset
  2033
    apply blast
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2034
    done
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2035
  then have "scaleR 2 a = scaleR 1 x + scaleR 1 x"
53248
7a4b4b3b9ecd tuned proofs;
wenzelm
parents: 53186
diff changeset
  2036
    by (auto simp add: algebra_simps)
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2037
  then have "a = x"
53688
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2038
    unfolding scaleR_left_distrib[symmetric]
63892cfef47f tuned proofs;
wenzelm
parents: 53674
diff changeset
  2039
    by auto
53674
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2040
  then show False
7ac7b2eaa5e6 tuned proofs;
wenzelm
parents: 53252
diff changeset
  2041
    using x assms by auto
53185
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2042
qed
752e05d09708 tuned proofs;
wenzelm
parents: 51478
diff changeset
  2043
34291
4e896680897e finite annotation on cartesian product is now implicit.
hoelzl
parents: 34289
diff changeset
  2044
end