The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Basic.ExistsUnique

24 declarations. Mathlib docs · Source

ExistsUnique

This file defines the ExistsUnique predicate, notated as ∃!, and proves some of its basic properties.

def ExistsUnique E1 #

{α : Sort u_1} → (α → Prop) → Prop

For p : α → Prop, ExistsUnique p means that there exists a unique x : α with p x.

def Mathlib.Notation.isExplicitBinderSingular E1 #

Lean.TSyntax `Lean.explicitBinders → Bool

Checks to see that xs has only one binder.

def Mathlib.Notation.«term∃!_,_» E1 #

Lean.ParserDescr

∃! x : α, p x means that there exists a unique x in α such that p x. This is notation for ExistsUnique (fun (x : α) ↦ p x).

This notation does not allow multiple binders like ∃! (x : α) (y : β), p x y as a shorthand for ∃! (x : α), ∃! (y : β), p x y since it is liable to be misunderstood. Often, the intended meaning is instead ∃! q : α × β, p q.1 q.2.

def Mathlib.Notation.unexpandExistsUnique E1 #

Lean.PrettyPrinter.Unexpander

Pretty-printing for ExistsUnique, following the same pattern as pretty printing for Exists. However, it does not merge binders.

def Mathlib.Notation.«term∃!__,_» E1 #

Lean.ParserDescr

∃! x ∈ s, p x means ∃! x, x ∈ s ∧ p x, which is to say that there exists a unique x ∈ s such that p x. Similarly, notations such as ∃! x ≤ n, p n are supported, using any relation defined using the binder_predicate command.

theorem ExistsUnique.intro E1 #

∀ {α : Sort u_1} {p : α → Prop} (w : α), p w → (∀ (y : α), p y → y = w) → ∃! x, p x

theorem ExistsUnique.elim E1 #

∀ {α : Sort u_1} {p : α → Prop} {b : Prop}, (∃! x, p x) → (∀ (x : α), p x → (∀ (y : α), p y → y = x) → b) → b

theorem existsUnique_of_exists_of_unique E1 #

∀ {α : Sort u_1} {p : α → Prop}, (∃ x, p x) → (∀ (y₁ y₂ : α), p y₁ → p y₂ → y₁ = y₂) → ∃! x, p x

theorem ExistsUnique.exists E1 #

∀ {α : Sort u_1} {p : α → Prop}, (∃! x, p x) → ∃ x, p x

theorem ExistsUnique.unique E1 #

∀ {α : Sort u_1} {p : α → Prop}, (∃! x, p x) → ∀ {y₁ y₂ : α}, p y₁ → p y₂ → y₁ = y₂

theorem ExistsUnique.choose_eq_iff E0 #

∀ {α : Sort u_1} {p : α → Prop} {a : α} (h : ∃! x, p x), Exists.choose h = a ↔ p a

theorem existsUnique_congr E1 #

∀ {α : Sort u_1} {p q : α → Prop}, (∀ (a : α), p a ↔ q a) → ((∃! a, p a) ↔ ∃! a, q a)

theorem existsUnique_iff_exists E0 #

∀ {α : Sort u_1} [Subsingleton α] {p : α → Prop}, (∃! x, p x) ↔ ∃ x, p x

theorem existsUnique_const E1 #

∀ {b : Prop} (α : Sort u_2) [i : Nonempty α] [Subsingleton α], (∃! x, b) ↔ b

theorem existsUnique_eq E0 #

∀ {α : Sort u_1} {a' : α}, ∃! a, a = a'

theorem existsUnique_eq' E0 #

∀ {α : Sort u_1} {a' : α}, ∃! a, a' = a

The difference with existsUnique_eq is that the equality is reversed.

theorem existsUnique_prop E1 #

∀ {p q : Prop}, (∃! x, q) ↔ p ∧ q

theorem existsUnique_false E0 #

∀ {α : Sort u_1}, ¬∃! x, False

theorem existsUnique_prop_of_true E1 #

∀ {p : Prop} {q : p → Prop} (h : p), (∃! h', q h') ↔ q h

theorem ExistsUnique.elim₂ E1 #

∀ {α : Sort u_1} {p : α → Sort u_2} [∀ (x : α), Subsingleton (p x)] {q : (x : α) → p x → Prop} {b : Prop},
  (∃! x, ∃! h, q x h) → (∀ (x : α) (h : p x), q x h → (∀ (y : α) (hy : p y), q y hy → y = x) → b) → b

theorem ExistsUnique.intro₂ E1 #

∀ {α : Sort u_1} {p : α → Sort u_2} [∀ (x : α), Subsingleton (p x)] {q : (x : α) → p x → Prop} (w : α) (hp : p w),
  q w hp → (∀ (y : α) (hy : p y), q y hy → y = w) → ∃! x, ∃! hx, q x hx

theorem ExistsUnique.exists₂ E1 #

∀ {α : Sort u_1} {p : α → Sort u_2} {q : (x : α) → p x → Prop}, (∃! x, ∃! hx, q x hx) → ∃ x hx, q x hx

theorem ExistsUnique.unique₂ E1 #

∀ {α : Sort u_1} {p : α → Sort u_2} [∀ (x : α), Subsingleton (p x)] {q : (x : α) → p x → Prop},
  (∃! x, ∃! hx, q x hx) → ∀ {y₁ y₂ : α} (hpy₁ : p y₁), q y₁ hpy₁ → ∀ (hpy₂ : p y₂), q y₂ hpy₂ → y₁ = y₂

instance List.decidableBExistsUnique E0 #

{α : Type u_2} → [DecidableEq α] → (p : α → Prop) → [DecidablePred p] → (l : List α) → Decidable (∃! x, x ∈ l ∧ p x)

This invokes the two Decidable arguments $O(n)$ times.