--- Título: La función (x ↦ x + c) es suprayectiva Autor: José A. Alonso --- Demostrar con Lean4 que la función \\(x ↦ x + c\\) es suprayectiva. Para ello, completar la siguiente teoría de Lean4:
import Mathlib.Data.Real.Basic
variable {c : ℝ}
open Function

example : Surjective (fun x ↦ x + c) :=
by sorry
Demostración en lenguaje natural [mathjax] Tenemos que demostrar que \\[ (∀ x ∈ ℝ)(∃ y ∈ ℝ)[y+c = x] \\] Sea \\(x ∈ ℝ\\). Entonces, \\(y = x-c ∈ ℝ\\) y \\begin{align} y + c &= (x - c) + c \\\\ &= x \\end{align} Demostraciones con Lean4
import Mathlib.Data.Real.Basic

variable {c : ℝ}

open Function

-- 1ª demostración
example : Surjective (fun x ↦ x + c) :=
by
  intro x
  -- x : ℝ
  -- ⊢ ∃ a, (fun x => x + c) a = x
  use x - c
  -- ⊢ (fun x => x + c) (x - c) = x
  dsimp
  -- ⊢ (x - c) + c = x
  exact sub_add_cancel x c

-- 2ª demostración
example : Surjective (fun x ↦ x + c) :=
by
  intro x
  -- x : ℝ
  -- ⊢ ∃ a, (fun x => x + c) a = x
  use x - c
  -- ⊢ (fun x => x + c) (x - c) = x
  change (x - c) + c = x
  -- ⊢ (x - c) + c = x
  exact sub_add_cancel x c

-- 3ª demostración
example : Surjective (fun x ↦ x + c) :=
by
  intro x
  -- x : ℝ
  -- ⊢ ∃ a, (fun x => x + c) a = x
  use x - c
  -- ⊢ (fun x => x + c) (x - c) = x
  exact sub_add_cancel x c

-- 4ª demostración
example : Surjective (fun x ↦ x + c) :=
fun x ↦ ⟨x - c, sub_add_cancel x c⟩

-- 5ª demostración
example : Surjective (fun x ↦ x + c) :=
fun x ↦ ⟨x - c, by ring⟩

-- 6ª demostración
example : Surjective (fun x ↦ x + c) :=
add_right_surjective c

-- Lemas usados
-- ============

-- variable (a b : ℝ)
-- #check (sub_add_cancel a b : (a - b) + b = a)
-- #check (add_right_surjective c : Surjective (fun x ↦ x + c))
Demostraciones interactivas Se puede interactuar con las demostraciones anteriores en Lean 4 Web. Referencias