Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Isabelle/HOL/Analysis/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 67 kB image not shown  

Quellcode-Bibliothek Weierstrass_Theorems.thy   Sprache: Isabelle

 
section 

text\<open>By L C Paulson (2015)\<close>

theory Weierstrass_Theorems
imports Uniform_Limit Path_Connected Derivative
begin

subsection \<open>Bernstein polynomials\<close>

definition\<^marker>\<open>tag important\<close> Bernstein :: "[nat,nat,real] \<Rightarrow> real" where
  "Bernstein n k x \ of_nat (n choose k) * x^k * (1 - x)^(n - k)"

lemma Bernstein_nonneg: "\0 \ x; x \ 1\ \ 0 \ Bernstein n k x"
  by (simp add: Bernstein_def)

lemma Bernstein_pos: "\0 < x; x < 1; k \ n\ \ 0 < Bernstein n k x"
  by (simp add: Bernstein_def)

lemma sum_Bernstein [simp]: "(\k\n. Bernstein n k x) = 1"
  using binomial_ringof "-"njava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  by (simp add: Bernstein_def)

lemma binomial_deriv1:
    "(\k\n. (of_nat k * of_nat (n choose k)) * a^(k-1) * b^(n-k)) = real_of_nat n * (a+b)^(n-1)"
  apply (rule DERIV_unique [where f java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
   ( binomial_ring
  apply (rule derivative_eq_intros sum.   qR "
  done

lemma    simp: q_def diffpower)
    "(\k\n. (of_nat k * of_nat (k-1) * of_nat (n choose k)) * a^(k-2) * b^(n-k)) =
     of_nat n * of_nat (n-1) * (a+b::real)^(n-2)"
  apply (rule DERIV_unique [where f = "\a. of_nat n * (a+b::real)^(n-1)" and x=a])
  apply (subst binomial_deriv1 [symmetric])
  apply (rule derivative_eq_intros sum.cong    using t0 pf by (simp add: q_def power_0_left)
  done

lemma sum_k_Bernstein [simp]: "(\k\n. real k * Bernstein n k x) = of_nat n * x"
  apply (subst binomial_deriv1 [of n x "1 have "h\<> R"
  apply(imp: sum_distrib_right)
  apply (auto simp:     have hsq(\<lambda>w. (h w)\<^sup>2) \<in> R"
  done

lemma sum_kk_Bernstein [  by ( introhsq mult
moreover " 0
 ( add h_def)
        (\<Sum>k\<le>n. real k * real (k - Suc 0) * real (n choose k) * x^(k - 2) * (1 - x)^(n - k) * x\<^sup>2)"pt>0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  proofusing normf_uppercontinuous hsq]by(auto: p_def
    fix    ultimately "
    assume "k \ n"
    then consider "k = auto
      by (metis One_nat_def not0_implies_Suc)
    then show java.lang.StringIndexOutOfBoundsException: Index 110 out of bounds for length 110
( k-1   n k x =
          real (k - Suc 0) *
          (real (n choose k) * (x^(k - 2) * ((1 - x)^(n - k) * x\<^sup>2)))"
      by cases (auto simp add: Bernstein_def
  qed
  also have ". blast
bysubst [of  1x" simplified, symmetric]) (simpadd sum_distrib_right)
  also      pf Ufblast
    by auto
  finally show ?thesis
    by auto
qed

subsection]" \ {}"

theorem Bernstein_Weierstrass t1 auto
  fixes f have"card subU>0"subU
  assumes contf: "continuous_on {0..1} f" and e: "0 < e"
shows
                    \<longrightarrow> \<bar>f x - (\<Sum>k\<le>n. f(k/n) * Bernstein n k x)\<bar> < e"
proof -
  have "bounded f ` 0.1}"
    using   pR "
  thenobtain where "x 0 \ x \ x \ 1 \ \f x\ \ M"
    by (force
       ?
  haveucontf{
    using compact_uniformly_continuous contf        subUt
  then obtain d where d: "d>0" "\x x'. \ x \ {0..1}; x' \ {0..1}; \x' - x\ < d\ \ \f x' - f x\ < e/2"
      apply(clarsimp: p_def)
     using e by        ( sum_pos2[ \<open>finite subU\<close>])
  { fix:nat x::real
    assume n: "Suc (nat\4*M/(e*d\<^sup>2)\) \ n" and x: "0 \ x" "x \ 1"
    have0n" n by simp
    have ed0: "- (e * d\<^sup>2) < 0"
      using e \<open>0<d\<close> by simp
    also ( simp field_split_simpss)
       have px\<le> 1"
    finally []: "real_of_int(nat \4 * M / (e * d\<^sup>2)\) = real_of_int \4 * M / (e * d\<^sup>2)\"
      using simp: p_def field_split_simps)
      by (simp le [where'a=ealandK=,)
    have "4*M/(e*d\<^sup>2) + 1 \ real (Suc (nat\4*M/(e*d\<^sup>2)\))"
      by (simp add: real_nat_ceiling_ge)
    also have "... \ real n"
      using n by (simp add: field_simps Diff_subset compact_continuous_image continuous_on_subset)
    finally have nbig: add compact_imp_closed)
     moreover "
    proof -
have\<
        by (simp add: algebra_simps obtain where : "delta0 >0 " 0 delta0
      have "(\k\n. (k - n * x)\<^sup>2 * Bernstein n k x) = n * x * (1 - x)"
        apply (simp add:   "delta0 \ 1" using delta0 p01 [of t1] t1
        apply      by (forcsimp dist_norm: p01
        apply(imp: algebra_simps)
        done
 ( simp \<delta>_def)
        by (simp add: power2_eq_square \<delta\Andx  \<in> S-U \<Longrightarrow> p x \<ge> \<delta>"
      then ?thesis
        using n by (simp add: sum_divide_distrib field_split_simps power2_commute)
    qed
    { fix k
      assume k: "k \ n"
      then   "\A. open A \ A \ S = {x\S. p x < \/2}"
        by (auto simp: field_split_simps)
 (lessd
        by linarith
      then using \<delta>01 by (simp add: k_def)
       cases
        case lessd
        then "\(f x - f (k/n))\ < e/2"
           have.  2/delta
        also have ..\le(/   *   \<^sup>2 * (x - k/n)\<^sup>2)"
           \<open>M\<ge>0\<close> d by simp
        finally ?thesis
      next
        case ged
        then have dle: "d\<^sup>2 \ (x - k/n)\<^sup>2"
          by (metis d(1) less_eq_real_def power2_abs power_mono)
 <> " \ (x - real k / real n)\<^sup>2 / d\<^sup>2"
          using dle \<open>d>0\<close> by auto
         "\(f x - f (k/n))\ \ \f x\ + \f (k/n)\"
          by (rule abs_triangle_ineq4)
        also have "... \ M+M"
          by (meson M add_mono_thms_linordered_semiring(1)                         
        also have "... \ 2 * M * ((x - k/n)\<^sup>2 / d\<^sup>2)"
          using \<section> \<open>M\<ge>0\<close> mult_left_mono by fastforce
have "... \ e/2 + 2 * M / d\<^sup>2 * (x - k/n)\<^sup>2"
          java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 12
        finally show ?thesis .
        qed
    } note * = this
    have "\f x - (\k\n. f(k / n) * Bernstein n k x)\ \ \\k\n. (f x - f(k / n)) * Bernstein n k x\"
      by (simp add: sum_subtractf sum_distrib_left [symmetric] algebra_simps)
    also have "... \ (\k\n. \(f x - f(k / n)) * Bernstein n k x\)"
        thenhave[simpsubA
alsohave".. (\k\n. (e/2 + (2 * M / d\<^sup>2) * (x - k / n)\<^sup>2) * Bernstein n k x)"
      using *
      by (force simp add: abs_mult Bernstein_nonneg x mult_right_mono intro: sum_mono)
    also have "... \ e/2 + (2 * M) / (d\<^sup>2 * n)"
      unfolding.distrib.semiring_classdistrib_right [symmetric.assoc
      using \<open>d>0\<close> x by (simp add: divide_simps \<open>M\<ge>0\<close> mult_le_one mult_left_le)( add:card_gt_0_iff
    also have..<e"
      using \<open>d>0\<close> nbig e \<open>n>0\<close> 
      apply (simp add: field_split_simps)
      using ed0 by linarith
    finally Vf e cardp
  }
  then show ?thesis
    byjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
qed


subsection g = "\x. 1", simplified])

text\<open>Source:
Bruno Brosowski    ultimately show?hesis
An Elementary Proofjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ProceedingsAmerican
Volume 81, Number 1, January 1981     subA  "pff x= ff vx*\ subA - {v.ffwx"
DOI: 10.2307      unfolding pff_def prodremove)

locale function_ring_on have "... \ ff v x * 1"
  fixes R :: "('a:ff subA(1) v (2)by fastforce
   compactjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  assumes continuous:
  assumes add:      have. <e/ "
  assumes mult: "f \ R \ g \ R \ (\x. f x * g x) \ R"
  assumes const ff(1)vxbyjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  assumes separable: "x \ S \ y \ S \ x \ y \ \f\R. f x \ f y"

begin
       B  
    by (frule mult [OF const " e (1 - e / card subA)^card subA"le(    card)^cardsubA"

  lemma diff ( simp: )
    unfolding diff_conv_add_uminus by (metis  ".. \<>w \ subA. 1 - e / card subA)"

  lemma power:    also  ".. pff "
    by (induct n) (      have "\<And>i. i > subA

  lemma sum: "\finite I; \i. i \ I \ f i \ R\ \ (\x. \i \ I. f i x) \ R"
    by (inductthesis

      java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    byinduct: ; simp:const

  definition\<^marker>\<open>tag important\<close> normf :: "('a::t2_space \<Rightarrow> real) \<Rightarrow> real"
    where "normf f \ SUP x\S. \f x\"

  lemma normf_upper: 
    assumes "continuous_on S f" "x \ S" shows "\f x\ \ normf f"
  proof -
    have "bdd_above ((\x. \f x\) ` S)"
      by (simp add: assms    show "\x. x \ S \ 0 \ f x + normf f"
    then show ?thesis
      using assms cSUP_upper normf_def by fastforce
  qed

  lemma normf_least:  qed (use  auto
    by (simpthen g  "g \ R" "\x\S. \g x - (f x + normf f)\ < e"

end

lemma (in function_ring_on) one:
  assumes U: "open U" and t0:   show ?thesis
    shows "\V. open V \ t0 \ V \ S \ V \ U \
               (\<forall>e>0. \<exists>f \<in> R. f ` S \<subseteq> {0..1} \<and> (\<forall>t \<in> S \<inter> V. f t < e) \<and> (\<forall>t \<in> S - U. f t > 1 - e))"
proof -
  have proof -
  proof -
    have "t\<
    then obtain g where g: "g \ R" "g t \ g t0"
sing separable  by (metis Diff_subset t)
      ereal
    have "h \ R"
      unfoldingfast
    then have hsq: "(\w. (h w)\<^sup>2) \ R"
       simp  mult
    have

    then have "h t \ 0"
      by (simp add: h_def)
    then have ht2: "0 < (h t)^2"
      by simp
    also have "... \ normf (\w. (h w)\<^sup>2)"
      using t normf_upper lemma"real_polynomial_function p = polynomial_functionp"
    finally have nfp0<normf
    define p where [abs_def]:java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    have "p \ R"
      unfolding p_def by (fast intro iff](lambda
moreover "="
      by (simp add: p_def h_def)
    moreover have "p t > 0lemma polynomial_function_bounded_linear:
      using nfpbounded_linear
    moreover have "\x. x \ S \ p x \ {0..1}"
      using normf_upper continuous hsq  (auto simpp_def
    ultimately show " ultimately show "\pt \ R. pt t0 = 0 \ pt t > 0 \ pt ` S \ {0..1}"
      by java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
  qed
then pfwhere:"And> S-U \ pf t \ R \ pf t t0 = 0 \ pf t t > 0">S-U
                   and -
by
 com_sU (U"
    using compact closed_Int_compact U by (simp add: Diff_eq compact_Int_closed open_closed)
  have "\t. t \ S-U \ \A. open A \ A \ S = {x\S. 0 < pf t x}"
    apply (rule assmsby java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    ( pf continuous
  then obtain Uf where Uf: "\t. t \ S-U \ open (Uf t) \ (Uf t) \ S = {x\S. 0 < pf t x}"
    by metis
  then have
    byjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  have tUft:qed (simp: gbinomial_prod_rev
    usingjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  then :" \ (\x \ S-U. Uf x)"
    by blast
      real_polynomial_function
    by (blast intro  by(nductsimp_all: const)
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    using by auto
  then have cardp f: "polynomial_function f" and :" g"
    by( add: card_gt_0_iff
define [abs_def:" (1/card subU) * (t \ subU. pf t x)" for x
  have pR"p \ R"
    unfolding p_def using subU pf by (fast intro: pf const mult sum)
  have pt0 [simp]: "p t0 by(rule_tac x=\."exI
using pfby(uto:p_def: .neutral
  have pt_pos: "p t > obtain p1 p2
  proof -
    obtain i where i: "i \ subU" "t \ Uf i" using subU t by blast
    show ?thesis
      using
      apply (clarsimp simp: p_def field_split_simps)
      apply (rule sum_pos2 [OF \<open>finite subU\<close>])
      using Uf t pf01 apply auto
      apply (force elim!: subsetCE)
      done
  qed
  have p01: "p x \ {0..1}" if t: "x \ S" for x
  proof -
    have "0 \ p x"
      using subU cardp t pf01
      by (fastforce simp add: p_def field_split_simps intro: sum_nonneg)
    moreover have "p x \ 1"
      using subU cardp t 
      apply (simp add: p_def field_split_simps)
      apply (rule sum_bounded_above [where 'a=real and K=1, simplified])
      using pf01 by force
    ultimately show ?thesis
      by auto
  qed
  have "compact (p ` (S-U))"
    by (meson Diff_subset com_sU compact_continuous_image continuous continuous_on_subset pR)
  then have "open (- (p ` (S-U)))"
    by (simp add: compact_imp_closed open_Compl)
  moreover have "0 \ - (p ` (S-U))"
    by (metis (no_types) ComplI image_iff not_less_iff_gr_or_eq pt_pos)
  ultimately obtain delta0 where delta0: "delta0 > 0" "ball 0 delta0 \ - (p ` (S-U))"
    by (auto simp: elim!: openE)
  then have pt_delta: "\x. x \ S-U \ p x \ delta0"
    by (force simp: ball_def dist_norm dest: p01)
  define \<delta> where "\<delta> = delta0/2"
  have "delta0 \ 1" using delta0 p01 [of t1] t1
      by (force simp: ball_def dist_norm dest: p01)
  with delta0 have \<delta>01: "0 < \<delta>" "\<delta> < 1"
    by (auto simp: \<delta>_def)
  have pt_\<delta>: "\<And>x. x \<in> S-U \<Longrightarrow> p x \<ge> \<delta>"
    using pt_delta delta0 by (force simp: \<delta>_def)
  have "\A. open A \ A \ S = {x\S. p x < \/2}"
    by (rule open_Collect_less_Int [OF continuous [OF pR] continuous_on_const])
  then obtain V where V: "open V" "V \ S = {x\S. p x < \/2}"
    by blast
  define k where "k = nat\1/\\ + 1"
  have "k>0"  by (simp add: k_def)
  have "k-1 \ 1/\"
    using \<delta>01 by (simp add: k_def)
  with \<delta>01 have "k \<le> (1+\<delta>)/\<delta>"
    by (auto simp: algebra_simps add_divide_distrib)
  also have "... < 2/\"
    using \<delta>01 by (auto simp: field_split_simps)
  finally have k2\<delta>: "k < 2/\<delta>" .
  have "1/\ < k"
    using \<delta>01 unfolding k_def by linarith
  with \<delta>01 k2\<delta> have k\<delta>: "1 < k*\<delta>" "k*\<delta> < 2"
    by (auto simp: field_split_simps)
  define q where [abs_def]: "q n t = (1 - p t^n)^(k^n)" for n t
  have : "q \ R" for n
    by (simp add: q_def const(ule_tac\lambda    p2  exI auto!: derivative_eq_intros)
  have q01: "\n t. t \ S \ q n t \ {0..1}"
    using by ( addq_def  algebra_simps
  have qt0 [simpthen obtainp1 where
defjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  {  t  "
    assume t: "t \ S \ V"
    with
       by force    have"\p. real_polynomial_function p \ (\x \ S. \f x \ b - p x\ < e / DIM('b))"
    thenthenopen_Vf>. <in> A \<Longrightarrow> open (Vf w)"
using
    also have "... \ q n t"
using [of ( t^)"kn]
      apply (simpblast
      by metis atLeastAtMost_iff power_le_one t)
    finally "by etis inf.absorb_iff2)
  }notelimitV
   show   ultimately show ?thesisOFopen_Vf
     byjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
   withjava.lang.StringIndexOutOfBoundsException: Range [3, 1) out of bounds for length 3
      by (simp: pt_
    with k\<delta> have kpt: "1 < k * p t"
      y( introless_le_trans
    have ptn_posby (simpaddcard_gt_0_iff
       pt_pos[OF }
    have ptn_le: "p t^n \ 1"
      by (meson DiffE atLeastAtMost_iff p01 power_le_one t)
haveq(/(  where
 pt_pos"And>. \ Basis \ real_polynomial_function (pf b) \ (\x \ S. \f x \ b - pf b x\ < e / DIM('b))"
    also have "... \ (1/(k * (p t))^n) * (1 - p t^n)^(k^n) * (1 + k^n * (p t)^n)"
      using pt_pos [OF t] \<open>k>0\<close>
      by (simp add: divide_simps mult_left_mono          \Andw. <in> A \<Longrightarrow> ff w \<in> R \<and> ff w ` S \<subseteq> {0..1} \<and>
      ".. \ (1/(k * (p t))^n) * (1 - p t^n)^(k^n) * (1 + (p t)^n)^(k^n)"
    proof (rule mult_left_mono [OF Bernoulli_inequality])
show0\<le> 1 / (real k * p t)^n * (1 - p t^n)^k^n"
        using ptn_pos metis
    qed ptn_pos auto      by(ule)
    also have "... = (1/(k * pffR:a "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       pt_posjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
bypff01pff 
    also have "... \ (1/(k * (p t))^n) * 1"
          have    "And>i. i \ Basis \ norm ((f x \ i) *\<^sub>R i - pf i x *\<^sub>R i) < e / real DIM('b)"
      by (intro mult_left_mono [OF power_le_one]) auto
    also have "... \ (1 / (k*\))^n"
sing
      by (fastforce simp: field_simps      using cardp t ff
    finally "qnt\<> (1 / (real k *
  } note     have pff
  define
    where by( simpaddpff_deffield_split_simpsjava.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27
  haveNNhave"foralljava.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
              if  reover
      unfolding
    have NN1:from v have" x = v x * (\in java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    proofjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
l NN   ( k *<delta> / 2)"
        by        "\i. i \ subA - {v} \ 0 \ ff i x \ ff i x \ 1"
      alsohave. _ atLeastAtMost_iff image_subset_iff(1 subsetD ()
        using NN k\<delta> that by (force simp add: field_simps)
       show
        by (simp add: \<open>\<delta>>0\<close> \<open>0 < k\<close> that)
    qed
 "(1/ultimately show ?java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
proof
    have "0 also . < ardsubA"
using
      assumes S:" S"
()[ e] \<open>0 < \<delta>\<close> \<open>0 < k\<close> that by (simp add: ln_div divide_simps):"ontinuous_on using cardp e ( add field_split_simps)
    havepffejava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
      by (metis pos: f bymetis ontra_subsetD
    then show ?thesis have"
       B byauto
  qed
  {   obtain where g: "\n. polynomial_function (g n)" "\x n. x \ S \ norm(f x - g n x) < inverse (Suc n)"
assume">"
       ( simpfield_simps
 [ ]
      assume t:      metis
       " - q (NNe t< e"
    also ".. < pffx"
    next
      assume t: " "<And>i. i \<in> subA \<Longrightarrow> e / real (card subA) \<le> 1 \<and> 1 - e / real (card subA) < ff i x")
      show NN<"
      using  limitNonU [OF java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 23
    qed
have"<>. 0\<> \f\R. f ` S \ {0..1} \ (\t \ S \ V. f t < e) \ (\t \ S - U. 1 - e < f t)"
    using q01
    by( x="\x. 1 - q (NN e) x" in bexI) (auto simp: algebra_simps intro: diff const qR)
  moreover}
    usingultimately  ?thesis
  ultimately show ?thesis
    by blast
qed

      ndclosed<>"
lemma (in function_ring_on (eventually_elim
  assumesA closed"A\ S" "a \ A"
      andB closed  and"A
and:java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      and e: "0 < e" "e < 1"
    shows\<open  then ?java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
proof
  { fix w
  " False
 consider}|"=} by force
      using assms
    then have "case 1
               (<forall( " g \ path g"
bysimp path_defjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
then Vf
         "java.lang.StringIndexOutOfBoundsException: Range [0, 85) out of bounds for length 30
                         (\<forall>e>0. \<exists>f \<in> R. f ` S \<subseteq> {0..1} \<and> (\<forall>x \<in> S \<inter> Vf w. f x < e) \<and> (\<forall>x \<in> S \<inter> B. f x > 1 - e))"\<And>t. t \<in> {0..1} \<Longrightarrow> norm(p t - g t) < e"
    by metis   "B { <> S
  have:() e\<ge> normf f"
    byblast
  have( simp: divide_simpsjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 Vf java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  usingf that java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    by 
  have com_A:  (imp compact
    by (metis 
obtainwheresubA
    by (blast intro: that compactE_image [OF s_on_closed_Collect_le f       using \<open>closed S\<close> continuous_on_closed_Collect_le [OF f continuous_on_const
  then have [simp]: "subA \ {}"
    using
  then have       ( simpadd pf_def
    by (simp add: card_gt_0_iff" (pf t- t) Collect_restrict
if     have(Aj)java.lang.NullPointerException
using ejava.lang.StringIndexOutOfBoundsException: Range [15, 11) out of bounds for length 11
  thenwhere
           java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
                        <java.lang.StringIndexOutOfBoundsException: Range [151, 34) out of bounds for length 151
                  xfA And>x j. x \<in> A j \<Longrightarrow> xf j x < e/n"
define where [abs_def" x = (\w \ subA. ff w x)" for x
  have pffR: "pff \ R"
    unfoldingdefine [abs_def    *java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
  moreover    unfolding g_def by (ast: mult sum xfR)
  java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  proof -
    have "0\ pff x"
      using subA cardp t ff
      by   A0 A = {}"
     have" x \ 1"
   An A n="
      by (fastforceusing ngt
    ultimatelyshow ?thesis
      by auto
  qed
  {fix
  { fix v x
java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    from    have jn: "j \ n"
      unfolding  by (prod
    also have "... \ ff v x * 1"
    proof -
have\Andi i\<in> subA - {v} \<Longrightarrow> 0 \<le> ff i x \<and> ff i x \<le> 1"
         (Diff_subset atLeastAtMost_iff ff image_subset_iff subA(1) subsetD x(2))
      moreover" \ ff v x"
        using         g AsubOF]] byblast
      ultimately ?thesis
        by (metis mult_left_monoby( add: A_def)
    qed
    also have "... qed (auto simpadd: path_defs pf_def)
      using ff subA
    also have "... \ e"
      using cardp e by (simp add: field_split_simps     j11\<le> j"
    finallyusing  : function_ring_on
}
 have\Andx  <  <>   "
   S:" S" "java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 35
  moreover      singby
    java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
assumex:" " usingjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
then "x\ S"
      using B by auto
    have \<open>x \<in> S\<close> \<open>y \<in> S\<close> obtain p where p: "path p" "path_image p \<subseteq> S" "pathstart p = x" "pathfinish p = y"
      using Bernoulli_inequality [of simphave<exists>e. 0 < e \<and> (\<forall>x \<in> path_image p. ball x e \<subseteq> S)"
      y( simp)
alsohave..  (<> <in> subA. 1 - e / card subA)"
      by (simp add: subA(2))
alsohave".. < "
    proof -
       "(
        using e \<open>B \<subseteq> S\<close> ff subA(1) x by (force simp: field_split_simps)
      then show ?thesis
        using prod_mono_strict[of _ subAusing    show?hesis
        unfoldingby( (,bestassms) subsetD

    finally have         fastforce
  }
  ultimately show ?thesis by blastalsohave      show\<And>x. x \<in> path_image p \<Longrightarrow> ball x (setdist (path_image p) (-S)) \<subseteq> S"
qed

lemma (in function_ring_on) two:
  assumes A: "closed A" "A \ S"
      and: closed" \ S"
      and disj: "A \ B = {}"
      and e: "0 < e" "e < 1"
    "\f \ R. f ` S \ {0..1} \ (\x \ A. f x < e) \ (\x \ B. f x > 1 - e)"
proof Ajava.lang.NullPointerException
  case True then show ?thesis
    using assms
    by (force simp flip
next
  case      aseFalse
  thenconsider" B={}"byjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 11
  show?thesis
  proof cases
    casejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
 show thesis
      by (rule_tac x="\x. 1" in bexI) (auto simp: const)
  next
    case 2
ethesisusing [OF 
le_tac x"\x. 0" in bexI) (auto simp: const)
  
qed

proof intro conjI
lemma (in function_ring_on) Stone_Weierstrass_special(ial_function
       fact
      and e: " also have "..  e  (-    "pathstart pf x" "pathfinish pf = y"
\<in> R. \<forall>x\<in>S. \<bar>f x - g x\<bar> < 2*e"
proof
d n . <le> e * (\<Sum>i\<le>j-2. xf i t)"e* \Sum>        -
  define A where "A assume"\<le> j" java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  define B where "B j = {assume "
  have"(n-1)* e\ge normf java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    usingby metis dist_commute pf_e)
    by (fastforce simp add: divide_simps n_def)
  moreover have "\1
    by( dd  B_def
             ( simp add field_simps not_leintro [        by(metis <open>0 \<le> x'\<close> \<open>x' \<le> 1\<close> atLeastAtMost_iff eb imageI mem_ball path_image_def subset_iff)
    using f normf_upper have "xf i t>1 -e/"
  have  qed
    by        h"(j Suc) * 1 e / eal n \ real (card {..j - 2}) * (1 - e / real n)"
   fix java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
haveclosed ) \<subseteq> S"
            
      by      also . \<le> g t"
    moreover "closed Bj) "Bj <>S
      using\<open>closed S\<close> continuous_on_closed_Collect_le [OF continuous_on_const f] auto:Groups_Big  addg_def image_subset_iff)
      by (simp_all addB_def)
    moreover have "(A j qed
      using e by( simp A_def B_defjava.lang.StringIndexOutOfBoundsException: Range [52, 40) out of bounds for length 40
ultimately"exists>f \ R. f ` S \ {0..1} \ (\x \ A j. f x < e/n) \ (\x \ B j. f x > 1 - e/n)"
      using e java.lang.StringIndexOutOfBoundsException: Range [4, 34) out of bounds for length 28
}
  then obtain"\i. i \ Basis \ ((\x. f x \ i) has_derivative f' i) (at a within S)"
                   and xfA: "java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 14
                   and xfB: "\x j. x \ B j \ xf j x > 1 - e/n"
    by metis
  define] g x=  \<Sum>i\<le>n. xf i x)" for x
  have
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 55
  have gge0 path_image_def
    using clarsimp
  have A0
    using
  have An real_polynomial_function_sum]java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 38
    using e ngt \<open>n\<ge>1\<close> f normf_upper by (fastforce simp: A_def field_simps of_nat_diff) [of ]
  have         byatLeastAtMost_iff
  ( simp intro)
  { fix t
    assume"< 0 \ x'\ \x' \ 1\ atLeastAtMost_iff eb imageI mem_ball path_image_def subset_iff)
    define j where "j = (LEAST j. t \ A j)"
    have jn:  
      usingAn
    have Aj: "t \ A j"
      using t An " lemma :
n  Ai" \ A i" if "i\j" for i
      using Asub [(<forall>isimp )
    then have fj1: "f t java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 7
by(simp: A_def
    then have Anjjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       Ajhave : "(j\Basis. f' j x *\<^sub>R j) \ i) = f' i" if "i \ Basis" for i
           that(u g
      using A0 Aj j_def not_less_eq_eqhave\exists>.\<forall>i\<in>Basis. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>x. D x \<bullet> i)) (at a within S)"
    then have Anj: "t \ A (j-1)"
      using Least_le
    then havenext
      using j1t  simp:differentiable_def
    have xf_le1: "\i. xf i t \ 1"
          usinghas_derivative_componentwise_within showcase
    have" t =e* \i\n. xf i t)"
      by  casemult
    also have "... = e * using fynomial_function_inner []:
      by (simp add
    also have".. =e *(
      by (simp add: distrib_left ivl_disj_intshowsassumesshowspolynomial_function
    also  ".. \ e*j + e * ((Suc n - j)*e/n)"
    proof (intro add_mono mult_left_mono)
show\<Sum>i<j. xf i t) \<le> j"
        by  pplyjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
      have  "
        using xfA [OF Ai] that -
then
        using sum_bounded_above differentiable_at_real_polynomial_function:
        real_polynomial_function
    qeduse   (java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 56
    also have "... \ j*e + e*(n - j + 1)*e/n "
      using \<open>1 \<le> n\<close> e  by (simp add: field_simps del: of_nat_Suc)java.lang.StringIndexOutOfBoundsException: Range [48, 46) out of bounds for length 49
also "..<>j* ee"
      sing
    also have "... < (j + 1/3)*e"
      using e by (auto simp:
    finally have gj1: "g t eal_polynomial_function
     j2( - <>n:  =java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
     (cases \<le> j")
      case False
      then have "j=1" using j1 by simp obtain
      tgge0thesis
    next
      case True
      then have "(j - 4/3)*e < (j-1)*e - e^2"
        using e by (auto simp f show
      also have "... < (j-1)*e - ((j - java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
      proof -
   
          using j1 jn by java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 16
         \<open>e>0\<close> show ?thesis
          by (smt (verit, best   have " -java.lang.StringIndexOutOfBoundsException: Range [20, 11) out of bounds for length 11
      qed
 have java.lang.StringIndexOutOfBoundsException: Range [9, 7) out of bounds for length 11
        u  where =2sum_max_0and
       have".orthogonal_self java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
      proof -
         show by simpmult f1 f2)
          assume "i+2 \ j"
          then d where2+d=jjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
            le_Suc_ex
t   b2
            using \<lambda>x. \<Sum>i\<le>n1. b1 i * x^i)" "f2 = (\<lambda>x. \<Sum>i\<le>n2. b2 i * x^i)"
            unfolding A_def B_def
d:field_simpsof_nat_diffnot_le: order_trans _ eshow<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) \<in> span B"
          then showcase
            by (rule xfB)
        } 
        moreoverlemma"\java.lang.StringIndexOutOfBoundsException: Index 102 out of bounds for length 102
          using Suc_diff_le Trueassumethenshow?
        ultimately show ?thesis
assume :norm_eq_1pairwise_def
      qed
      also ".\ g t"
        using jn e xf01 t
        by (autolemma :
w? .
    qed
   have"f t - g t\ < 2 * e"
      using fj1 fj2 gj1 gj2  have".=java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 35
  }
      finally  (introimpI
    by (rule_tac"
qed

text\<open>The ``unpretentious'' formulation\<close> simpjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
proposition Stone_Weierstrass_polynomial_function_subspace
   : "
  shows "\g \ R. \x\S. \f x - g x\ < e"
proof -
  have u rp
  proofandsimp
              intro!  [OF "e
      byintro.continuous_on_add [OF fTopological_Spaces  real_polynomial_function
"\x. x \ S \ 0 \ f x + normf f"
      normf_upper f]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 3
  qed (use e in \<open>First, we need to show that they are continuous, differentiable and separable.\<close>
  then obtain "real_polynomial_function"
    by forceshows"
  thenand"x. x \ B \ norm x = 1"
    by (rule_tac               "independent "and)
qedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


theorem  \<open>subspace T\<close> by metis
then "
  shows "\F\UNIV \ R. LIM n sequentially. F n :> uniformly_on S f"
proof -
define  "h \ \n::nat. SOME g. g \ R \ (\x\S. \f x - g x\ < 1 / (1 + n))"
  showthesis     finite_imp_nat_seg_image_inj_on bymetis
  
    { fix e::real
      assume e: "0 < e"
      thenN"have: (
        by (auto simp:  fixes f:  fixes f :: o_typesB1java.lang.StringIndexOutOfBoundsException: Index 138 out of bounds for length 138
      { fix n :: nat and x :: 'a using continuous_polymonial_function [OFassms continuous_at_imp_continuous_on
        assume n: "N
         x " S"
        have "\ real (Suc n) < inverse e"
          using\<open>N \<le> n\<close> N using less_imp_inverse_less by force
        then have "1 / (1 + real n) \ e"
          using e by (simp add: field_simps)
         have"\f x - g x\ < e"
          using linear
      }java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
      thenhave "\\<^sub>F n in sequentially. \x\S. \f x - h n x\ < e"
        unfolding
        by    const)
    } 
    then show "uniform_limit S h f sequentially"
       uniform_limit_iffauto: dist_norm abs_minus_commute)
    show "h \ UNIV \ R"
      unfolding by (force: someI2_bex[OF Stone_Weierstrass_basic[ f]])
  qed
qed

text\<open>A HOL Light formulation\<close>
corollary Stone_Weierstrass_HOL:then ?case
    by(rule_tac ="< x+p2x exI (auto intro:derivative_eq_intros)
  assumes " case mult f1 f2)
          \AndPfjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
          "\f g. P(f) \ P(g) \ P(\x. f x + g x)" "\f g. P(f) \ P(g) \ P(\x. f x * g x)"
          "\x y. x \ S \ y \ S \ x \ y \ \f. P(f) \ f x \ f y"
          continuous_on"
       "0 < e"
    shows "\g. P(g) \ (\x \ S. \f x - g x\ < e)"
proof -
  interpret: function_ring_on "
    by unfold_locales (usebyrule_tac"\x. f1 x * p2 x + f2 x * p1 x" in exI) (auto intro!: derivative_eq_intros)
  showthesis
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    by blast
qed


subsection \<open>Polynomial functions\<close>

inductive real_polynomial_function :: "('a::real_normed_vector \ real) \ bool" where
    linear: "bounded_linear f \ real_polynomial_function f"
  | const "eal_polynomial_function(x. c)"
  | add:   "\real_polynomial_function f; real_polynomial_function g\ \ real_polynomial_function (\x. f x + g x)"
  |mult"

declare real_polynomial_function.intros [intro" \ Basis"

definition\<^marker>\<open>tag important\<close> polynomial_function :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> bool"
  where
   "polynomial_function p \ (\f. bounded_linear f \ real_polynomial_function (f o p))"

lemma real_polynomial_function_eq: "real_polynomial_function p = polynomial_function p"
unfoldinghave "\<>x. p' \java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
proof
   " p"
  then show " \f. bounded_linear f \ real_polynomial_function (f \ p)"
  proof (induction p rule: real_polynomial_function.induct)
    case (linear h) then show ?  then obtain  qf
      by (auto simp: bounded_linear_compose\>   
  next
    case (const ?thesis
      by (simp add: real_polynomial_function.const)
  next
    case (add h  proof
      by (force     "\x. (p has_vector_derivative (\b\Basis. qf b x)) (at x)"
  next
    case (mult h) thenby auto: has_vector_derivative_sum
      by (force simp: real_bounded_linear constreal_polynomial_function.)
  qed
next
  assumejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 show java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
    by (simp add: o_def)
qed

lemma polynomial_function_const [iff]: "polynomial_function (\x. c)"
  by (simp add: polynomial_function_def o_def const)

lemma:
  "bounded_linear f \ polynomial_function f"
  by (simp  "\<>b\Basis. ((x - y) \ b)\<^sup>2) \ 0"

lemma polynomial_function_id [iff]: "polynomial_function(\x. x)"
  y simp: polynomial_function_bounded_linear)

lemma polynomial_function_addintro]:
    "\polynomial_function f; polynomial_function g\ \ polynomial_function (\x. f x + g x)"
  by (auto simp:polynomial_function_def linear_add.add)

lemma polynomial_function_mult [intro Stone_Weierstrass_real_polynomial_function
  f: polynomial_function g:" g"
  shows "polynomial_function (\x. f x *\<^sub>R g x)"
proof -
  have "real_polynomial_function (\x. h (g x))" if "bounded_linear h" for h
     g that polynomial_function_def bounded_linear_def
    by (auto simp -
  avereal_polynomial_function
    by (simp add: f real_polynomial_function_eq)
  ultimatelyjava.lang.StringIndexOutOfBoundsException: Range [72, 13) out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    by (auto simp: linear f:"a:euclidean_space \ 'b::euclidean_space"
qed

  [intro
  assumes f: "polynomial_function f"
    shows "polynomial_function (\x. c *\<^sub>R f x)"
  by (rule polynomial_function_mult [OF polynomial_function_const f])

lemmapolynomial_function_minus [intro]:
  assumes f:  {  b : 'b
    shows (\<lambda>x. - f x)"
using [OF ,of1]by

lemma [intro:
    "\polynomial_function f; polynomial_function g\ \ polynomial_function (\x. f x - g x)"
  unfolding add_uminus_conv_diff [symmetric]
 (metis polynomial_function_add polynomial_function_minus)

lemma polynomial_function_sum [intro]:
    "\finite I; \i. i \ I \ polynomial_function (\x. f x i)\ \ polynomial_function (\x. sum (f x) I)"
by (induct I rule: finite_induct) auto

lemma real_polynomial_function_minus  then pf pf:
    "real_polynomial_function f \ real_polynomial_function (\x. - f x)"
  using polynomial_function_minus [of f]
  by (simp add: real_polynomial_function_eq   ?g="<lambda.\<Sum>b\<in>Basis. pf b x *\<^sub>R b"

lemma real_polynomial_function_diff     assume " \ S"
    " have"norm\<>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b - pf b x *\<^sub>R b) \<le> (\<Sum>b\<in>Basis. norm ((f x \<bullet> b) *\<^sub>R b - pf b x *\<^sub>R b))"
    of
  by (simp add: real_polynomial_function_eq (rule)

lemma
  assumes "real_polynomial_function p" showsby( add Real_Vector_Spaces.scaleR_diff_left[symmetric \<open>x \<in> S\<close>)
proof -     have..  "
  have "real_polynomial_function (\x. p x * Fields.inverse c)"
    using assms by auto
  then ?thesis
    by (simp add: divide_inverse)
qed

lemma real_polynomial_function_sum [intro]:
    "\finite I; \i. i \ I \ real_polynomial_function (\x. f x i)\ \ real_polynomial_function (\x. sum (f x) I)"
  using [of I f]
  by (simp add: real_polynomial_function_eq)

lemma real_polynomial_function_prodintro
  "\finite I; \i. i \ I \ real_polynomial_function (\x. f x i)\ \ real_polynomial_function (\x. prod (f x) I)"
  by (induct I rule using by (simp add: polynomial_function_sum polynomial_function_mult real_polynomial_function_eq)

lemma real_polynomial_function_gchoose
  obtains p    using euclidean_representation_sum_fun[of]  (metis(no_types, lifting)
proof
  show "real_polynomial_function (\x. (\i = 0..
    by force
qed

lemma real_polynomial_function_power [introproposition:
fixes:':euclidean_space 'b::euclidean_space"
  by (inductassumes S 

lemma real_polynomial_function_compose [intro]: -
   f: "polynomial_function f" and real_polynomial_function
    shows "real_polynomial_function g of"
  using g
proof (induction g rule: real_polynomial_function.induct)
  case(linear f)
  then show ?case
    using f polynomial_function_def"uniform_limit S g f "
next
  case (add f g)
  then show ?case
    using  by (auto : polynomial_function_def
next
  case (mult f g)
  then ?case
  using f mult by (auto simp: polynomial_function_def)
qedauto

lemmapolynomial_function_compose [intro]:
  assumes f: "polynomial_function f" and (eventually_elim) auto
    shows "polynomial_function (g o f)"
  usingreal_polynomial_function_compose [ f]
  by (auto simp: polynomial_function_def o_def)qed

lemma sum_max_0:
  fixesjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
  shows "(\i\max m n. x^i * (if i \ m then a i else 0)) = (\i\m. x^i * a i)"
proof -
  have "(\i\max m n. x^i * (if i \ m then a i else 0)) = (\i\max m n. (if i \ m then x^i * a i else 0))"
    by (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  also  ".. = (i\m. (if i \ m then x^i * a i else 0))"
    by (rule sum.mono_neutral_right) auto
     "polynomial_function g \ path g"
by(simp add continuous_on_polymonial_function)
  finally show ?thesis .
qed

lemma real_polynomial_function_imp_sum:
  assumes "real_polynomial_function f"
    \<exists>a n::nat. f = (\<lambda>x. \<Sum>i\<le>n. a i * x^i)"
using assms
proofinduct
  case (linear"\t. t \ {0..1} \ norm(p t - g t) < e"
  then obtain java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 7
    by (auto simp add     Stone_Weierstrass_polynomial_function "0.} "" java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  have "x * c = (\i\1. (if i = 0 then 0 else c) * x^i)" for x
    by (simp  showthesis
  withshowcase
    byfastforce
next
  case (const c)
  have "c = (\i\0. c * x^i)" for x
    by auto
  then show ?case
    by fastforce
  case (add f1 f2)
  then a1 a2n2 java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
    "f1 = (\x. \i\n1. a1 i * x^i)" "f2 = (\x. \i\n2. a2 i * x^i)"
    by auto
  thenhave"f1x+ x \Sumi\max n1 n2. ((if i \ n1 then a1 i else 0) + (if i \ n2 then a2 i else 0)) * x^i)"
      for xshow t*<subg 1 -q))<e /4java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    using sum_max_0 [where m=n1 and n=n2 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    by( add: .distrib max)
  then show ?case
    by force
  case (mult f1 f2)
  then obtain a1 n1 a2 n2 where
    "f1 = (x. \i\n1. a1 i * x^i)" "f2 = (\x. \i\n2. a2 i * x^i)"
    by auto
  then obtain b1 b2 where
    f1 (\<lambda>x. \<Sum>i\<le>n1. b1 i * x^i)" "f2 = (\<lambda>x. \<Sum>i\<le>n2. b2 i * x^i)"
    "b1 = (\i. if i\n1 then a1 i else 0)" "b2 = (\i. if i\n2 then a2 i else 0)"
    byauto
  then have "f1 x * f2 x = (\i\n1 + n2. (\k\i. b1 k * b2 (i - k)) * x ^ i)" for xqed
    using polynomial_product [of n1 
  hen ?case
    by force
qed

lemma S " connected S"
     "real_polynomial_function f \ (\a n. f = (\x. \i\n. a i * x^i))" (is "?lhs = ?rhs")
proof
  assume ?lhs  -
    by (have
next
  assume ?rhs then shownext
    by (autoshowthesis
qed

lemmapolynomial_function_iff_Basis_inner:
         setdist -S"
  shows "polynomial_function f \ (\b\Basis. real_polynomial_function (\x. inner (f x) b))"
        (is "?lhs = ?rhs")
unfolding
   
   "
  then showp:"
     (force add o_def
next
  fix h :: "'b \ real"
 " pf = x"" ="
  have "real_polynomial_function (h \ (\x. \b\Basis. (f x \ b) *\<^sub>R b))"
     clarsimp
    by (force simp " \ x'" "x' \ 1"
              intro!: real_polynomial_function_compose [  dist_commute )
  then show \<open>0 \<le> x'\<close> \<open>x' \<le> 1\<close> atLeastAtMost_iff eb imageI mem_ball path_image_def subset_iff)
    by (simp :
qed

subsection \<open>Stone-Weierstrass theorem for polynomial functions\<close>

text\<open>First, we need to show that they are continuous, differentiable and separable.\<close>

lemmausing  bysimp: inner_add_left inner_add_right
  assumes "real_polynomial_function f"
    shows rule_tacjava.lang.NullPointerException
using assms
by (induct f)      apply(simp: eq f')

lemma continuous_polymonial_function:
  fixes':real_normed_vector \ 'b::euclidean_space"
  assumes " (simpadd: differentiable_def)
    shows "continuous (at x) f"
proof (rule euclidean_isCont)
  show "\b. b \ Basis \ isCont (\x. (f x \ b) *\<^sub>R b) x"
  using assms continuous_real_polymonial_function
  by (force simp: polynomial_function_iff_Basis_inner intro: isCont_scaleR i ::"a:"
qedshowsg\<Longrightarrow> polynomial_function (\<lambda>x. g x \<bullet> i)"

lemma continuous_on_polymonial_function:
  fixes:
  assumes "polynomial_function f"
    showscontinuous_on
  using continuous_polymonial_function [
  by blast

lemma has_real_derivative_polynomial_function:
  assumes "real_polynomial_function p"
     "\p'. real_polynomial_function p' \
                 (\<forall>x. (p has_real_derivative (p' x)) (at x))"
using assms
proof (induct p)
  case linear
  then show
     (force simp:  const!: derivative_eq_intros
next
  case (const c)
  showcase
    by (rule_tac(metis polynomial_function_iff_Basis_inner)
  case (add
  thenobtain p1where
    "real_polynomial_function p1" "\x. (f1 has_real_derivative p1 x) (at x)"
    "real_polynomial_function p2" "\x. (f2 has_real_derivative p2 x) (at x)"
    by auto
  then show ?case
byrule_tac
  case simp:assms span_diff
  then obtain p1 p2 where
    "real_polynomial_function p1" t show by simp
    "real_polynomial_function p2" "\x. (f2 has_real_derivative p2 x) (at x)"
    by auto
  then show ?case
    using mult
    by (rule_tac x="\x. f1 x * p2 x + f2 x * p1 x" in exI) (auto intro!: derivative_eq_intros)
qed

lemma proof (rule vector_eq_dot_span [OF _ \<open>x \<in> span B\<close>])
  fixes p :: "real \ 'a::euclidean_space"
  assumes "polynomial_function p"
  obtains p' where "polynomial_function p'" "\<And>x. (p has_vector_derivative (p' x)) (at x)" ( add span_clauses)
proof -
  { fix b :    []:"\bullet if j ithen else 0)" ifjava.lang.NullPointerException
    assume "b \ Basis"
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 8
    obtain
 f:"a:: \ 'b::euclidean_space"
      by blast
    have "polynomial_function (\x. p' x *\<^sub>R b)"
      \<open>b \<in> Basis\<close> p' const [where 'a=real and c=0]
      by (simp add: polynomial_function_iff_Basis_innersubspace`S\<subseteq> T"
        obtains g where"polynomial_function g" "g ` S T"
      by (fastforce intro: derivative_eq_intros pd)
  }
  then obtain qf where qf:
      "\b. b \ Basis \ polynomial_function (qf b)"
      "\b x. b \ Basis \ ((\u. (p u \ b) *\<^sub>R b) has_vector_derivative qf b x) (at x)"
    bymetis
  show ?thesis
  proof
    show "\x. (p has_vector_derivative (\b\Basis. qf b x)) (at x)"
      apply (subst euclidean_representation_sum_fun [of p, symmetric])
      by (auto intro: has_vector_derivative_sum qf)
   (intro
qed

lemma real_polynomial_function_separable:
  fixes ::':java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  assumes "x : card_image)
proof -
havejava.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
  proof (rule real_polynomial_function_sum)
    show "\i. i \ Basis \ real_polynomial_function (\u. ((x - u) \ i)\<^sup>2)"
      by (auto simp: algebra_simps real_polynomial_function_diff const linear bounded_linear_inner_left)
  qed auto
  moreover have "(\b\Basis. ((x - y) \ b)\<^sup>2) \ 0"
    using assms by (force simp add: euclidean_eq_iff [of x y] sum_nonneg_eq_0_iff algebra_simps)
  ultimately show ?thesis
    by auto
qed

lemma Stone_Weierstrass_real_polynomial_function:
  fixes f :: "'a::euclidean_space \ real"
  assumes "compact S" "continuous_on S f" "0 < e"
  obtains g where "real_polynomial_function g" "\x. x \ S \ \f x - g x\ < e"
proof -
  interpret PR: function_ring_on "Collect real_polynomial_function"
  proof unfold_locales
  qed (use assms continuous_on_polymonial_function real_polynomial_function_eq 
       in \<open>auto intro: real_polynomial_function_separable\<close>)
  show ?thesis
    using PR.Stone_Weierstrass_basic [OF \<open>continuous_on S f\<close> \<open>0 < e\<close>] that by blast
qed

theorem Stone_Weierstrass_polynomial_function:
  fixes f :: "'a::euclidean_space \ 'b::euclidean_space"
  assumes S: "compact S"
      and f: "continuous_on S f"
      and e: "0 < e"
    shows "\g. polynomial_function g \ (\x \ S. norm(f x - g x) < e)"
proof -
  { fix b :: 'b
    assume "b \ Basis"
    have "\p. real_polynomial_function p \ (\x \ S. \f x \ b - p x\ < e / DIM('b))"
    proof (rule Stone_Weierstrass_real_polynomial_function [OF S _, of "\x. f x \ b" "e / card Basis"])
      show "continuous_on S (\x. f x \ b)"
        using f by (auto intro: continuous_intros)
    qed (use e in auto)
  }
  then obtain pf where pf:
      "\b. b \ Basis \ real_polynomial_function (pf b) \ (\x \ S. \f x \ b - pf b x\ < e / DIM('b))"
    by metis
  let ?g = "\x. \b\Basis. pf b x *\<^sub>R b"
  { fix x
    assume "x \ S"
    have "norm (\b\Basis. (f x \ b) *\<^sub>R b - pf b x *\<^sub>R b) \ (\b\Basis. norm ((f x \ b) *\<^sub>R b - pf b x *\<^sub>R b))"
      by (rule norm_sum)
    also have "... < of_nat DIM('b) * (e / DIM('b))"
    proof (rule sum_bounded_above_strict)
      show "\i. i \ Basis \ norm ((f x \ i) *\<^sub>R i - pf i x *\<^sub>R i) < e / real DIM('b)"
        by (simp add: Real_Vector_Spaces.scaleR_diff_left [symmetric] pf \<open>x \<in> S\<close>)
    qed (rule DIM_positive)
    also have "... = e"
      by (simp add: field_simps)
    finally have "norm (\b\Basis. (f x \ b) *\<^sub>R b - pf b x *\<^sub>R b) < e" .
  }
  then have "\x\S. norm ((\b\Basis. (f x \ b) *\<^sub>R b) - ?g x) < e"
    by (auto simp flip: sum_subtractf)
  moreover
  have "polynomial_function ?g"
    using pf by (simp add: polynomial_function_sum polynomial_function_mult real_polynomial_function_eq)
  ultimately show ?thesis
    using euclidean_representation_sum_fun [of f] by (metis (no_types, lifting))
qed

proposition Stone_Weierstrass_uniform_limit:
  fixes f :: "'a::euclidean_space \ 'b::euclidean_space"
  assumes S: "compact S"
    and f: "continuous_on S f"
  obtains g where "uniform_limit S g f sequentially" "\n. polynomial_function (g n)"
proof -
  have pos: "inverse (Suc n) > 0" for n by auto
  obtain g where g: "\n. polynomial_function (g n)" "\x n. x \ S \ norm(f x - g n x) < inverse (Suc n)"
    using Stone_Weierstrass_polynomial_function[OF S f pos]
    by metis
  have "uniform_limit S g f sequentially"
  proof (rule uniform_limitI)
    fix e::real assume "0 < e"
    with LIMSEQ_inverse_real_of_nat have "\\<^sub>F n in sequentially. inverse (Suc n) < e"
      by (rule order_tendstoD)
    moreover have "\\<^sub>F n in sequentially. \x\S. dist (g n x) (f x) < inverse (Suc n)"
      using g by (simp add: dist_norm norm_minus_commute)
    ultimately show "\\<^sub>F n in sequentially. \x\S. dist (g n x) (f x) < e"
      by (eventually_elim) auto
  qed
  then show ?thesis using g(1) ..
qed


subsection\<open>Polynomial functions as paths\<close>

text\<open>One application is to pick a smooth approximation to a path,
or just pick a smooth path anyway in an open connected set\<close>

lemma path_polynomial_function:
    fixes g  :: "real \ 'b::euclidean_space"
    shows "polynomial_function g \ path g"
  by (simp add: path_def continuous_on_polymonial_function)

lemma path_approx_polynomial_function:
    fixes g :: "real \ 'b::euclidean_space"
    assumes "path g" "0 < e"
    obtains p where "polynomial_function p" "pathstart p = pathstart g" "pathfinish p = pathfinish g"
                    "\t. t \ {0..1} \ norm(p t - g t) < e"
proof -
  obtain q where poq: "polynomial_function q" and noq: "\x. x \ {0..1} \ norm (g x - q x) < e/4"
    using Stone_Weierstrass_polynomial_function [of "{0..1}" g "e/4"] assms
    by (auto simp: path_def)
  define pf where "pf \ \t. q t + (g 0 - q 0) + t *\<^sub>R (g 1 - q 1 - (g 0 - q 0))"
  show thesis
  proof 
    show "polynomial_function pf"
      by (force simp add: poq pf_def)
    show "norm (pf t - g t) < e"
      if "t \ {0..1}" for t
    proof -
      have *: "norm (((q t - g t) + (g 0 - q 0)) + (t *\<^sub>R (g 1 - q 1) + t *\<^sub>R (q 0 - g 0))) < (e/4 + e/4) + (e/4+e/4)"
      proof (intro Real_Vector_Spaces.norm_add_less)
        show "norm (q t - g t) < e / 4"
          by (metis noq norm_minus_commute that)
        show "norm (t *\<^sub>R (g 1 - q 1)) < e / 4"
          using noq that le_less_trans [OF mult_left_le_one_le noq]
          by auto
        show "norm (t *\<^sub>R (q 0 - g 0)) < e / 4"
          using noq that le_less_trans [OF mult_left_le_one_le noq]
          by simp (metis norm_minus_commute order_refl zero_le_one)
      qed (use noq norm_minus_commute that in auto)
      then show ?thesis
        by (auto simp add: algebra_simps pf_def)
    qed
  qed (auto simp add: path_defs pf_def)
qed

proposition connected_open_polynomial_connected:
  fixes S :: "'a::euclidean_space set"
  assumes S: "open S" "connected S"
      and "x \ S" "y \ S"
    shows "\g. polynomial_function g \ path_image g \ S \ pathstart g = x \ pathfinish g = y"
proof -
  have "path_connected S" using assms
    by (simp add: connected_open_path_connected)
  with \<open>x \<in> S\<close> \<open>y \<in> S\<close> obtain p where p: "path p" "path_image p \<subseteq> S" "pathstart p = x" "pathfinish p = y"
    by (force simp: path_connected_def)
  have "\e. 0 < e \ (\x \ path_image p. ball x e \ S)"
  proof (cases "S = UNIV")
    case True then show ?thesis
      by (simp add: gt_ex)
  next
    case False
    show ?thesis
    proof (intro exI conjI ballI)
      show "\x. x \ path_image p \ ball x (setdist (path_image p) (-S)) \ S"
        using setdist_le_dist [of _ "path_image p" _ "-S"by fastforce
      show "0 < setdist (path_image p) (- S)"
        using S p False
        by (fastforce simp add: setdist_gt_0_compact_closed compact_path_image open_closed)
    qed
  qed
  then obtain e where "0 < e"and eb: "\x. x \ path_image p \ ball x e \ S"
    by auto
  obtain pf where "polynomial_function pf" and pf: "pathstart pf = pathstart p" "pathfinish pf = pathfinish p"
                   and pf_e: "\t. t \ {0..1} \ norm(pf t - p t) < e"
    using path_approx_polynomial_function [OF \<open>path p\<close> \<open>0 < e\<close>] by blast
  show ?thesis 
  proof (intro exI conjI)
    show "polynomial_function pf"
      by fact
    show "pathstart pf = x" "pathfinish pf = y"
      by (simp_all add: p pf)
    show "path_image pf \ S"
      unfolding path_image_def
    proof clarsimp
      fix x'::real
      assume "0 \ x'" "x' \ 1"
      then have "dist (p x') (pf x') < e"
        by (metis atLeastAtMost_iff dist_commute dist_norm pf_e)
      then show "pf x' \ S"
        by (metis \<open>0 \<le> x'\<close> \<open>x' \<le> 1\<close> atLeastAtMost_iff eb imageI mem_ball path_image_def subset_iff)
    qed
  qed
qed

lemma differentiable_componentwise_within:
   "f differentiable (at a within S) \
    (\<forall>i \<in> Basis. (\<lambda>x. f x \<bullet> i) differentiable at a within S)"
proof -
  { assume "\i\Basis. \D. ((\x. f x \ i) has_derivative D) (at a within S)"
    then obtain f' where f':
           "\i. i \ Basis \ ((\x. f x \ i) has_derivative f' i) (at a within S)"
      by metis
    have eq: "(\x. (\j\Basis. f' j x *\<^sub>R j) \ i) = f' i" if "i \ Basis" for i
      using that by (simp add: inner_add_left inner_add_right)
    have "\D. \i\Basis. ((\x. f x \ i) has_derivative (\x. D x \ i)) (at a within S)"
      apply (rule_tac x="\x::'a. (\j\Basis. f' j x *\<^sub>R j) :: 'b" in exI)
      apply (simp add: eq f')
      done
  }
  then show ?thesis
    apply (simp add: differentiable_def)
    using has_derivative_componentwise_within
    by blast
qed

lemma polynomial_function_inner [intro]:
  fixes i :: "'a::euclidean_space"
  shows "polynomial_function g \ polynomial_function (\x. g x \ i)"
  apply (subst euclidean_representation [where x=i, symmetric])
  apply (force simp: inner_sum_right polynomial_function_iff_Basis_inner polynomial_function_sum)
  done

text\<open> Differentiability of real and vector polynomial functions.\<close>

lemma differentiable_at_real_polynomial_function:
   "real_polynomial_function f \ f differentiable (at a within S)"
  by (induction f rule: real_polynomial_function.induct)
     (simp_all add: bounded_linear_imp_differentiable)

lemma differentiable_on_real_polynomial_function:
   "real_polynomial_function p \ p differentiable_on S"
by (simp add: differentiable_at_imp_differentiable_on differentiable_at_real_polynomial_function)

lemma differentiable_at_polynomial_function:
  fixes f :: "_ \ 'a::euclidean_space"
  shows "polynomial_function f \ f differentiable (at a within S)"
  by (metis differentiable_at_real_polynomial_function polynomial_function_iff_Basis_inner differentiable_componentwise_within)

lemma differentiable_on_polynomial_function:
  fixes f :: "_ \ 'a::euclidean_space"
  shows "polynomial_function f \ f differentiable_on S"
by (simp add: differentiable_at_polynomial_function differentiable_on_def)

lemma vector_eq_dot_span:
 style='color:red'>fixes
 i :: "'a::euclidean_space"
  shows "polynomial_function g \ polynomial_function (\x. g x \ i)"
  apply( euclidean_representationwhere, ])qed
  apply (force simp: inner_sum_right java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  done

text

lemma:
   "real_polynomial_function f \ f differentiable (at a within S)"
  assumee:"0< java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
     (simp_all add: bounded_linear_imp_differentiable)

lemma differentiable_on_real_polynomial_function:
   "real_polynomial_function p \ p differentiable_on S"
by (simp add: differentiable_at_imp_differentiable_on differentiable_at_real_polynomial_function)

lemma differentiable_at_polynomial_function:
  fixes f :: "_ \ 'a::euclidean_space"
  shows "polynomial_function f \ f differentiable (at a within S)"
 eby( add field_simps

lemma:
  fixes f then"
  shows "polynomial_function f \ f differentiable_on S"
by  unfolding

lemma vector_eq_dot_span:
  assumes   showjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  shows "x = y"
proof
  \<> Light
    Stone_Weierstrass_HOL
  moreover have "x - y \ span B"
    by simp
  ultimately have "x - y = g whereyx
    using orthogonal_to_span orthogonal_self pos
    then show ?thesis by simp 
qed

lemma orthonormal_basis_expand:
  assumes
and 1:"
      and "x \ span B"
      java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
     "(i\B. (x \ i) *\<^sub>R i) = x"
proof
  show "(\i\B. (x \ i) *\<^sub>R i) \ span B"
 : " \\<^sub>F n in sequentially. \x\S. dist (g n x) (f x) < e"
showi  java.lang.NullPointerException
  proof ? using
    have [simp
      using\<open>Polynomial functions as paths\<close>" p = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      by (
     "
      bysimp:inner_sum_right
     "polynomial_function g \ path g"
       java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 30
    bysimp:real_polynomial_functiong::" \ 'b::euclidean_space"
    asassumes"path g" "0 < "
      next
  qed



theoremjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 7
  fixes       Stone_Weierstrass_polynomial_function0}"g]
  assumes
      and contf  where
      and
      and "subspace T" "f ` S \ T"
    btains o_def real_polynomial_function)
                    "\x. x \ S \ norm(f x - g x) < e"
proof -
  obtain B wherejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             and B1 f:" norm(t- java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 39
             and "independent B" and cardB"norm( <>1-1)
             andproof  " t*R( g0)e/java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    by ( norm_minus_commute )
  thenB
    byshow
   obtainnat   java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 75
ing metis
bysimpjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    by (auto      auto simpS" " "Sjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
havejava.lang.NullPointerException
   af:" f"
  have cont path_connected assms
--> --------------------

--> maximum size reached

--> --------------------

98%


¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.31Bemerkung:  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.