-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPrueba_por_induccion_6.lean
114 lines (103 loc) · 2.57 KB
/
Prueba_por_induccion_6.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
-- Prueba por inducción 6: (∀ m n k ∈ ℕ) m^(n + k) = m^n * m^k
-- ===========================================================
import data.nat.basic
import tactic
open nat
variables (m n k : ℕ)
-- 1ª demostración
example : m^(n + k) = m^n * m^k :=
begin
induction k with k HI,
{ rw add_zero,
rw pow_zero,
rw mul_one, },
{ rw add_succ,
rw pow_succ',
rw HI,
rw pow_succ',
rw mul_assoc, },
end
-- 2ª demostración
example : m^(n + k) = m^n * m^k :=
begin
induction k with k HI,
{ calc
m^(n + 0)
= m^n : by rw add_zero
... = m^n * 1 : by rw mul_one
... = m^n * m^0 : by rw pow_zero, },
{ calc
m^(n + succ k)
= m^(succ (n + k)) : by rw nat.add_succ
... = m^(n + k) * m : by rw pow_succ'
... = m^n * m^k * m : by rw HI
... = m^n * (m^k * m) : by rw mul_assoc
... = m^n * m^(succ k) : by rw pow_succ', },
end
-- 3ª demostración
example : m^(n + k) = m^n * m^k :=
begin
induction k with k HI,
{ rw [add_zero,
pow_zero,
mul_one], },
{ rw [add_succ,
pow_succ',
HI,
pow_succ',
mul_assoc], },
end
-- 4ª demostración
example : m^(n + k) = m^n * m^k :=
begin
induction k with k HI,
{ simp only [add_zero,
pow_zero,
mul_one], },
{ simp only [add_succ,
pow_succ',
HI,
pow_succ',
mul_assoc], },
end
-- 5ª demostración
example : m^(n + k) = m^n * m^k :=
begin
induction k with k HI,
{ simp, },
{ simp [add_succ,
HI,
pow_succ',
mul_assoc], },
end
-- 6ª demostración
example : m^(n + k) = m^n * m^k :=
by induction k; simp [*, add_succ, pow_succ', mul_assoc]
-- 7ª demostración
example : m^(n + k) = m^n * m^k :=
nat.rec_on k
(show m^(n + 0) = m^n * m^0, from
calc
m^(n + 0)
= m^n : by rw add_zero
... = m^n * 1 : by rw mul_one
... = m^n * m^0 : by rw pow_zero)
(assume k,
assume HI : m^(n + k) = m^n * m^k,
show m^(n + succ k) = m^n * m^(succ k), from
calc
m^(n + succ k)
= m^(succ (n + k)) : by rw nat.add_succ
... = m^(n + k) * m : by rw pow_succ'
... = m^n * m^k * m : by rw HI
... = m^n * (m^k * m) : by rw mul_assoc
... = m^n * m^(succ k) : by rw pow_succ')
-- 8ª demostración
example : m^(n + k) = m^n * m^k :=
nat.rec_on k
(by simp)
(λ n HI, by simp [HI, add_succ, pow_succ', mul_assoc])
-- 9ª demostración
example : m^(n + k) = m^n * m^k :=
-- by library_search
pow_add m n k