-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPruebas_de_P∧Q→Q∧P.lean
102 lines (85 loc) · 1.8 KB
/
Pruebas_de_P∧Q→Q∧P.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
-- Pruebas en Lean de P ∧ Q → Q ∧ P
-- ================================
-- ----------------------------------------------------
-- Ej. 1. Demostrar que
-- P ∧ Q → Q ∧ P
-- ----------------------------------------------------
import tactic
variables (P Q : Prop)
-- 1ª demostración
example : P ∧ Q → Q ∧ P :=
assume h : P ∧ Q,
have hP : P,
from and.left h,
have hQ : Q,
from and.right h,
show Q ∧ P,
from and.intro hQ hP
-- 2ª demostración
example : P ∧ Q → Q ∧ P :=
assume h : P ∧ Q,
have hP : P,
from h.left,
have hQ : Q,
from h.right,
show Q ∧ P,
from ⟨hQ, hP⟩
-- 3ª demostración
example : P ∧ Q → Q ∧ P :=
assume h : P ∧ Q,
have hP : P,
from h.1,
have hQ : Q,
from h.2,
show Q ∧ P,
from ⟨hQ, hP⟩
-- 4ª demostración
example : P ∧ Q → Q ∧ P :=
assume h : P ∧ Q,
have hP : P := h.1,
have hQ : Q := h.2,
show Q ∧ P,
from ⟨hQ, hP⟩
-- 5ª demostración
example : P ∧ Q → Q ∧ P :=
assume h : P ∧ Q,
show Q ∧ P,
from ⟨h.2, h.1⟩
-- 6ª demostración
example : P ∧ Q → Q ∧ P :=
assume h : P ∧ Q, ⟨h.2, h.1⟩
-- 7ª demostración
example : P ∧ Q → Q ∧ P :=
λ h, ⟨h.2, h.1⟩
-- 8ª demostración
example : P ∧ Q → Q ∧ P :=
begin
intro h,
cases h with hP hQ,
split,
{ exact hQ, },
{ exact hP, },
end
-- 9ª demostración
example : P ∧ Q → Q ∧ P :=
begin
rintro ⟨hP, hQ⟩,
exact ⟨hQ, hP⟩,
end
-- 10ª demostración
example : P ∧ Q → Q ∧ P :=
λ ⟨hP, hQ⟩, ⟨hQ, hP⟩
-- 11ª demostración
example : P ∧ Q → Q ∧ P :=
-- by library_search
and.comm.mp
-- 12ª demostración
example : P ∧ Q → Q ∧ P :=
and.swap
-- 13ª demostración
example : P ∧ Q → Q ∧ P:=
-- by hint
by tauto
-- 13ª demostración
example : P ∧ Q → Q ∧ P :=
by finish