-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCN_de_no_monotona.lean
82 lines (71 loc) · 2.62 KB
/
CN_de_no_monotona.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
-- CN_de_no_monotona.lean
-- Si f no es monótona, entonces ∃x∃y[x ≤ y ∧ f(y) < f(x)].
-- José A. Alonso Jiménez <https://jaalonso.github.io>
-- Sevilla, 7-diciembre-2023
-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------
-- Demostrar que si f no es monótona, entonces existen x, y tales que
-- x ≤ y y f(y) < f(x).
-- ----------------------------------------------------------------------
-- Demostración en lenguaje natural
-- ================================
-- Usaremos los siguientes lemas.
-- ¬(∀x)P(x) ↔ (∃ x)¬P(x) (L1)
-- ¬(p → q) ↔ p ∧ ¬q (L2)
-- (∀a, b ∈ ℝ)[¬b ≤ a → a < b] (L3)
--
-- Por la definición de función monótona,
-- ¬(∀x)(∀y)[x ≤ y → f(x) ≤ f(y)]
-- Aplicando L1 se tiene
-- (∃x)¬(∀y)[x ≤ y → f(x) ≤ f(y)]
-- Sea a tal que
-- ¬(∀y)[a ≤ y → f(a) ≤ f(y)]
-- Aplicando L1 se tiene
-- (∃y)¬[a ≤ y → f(a) ≤ f(y)]
-- Sea b tal que
-- ¬[a ≤ b → f(a) ≤ f(b)]
-- Aplicando L2 se tiene que
-- a ≤ b ∧ ¬(f(a) ≤ f(b))
-- Aplicando L3 se tiene que
-- a ≤ b ∧ f(b) < f(a)
-- Por tanto,
-- (∃x,y)[x ≤ y ∧ f(y) < f(x)]
-- Demostraciones con Lean4
-- ========================
import Mathlib.Tactic
variable (f : ℝ → ℝ)
-- 1ª demostración
-- ===============
example
(h : ¬Monotone f)
: ∃ x y, x ≤ y ∧ f y < f x :=
by
have h1 : ¬∀ x y, x ≤ y → f x ≤ f y := h
have h2 : ∃ x, ¬(∀ y, x ≤ y → f x ≤ f y) := not_forall.mp h1
rcases h2 with ⟨a, ha : ¬∀ y, a ≤ y → f a ≤ f y⟩
have h3 : ∃ y, ¬(a ≤ y → f a ≤ f y) := not_forall.mp ha
rcases h3 with ⟨b, hb : ¬(a ≤ b → f a ≤ f b)⟩
have h4 : a ≤ b ∧ ¬(f a ≤ f b) := Classical.not_imp.mp hb
have h5 : a ≤ b ∧ f b < f a := ⟨h4.1, lt_of_not_le h4.2⟩
use a, b
-- ⊢ a ≤ b ∧ f b < f a
-- 2ª demostración
-- ===============
example
(h : ¬Monotone f)
: ∃ x y, x ≤ y ∧ f y < f x :=
by
simp only [Monotone] at h
-- h : ¬∀ ⦃a b : ℝ⦄, a ≤ b → f a ≤ f b
push_neg at h
-- h : Exists fun ⦃a⦄ => Exists fun ⦃b⦄ => a ≤ b ∧ f b < f a
exact h
-- Lemas usados
-- ============
-- variable {α : Type _}
-- variable (P : α → Prop)
-- variable (p q : Prop)
-- variable (a b : ℝ)
-- #check (not_forall : (¬∀ x, P x) ↔ ∃ x, ¬P x)
-- #check (not_imp : ¬(p → q) ↔ p ∧ ¬q)
-- #check (lt_of_not_le : ¬b ≤ a → a < b)