-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ejercicio_con_calc.lean
69 lines (56 loc) · 1.83 KB
/
Ejercicio_con_calc.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
-- ---------------------------------------------------------------------
-- Ejercicio. Demostrar que si a, b, c y d son números reales, entonces
-- (a + b) * (c + d) = a * c + a * d + b * c + b * d
-- ---------------------------------------------------------------------
import data.real.basic
variables a b c d : ℝ
-- 1ª demostración
-- ===============
example
: (a + b) * (c + d) = a * c + a * d + b * c + b * d :=
calc
(a + b) * (c + d)
= a * (c + d) + b * (c + d) : by rw add_mul
... = a * c + a * d + b * (c + d) : by rw mul_add
... = a * c + a * d + (b * c + b * d) : by rw mul_add
... = a * c + a * d + b * c + b * d : by rw ←add_assoc
-- 2ª demostración
-- ===============
example
: (a + b) * (c + d) = a * c + a * d + b * c + b * d :=
calc
(a + b) * (c + d)
= a * (c + d) + b * (c + d) : by ring
... = a * c + a * d + b * (c + d) : by ring
... = a * c + a * d + (b * c + b * d) : by ring
... = a * c + a * d + b * c + b * d : by ring
-- 3ª demostración
-- ===============
example : (a + b) * (c + d) = a * c + a * d + b * c + b * d :=
by ring
-- 4ª demostración
-- ===============
example
: (a + b) * (c + d) = a * c + a * d + b * c + b * d :=
begin
rw add_mul,
rw mul_add,
rw mul_add,
rw ← add_assoc,
end
-- El desarrollo de la prueba es
--
-- a b c d : ℝ
-- ⊢ (a + b) * (c + d) = a * c + a * d + b * c + b * d
-- rw add_mul,
-- ⊢ a * (c + d) + b * (c + d) = a * c + a * d + b * c + b * d
-- rw mul_add,
-- ⊢ a * c + a * d + b * (c + d) = a * c + a * d + b * c + b * d
-- rw mul_add,
-- ⊢ a * c + a * d + (b * c + b * d) = a * c + a * d + b * c + b * d
-- rw ← add_assoc,
-- no goals
-- 5ª demostración
-- ===============
example : (a + b) * (c + d) = a * c + a * d + b * c + b * d :=
by rw [add_mul, mul_add, mul_add, ←add_assoc]