-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLas_familias_de_conjuntos_definen_relaciones_simetricas.lean
106 lines (91 loc) · 2.75 KB
/
Las_familias_de_conjuntos_definen_relaciones_simetricas.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
-- Las_familias_de_conjuntos_definen_relaciones_simetricas.lean
-- Las familias de conjuntos definen relaciones simétricas.
-- José A. Alonso Jiménez <https://jaalonso.github.io>
-- Sevilla, 5-julio-2024
-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------
-- Cada familia de conjuntos P define una relación de forma que dos
-- elementos están relacionados si algún conjunto de P contiene a ambos
-- elementos. Se puede definir en Lean por
-- def relacion (P : set (set X)) (x y : X) :=
-- ∃ A ∈ P, x ∈ A ∧ y ∈ A
--
-- Demostrar que si P es una familia de subconjuntos de X, entonces la
-- relación definida por P es simétrica.
-- ---------------------------------------------------------------------
-- Demostración en lenguaje natural
-- ================================
-- Sean x, y ∈ X tales que x e y están relacionado mediante la relación
-- definida por P. Entonces, existe A tal que
-- A ∈ P ∧ x ∈ A ∧ y ∈ A
-- Por tanto,
-- A ∈ P ∧ y ∈ A ∧ x ∈ A
-- es decir, y y x están relacionado mediante la relación definida por
-- P.
-- Demostraciones con Lean4
-- ========================
import Mathlib.Tactic
variable {X : Type}
variable (P : Set (Set X))
def relacion (P : Set (Set X)) (x y : X) :=
∃ A ∈ P, x ∈ A ∧ y ∈ A
-- 1ª demostración
-- ===============
example : Symmetric (relacion P) :=
by
intros x y hxy
-- x y : X
-- hxy : relacion P x y
-- ⊢ relacion P y x
rcases hxy with ⟨A, h1⟩
-- A : Set X
-- h1 : A ∈ P ∧ x ∈ A ∧ y ∈ A
have h2 : A ∈ P ∧ y ∈ A ∧ x ∈ A := by tauto
exact ⟨A, h2⟩
-- 2ª demostración
-- ===============
example : Symmetric (relacion P) :=
by
unfold Symmetric
-- ⊢ ∀ ⦃x y : X⦄, relacion P x y → relacion P y x
intros x y hxy
-- x y : X
-- hxy : relacion P x y
-- ⊢ relacion P y x
unfold relacion at *
-- hxy : ∃ A, A ∈ P ∧ x ∈ A ∧ y ∈ A
-- ⊢ ∃ A, A ∈ P ∧ y ∈ A ∧ x ∈ A
rcases hxy with ⟨A, hAP, ⟨hxA, hyA⟩⟩
-- A : Set X
-- hAP : A ∈ P
-- hxA : x ∈ A
-- hyA : y ∈ A
use A
-- 3ª demostración
-- ===============
example : Symmetric (relacion P) :=
by
intros x y hxy
-- x y : X
-- hxy : relacion P x y
-- ⊢ relacion P y x
rcases hxy with ⟨A, hAP, ⟨hxA, hyA⟩⟩
-- A : Set X
-- hAP : A ∈ P
-- hxA : x ∈ A
-- hyA : y ∈ A
use A
-- 4ª demostración
-- ===============
example : Symmetric (relacion P) :=
by
intros x y hxy
-- x y : X
-- hxy : relacion P x y
-- ⊢ relacion P y x
rcases hxy with ⟨A, hAP, ⟨hxA, hyA⟩⟩
-- A : Set X
-- hAP : A ∈ P
-- hxA : x ∈ A
-- hyA : y ∈ A
exact ⟨A, ⟨hAP, hyA, hxA⟩⟩