Skip to content

Commit 33ef14b

Browse files
shorter proof of exercise_4_1a by Jeremy
1 parent 876bf5f commit 33ef14b

File tree

1 file changed

+30
-194
lines changed

1 file changed

+30
-194
lines changed

benchmark/benchmark_to_publish/formal/Rudin.lean

Lines changed: 30 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import .common
33
open real complex
44
open topological_space
55
open filter
6-
open_locale real
6+
open_locale real
77
open_locale topology
88
open_locale big_operators
99
open_locale complex_conjugate
@@ -30,7 +30,7 @@ begin
3030
end
3131

3232
theorem exercise_1_2 : ¬ ∃ (x : ℚ), ( x ^ 2 = 12 ) :=
33-
sorry
33+
sorry
3434

3535
theorem exercise_1_4
3636
(α : Type*) [partial_order α]
@@ -56,15 +56,15 @@ begin
5656
exact xlez.trans zley,
5757
end
5858

59-
theorem exercise_1_5 (A minus_A : set ℝ) (hA : A.nonempty)
59+
theorem exercise_1_5 (A minus_A : set ℝ) (hA : A.nonempty)
6060
(hA_bdd_below : bdd_below A) (hminus_A : minus_A = {x | -x ∈ A}) :
6161
Inf A = Sup minus_A :=
6262
sorry
6363

64-
theorem exercise_1_8 : ¬ ∃ (r : ℂ → ℂ → Prop), is_linear_order ℂ r :=
64+
theorem exercise_1_8 : ¬ ∃ (r : ℂ → ℂ → Prop), is_linear_order ℂ r :=
6565
sorry
6666

67-
theorem exercise_1_11a (z : ℂ) :
67+
theorem exercise_1_11a (z : ℂ) :
6868
∃ (r : ℝ) (w : ℂ), abs w = 1 ∧ z = r * w :=
6969
begin
7070
by_cases h : z = 0,
@@ -88,11 +88,11 @@ begin
8888
},
8989
end
9090

91-
theorem exercise_1_12 (n : ℕ) (f : ℕ → ℂ) :
91+
theorem exercise_1_12 (n : ℕ) (f : ℕ → ℂ) :
9292
abs (∑ i in finset.range n, f i) ≤ ∑ i in finset.range n, abs (f i) :=
93-
sorry
93+
sorry
9494

95-
theorem exercise_1_13 (x y : ℂ) :
95+
theorem exercise_1_13 (x y : ℂ) :
9696
|(abs x) - (abs y)| ≤ abs (x - y) :=
9797
sorry
9898

@@ -321,192 +321,28 @@ sorry
321321
theorem exercise_4_1a
322322
: ∃ (f : ℝ → ℝ), (∀ (x : ℝ), tendsto (λ y, f(x + y) - f(x - y)) (𝓝 0) (𝓝 0)) ∧ ¬ continuous f :=
323323
begin
324-
use λ x, if x = 0 then (1 : ℝ) else (0 : ℝ),
325-
split,
326-
{
327-
intro x,
328-
by_cases h : x = 0,
329-
{
330-
rw h, simp,
331-
},
332-
{
333-
intros X hX,
334-
refine mem_nhds_iff.2 _,
335-
use {z | -|x| < z ∧ z < |x|},
336-
simp,
337-
split,
338-
{
339-
set f := (λ (y : ℝ), ite (x + y = 0) (1 : ℝ) 0 - ite (x - y = 0) 1 0),
340-
set f₁ := (λ (y : ℝ), ite (x + y = 0) (1 : ℝ) 0),
341-
set f₂ := (λ (y : ℝ), - ite (x - y = 0) (1 : ℝ) 0),
342-
set Y := {z : ℝ | - | x | < z ∧ z < | x |},
343-
have : (0 : ℝ) ∈ X := mem_of_mem_nhds hX,
344-
have h₁: {(0 : ℝ)} ⊆ X := set.singleton_subset_iff.mpr this,
345-
have h₂ : f = f₁ + f₂ := rfl,
346-
have g₁ : ∀ y ∈ Y, ¬x + y = 0 := by {
347-
simp,
348-
intros y hy₁ hy₂ hy₃,
349-
by_cases hx : 0 < x,
350-
rw abs_of_pos hx at *,
351-
linarith,
352-
simp at hx,
353-
have hx : x < 0 := lt_of_le_of_ne hx h,
354-
rw abs_of_neg hx at *,
355-
linarith,
356-
},
357-
have g₂ : ∀ y ∈ Y, ¬x - y = 0 := by {
358-
simp,
359-
intros y hy₁ hy₂ hy₃,
360-
by_cases hx : 0 < x,
361-
rw abs_of_pos hx at *,
362-
linarith,
363-
simp at hx,
364-
have hxx : x < 0 := lt_of_le_of_ne hx h,
365-
rw abs_of_neg hxx at *,
366-
linarith,
367-
},
368-
have gg₁ : ∀ y ∈ Y, f₁ y = (0 : ℝ) := by {
369-
intros a b,
370-
simp,
371-
intro c,
372-
exact g₁ a b c,
373-
},
374-
have gg₂ : ∀ y ∈ Y, f₂ y = (0 : ℝ) := by {
375-
intros a b,
376-
simp,
377-
intro c,
378-
exact g₂ a b c,
379-
},
380-
have gg : ∀ z ∈ Y, f z = (0 : ℝ) := by {
381-
intros a b,
382-
simp [h₂],
383-
rw [gg₁ a b, gg₂ a b],
384-
norm_num,
385-
},
386-
have : f ⁻¹' {(0 : ℝ)} ⊆ f ⁻¹' X := set.preimage_mono h₁,
387-
exact set.subset.trans gg this,
388-
},
389-
{
390-
split,
391-
{
392-
rw set.set_of_and,
393-
apply is_open.inter _ _,
394-
apply is_open_lt' (-|x|),
395-
apply is_open_gt' (|x|),
396-
},
397-
{
398-
exact h,
399-
}
400-
},
401-
},
402-
},
403-
{
404-
intro h,
405-
let f : (ℝ → ℝ) := λ x, if x = 0 then (1 : ℝ) else 0,
406-
have g : f 0 = 1 := if_pos rfl,
407-
have g₁ : f 1 = 0 := by {refine if_neg _, norm_num,},
408-
have : continuous_at f 0 := continuous.continuous_at h,
409-
have := continuous_at.tendsto this,
410-
rw g at this,
411-
unfold tendsto at this,
412-
have := filter.le_def.1 this,
413-
simp at this,
414-
have := this (set.Ioo (0.5 : ℝ) (1.5 : ℝ)),
415-
have i : set.Ioo (0.5 : ℝ) (1.5 : ℝ) ∈ 𝓝 (1 : ℝ) := by {
416-
apply is_open.mem_nhds,
417-
exact is_open_Ioo,
418-
norm_num,
419-
},
420-
have h₁ : set.range f = {(0 : ℝ), 1} := by {
421-
ext, split,
422-
{
423-
intro h,
424-
simp,
425-
cases h,
426-
by_cases r : h_w = 0,
427-
rw r at h_h,
428-
rw g at h_h,
429-
right,
430-
exact eq.symm h_h,
431-
have ii : f h_w = 0 := if_neg r,
432-
rw ii at h_h,
433-
left,
434-
symmetry,
435-
exact h_h,
436-
},
437-
intro h,
438-
apply set.mem_range.2,
439-
by_cases r : x = 0,
440-
{
441-
use 1,
442-
rw g₁,
443-
apply eq.symm _,
444-
exact r,
445-
},
446-
{
447-
have i : x ∈ {(1 : ℝ)} := by {
448-
apply set.mem_of_mem_insert_of_ne _ r,
449-
exact h,
450-
},
451-
use 0,
452-
rw g,
453-
exact eq.symm i,
454-
},
455-
},
456-
have h₂ : set.Ioo ((1 / 2 : ℝ)) (3 / 2) ∩ {(0 : ℝ), 1} = {(1 : ℝ)} := by {
457-
unfold set.Ioo,
458-
ext, split,
459-
{
460-
intro h,
461-
simp at h,
462-
cases h,
463-
cases h_right,
464-
rw h_right at h_left,
465-
norm_num at h_left,
466-
exact h_right,
467-
},
468-
{
469-
intro h,
470-
have : x = 1 := h,
471-
rw this,
472-
norm_num,
473-
},
474-
},
475-
have h₃ : {0} ⊆ f ⁻¹' {(1 : ℝ)} := set.singleton_subset_iff.mpr g,
476-
have j : f ⁻¹' set.Ioo (1 / 2) (3 / 2) = {0} := by {
477-
rw [← set.preimage_inter_range, h₁, h₂],
478-
ext,
479-
split,
480-
{
481-
intro hx,
482-
by_contradiction h₄,
483-
have : ¬ x = 0 := h₄,
484-
have h₅ : f x = 0 := if_neg this,
485-
have : f x = 1 := hx,
486-
rw h₅ at this,
487-
norm_num at this,
488-
},
489-
intro x, exact h₃ x,
490-
},
491-
have := this i,
492-
rw j at this,
493-
have := mem_nhds_iff.1 this,
494-
cases this with s h,
495-
cases h with k g,
496-
cases g,
497-
by_cases a : s = {0},
498-
{
499-
rw a at g_left,
500-
have := dense_compl_singleton (0 : ℝ),
501-
have := dense_compl_singleton_iff_not_open.1 this,
502-
contradiction,
503-
},
504-
{
505-
have : {(0 : ℝ)} ⊆ s := set.zero_subset.mpr g_right,
506-
have : s = {(0 : ℝ)} := set.subset.antisymm k this,
507-
contradiction,
508-
},
509-
},
324+
let f := λ x : ℝ, if x = 0 then (1 : ℝ) else (0 : ℝ),
325+
use f, split,
326+
{ intro x,
327+
suffices : (λ y, f (x + y) - f(x - y)) =ᶠ[𝓝 0] (λ y, 0),
328+
{ simp [filter.tendsto_congr' this, tendsto_const_nhds_iff] },
329+
by_cases h : x = 0,
330+
{ dsimp [f], simp [h] },
331+
have : set.Ioo (-|x|) (|x|) ∈ 𝓝 (0 : ℝ),
332+
{ apply Ioo_mem_nhds; simp [h], },
333+
apply eventually_of_mem this,
334+
intro y, simp, dsimp [f],
335+
intros h1 h2,
336+
rw [if_neg, if_neg]; simp [lt_abs, neg_lt] at *; cases h1; cases h2; linarith },
337+
simp [continuous_iff_continuous_at, continuous_at, tendsto_nhds],
338+
use [0, set.Ioo 0 2, is_open_Ioo], split,
339+
{ dsimp [f], simp, norm_num },
340+
simp [mem_nhds_iff_exists_Ioo_subset],
341+
intros a b aneg bpos h,
342+
have : b / 2 ∈ set.Ioo a b,
343+
{ simp, split; linarith },
344+
have := h this,
345+
simpa [f, (ne_of_lt bpos).symm] using this,
510346
end
511347

512348
theorem exercise_4_2a

0 commit comments

Comments
 (0)