-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLimite_de_suma.lean
132 lines (119 loc) · 3.67 KB
/
Limite_de_suma.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
-- Limite de la suma de dos sucesiones convergentes
-- ================================================
import data.real.basic
variables (u v : ℕ → ℝ)
variables (a b c : ℝ)
-- ----------------------------------------------------
-- Ejercicio 1. Definir la notación |x| para el valor
-- absoluto de x.
-- ----------------------------------------------------
notation `|`x`|` := abs x
-- ----------------------------------------------------
-- Ejercicio 2. Definir la función
-- limite : (ℕ → ℝ) → ℝ → Prop
-- tal que (limite u c) expresa que c es el límite de
-- la sucesión u.
-- ----------------------------------------------------
def limite : (ℕ → ℝ) → ℝ → Prop :=
λ u c, ∀ ε > 0, ∃ N, ∀ n ≥ N, |u n - c| ≤ ε
-- ----------------------------------------------------
-- Ejercicio 3. Demostrar que si a es el límite de la
-- sucesión u y b el de la v, entonces el límite de
-- (u + v) es (a + b).
-- ----------------------------------------------------
-- 1ª demostración
example
(hu : limite u a)
(hv : limite v b)
: limite (u + v) (a + b) :=
begin
intros ε hε,
have hε2 : 0 < ε / 2,
{ linarith },
cases hu (ε / 2) hε2 with Nu hNu,
cases hv (ε / 2) hε2 with Nv hNv,
clear hu hv hε2 hε,
use max Nu Nv,
intros n hn,
have hn₁ : n ≥ Nu,
{ exact le_of_max_le_left hn },
specialize hNu n hn₁,
have hn₂ : n ≥ Nv,
{ exact le_of_max_le_right hn },
specialize hNv n hn₂,
clear hn hn₁ hn₂ Nu Nv,
calc |(u + v) n - (a + b)|
= |u n + v n - (a + b)| : rfl
... = |(u n - a) + (v n - b)| : by {congr, ring}
... ≤ |u n - a| + |v n - b| : by apply abs_add
... ≤ ε / 2 + ε / 2 : by linarith
... = ε : by apply add_halves,
end
-- 2ª demostración
-- ===============
lemma max_ge_iff
{α : Type*}
[linear_order α]
{p q r : α}
: r ≥ max p q ↔ r ≥ p ∧ r ≥ q :=
max_le_iff
example
(hu : limite u a)
(hv : limite v b)
: limite (u + v) (a + b) :=
begin
intros ε hε,
cases hu (ε/2) (by linarith) with Nu hNu,
cases hv (ε/2) (by linarith) with Nv hNv,
clear hu hv hε,
use max Nu Nv,
intros n hn,
cases max_ge_iff.mp hn with hn₁ hn₂,
have cota₁ : |u n - a| ≤ ε/2,
from hNu n hn₁,
have cota₂ : |v n - b| ≤ ε/2,
from hNv n hn₂,
calc |(u + v) n - (a + b)|
= |u n + v n - (a + b)| : rfl
... = |(u n - a) + (v n - b)| : by { congr, ring }
... ≤ |u n - a| + |v n - b| : by apply abs_add
... ≤ ε : by linarith,
end
-- 3ª demostración
example
(hu : limite u a)
(hv : limite v b)
: limite (u + v) (a + b) :=
begin
intros ε hε,
cases hu (ε/2) (by linarith) with Nu hNu,
cases hv (ε/2) (by linarith) with Nv hNv,
clear hu hv hε,
use max Nu Nv,
intros n hn,
cases max_ge_iff.mp hn with hn₁ hn₂,
calc |(u + v) n - (a + b)|
= |u n + v n - (a + b)| : rfl
... = |(u n - a) + (v n - b)| : by { congr, ring }
... ≤ |u n - a| + |v n - b| : by apply abs_add
... ≤ ε/2 + ε/2 : add_le_add (hNu n hn₁) (hNv n hn₂)
... = ε : by simp
end
-- 4ª demostración
example
(hu : limite u a)
(hv : limite v b)
: limite (u + v) (a + b) :=
begin
intros ε hε,
cases hu (ε/2) (by linarith) with Nu hNu,
cases hv (ε/2) (by linarith) with Nv hNv,
use max Nu Nv,
intros n hn,
rw max_ge_iff at hn,
calc |(u + v) n - (a + b)|
= |u n + v n - (a + b)| : rfl
... = |(u n - a) + (v n - b)| : by { congr, ring }
... ≤ |u n - a| + |v n - b| : by apply abs_add
... ≤ ε : by linarith [hNu n (by linarith), hNv n (by linarith)],
end