-
Notifications
You must be signed in to change notification settings - Fork 0
/
Monotonia_de_la_imagen_de_conjuntos.lean
96 lines (81 loc) · 2.18 KB
/
Monotonia_de_la_imagen_de_conjuntos.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
-- Monotonia_de_la_imagen_de_conjuntos.lean
-- Si s ⊆ t, entonces f[s] ⊆ f[t].
-- José A. Alonso Jiménez <https://jaalonso.github.io>
-- Sevilla, 3-abril-2024
-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------
-- Demostrar que si s ⊆ t, entonces
-- f '' s ⊆ f '' t
-- ----------------------------------------------------------------------
-- Demostración en lenguaje natural
-- ================================
-- Sea y ∈ f[s]. Entonces, existe un x tal que
-- x ∈ s (1)
-- f(x) = y (2)
-- Por (1) y la hipótesis,
-- x ∈ t (3)
-- Por (3),
-- f(x) ∈ f[t] (4)
-- y, por (2) y (4),
-- y ∈ f[t]
-- Demostraciones con Lean4
-- ========================
import Mathlib.Data.Set.Function
import Mathlib.Tactic
open Set
variable {α β : Type _}
variable (f : α → β)
variable (s t : Set α)
-- 1ª demostración
-- ===============
example
(h : s ⊆ t)
: f '' s ⊆ f '' t :=
by
intros y hy
-- y : β
-- hy : y ∈ f '' s
-- ⊢ y ∈ f '' t
rw [mem_image] at hy
-- hy : ∃ x, x ∈ s ∧ f x = y
rcases hy with ⟨x, hx⟩
-- x : α
-- hx : x ∈ s ∧ f x = y
rcases hx with ⟨xs, fxy⟩
-- xs : x ∈ s
-- fxy : f x = y
use x
-- ⊢ x ∈ t ∧ f x = y
constructor
. -- ⊢ x ∈ t
exact h xs
. -- ⊢ f x = y
exact fxy
-- 2ª demostración
-- ===============
example
(h : s ⊆ t)
: f '' s ⊆ f '' t :=
by
intros y hy
-- y : β
-- hy : y ∈ f '' s
-- ⊢ y ∈ f '' t
rcases hy with ⟨x, xs, fxy⟩
-- x : α
-- xs : x ∈ s
-- fxy : f x = y
use x
-- ⊢ x ∈ t ∧ f x = y
exact ⟨h xs, fxy⟩
-- 3ª demostración
-- ===============
example
(h : s ⊆ t)
: f '' s ⊆ f '' t :=
image_subset f h
-- Lemas usados
-- ============
-- variable (y : β)
-- #check (mem_image f s y : y ∈ f '' s ↔ ∃ x, x ∈ s ∧ f x = y)
-- #check (image_subset f : s ⊆ t → f '' s ⊆ f '' t)