fact stringlengths 6 3.84k | type stringclasses 11 values | library stringclasses 32 values | imports listlengths 1 14 | filename stringlengths 20 95 | symbolic_name stringlengths 1 90 | docstring stringlengths 7 20k ⌀ |
|---|---|---|---|---|---|---|
equivToOpposite_symm_coe : (equivToOpposite.symm : αᵒᵖ → α) = unop :=
rfl | theorem | Data | [
"Mathlib.Logic.Equiv.Defs",
"Mathlib.Logic.Small.Defs"
] | Mathlib/Data/Opposite.lean | equivToOpposite_symm_coe | null |
op_eq_iff_eq_unop {x : α} {y} : op x = y ↔ x = unop y :=
equivToOpposite.apply_eq_iff_eq_symm_apply | theorem | Data | [
"Mathlib.Logic.Equiv.Defs",
"Mathlib.Logic.Small.Defs"
] | Mathlib/Data/Opposite.lean | op_eq_iff_eq_unop | null |
unop_eq_iff_eq_op {x} {y : α} : unop x = y ↔ x = op y :=
equivToOpposite.symm.apply_eq_iff_eq_symm_apply | theorem | Data | [
"Mathlib.Logic.Equiv.Defs",
"Mathlib.Logic.Small.Defs"
] | Mathlib/Data/Opposite.lean | unop_eq_iff_eq_op | null |
@[deprecated Opposite.rec (since := "2025-04-04")]
protected rec' {F : αᵒᵖ → Sort v} (h : ∀ X, F (op X)) : ∀ X, F X := fun X => h (unop X) | def | Data | [
"Mathlib.Logic.Equiv.Defs",
"Mathlib.Logic.Small.Defs"
] | Mathlib/Data/Opposite.lean | rec' | A deprecated alias for `Opposite.rec`. |
small {X : Type v} [Small.{u} X] : Small.{u} Xᵒᵖ := by
obtain ⟨S, ⟨e⟩⟩ := Small.equiv_small (α := X)
exact ⟨S, ⟨equivToOpposite.symm.trans e⟩⟩ | lemma | Data | [
"Mathlib.Logic.Equiv.Defs",
"Mathlib.Logic.Small.Defs"
] | Mathlib/Data/Opposite.lean | small | If `X` is `u`-small, also `Xᵒᵖ` is `u`-small.
Note: This is not an instance, because it tends to mislead typeclass search. |
Part.{u} (α : Type u) : Type u where
/-- The domain of a partial value -/
Dom : Prop
/-- Extract a value from a partial value given a proof of `Dom` -/
get : Dom → α | structure | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Part. | `Part α` is the type of "partial values" of type `α`. It
is similar to `Option α` except the domain condition can be an
arbitrary proposition, not necessarily decidable. |
toOption (o : Part α) [Decidable o.Dom] : Option α :=
if h : Dom o then some (o.get h) else none
@[simp] lemma toOption_isSome (o : Part α) [Decidable o.Dom] : o.toOption.isSome ↔ o.Dom := by
by_cases h : o.Dom <;> simp [h, toOption]
@[simp] lemma toOption_eq_none (o : Part α) [Decidable o.Dom] : o.toOption = none ↔ ¬o.Dom := by
by_cases h : o.Dom <;> simp [h, toOption] | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | toOption | Convert a `Part α` with a decidable domain to an option |
ext' : ∀ {o p : Part α}, (o.Dom ↔ p.Dom) → (∀ h₁ h₂, o.get h₁ = p.get h₂) → o = p
| ⟨od, o⟩, ⟨pd, p⟩, H1, H2 => by
have t : od = pd := propext H1
cases t; rw [show o = p from funext fun p => H2 p p] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ext' | `Part` extensionality |
@[simp]
eta : ∀ o : Part α, (⟨o.Dom, fun h => o.get h⟩ : Part α) = o
| ⟨_, _⟩ => rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eta | `Part` eta expansion |
protected Mem (o : Part α) (a : α) : Prop :=
∃ h, o.get h = a | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Mem | `a ∈ o` means that `o` is defined and equal to `a` |
mem_eq (a : α) (o : Part α) : (a ∈ o) = ∃ h, o.get h = a :=
rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_eq | null |
dom_iff_mem : ∀ {o : Part α}, o.Dom ↔ ∃ y, y ∈ o
| ⟨_, f⟩ => ⟨fun h => ⟨f h, h, rfl⟩, fun ⟨_, h, rfl⟩ => h⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | dom_iff_mem | null |
get_mem {o : Part α} (h) : get o h ∈ o :=
⟨_, rfl⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | get_mem | null |
mem_mk_iff {p : Prop} {o : p → α} {a : α} : a ∈ Part.mk p o ↔ ∃ h, o h = a :=
Iff.rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_mk_iff | null |
@[ext]
ext {o p : Part α} (H : ∀ a, a ∈ o ↔ a ∈ p) : o = p :=
(ext' ⟨fun h => ((H _).1 ⟨h, rfl⟩).fst, fun h => ((H _).2 ⟨h, rfl⟩).fst⟩) fun _ _ =>
((H _).2 ⟨_, rfl⟩).snd | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ext | `Part` extensionality |
none : Part α :=
⟨False, False.rec⟩ | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | none | The `none` value in `Part` has a `False` domain and an empty function. |
@[simp]
notMem_none (a : α) : a ∉ @none α := fun h => h.fst
@[deprecated (since := "2025-05-23")] alias not_mem_none := notMem_none | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | notMem_none | null |
some (a : α) : Part α :=
⟨True, fun _ => a⟩
@[simp] | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some | The `some a` value in `Part` has a `True` domain and the
function returns `a`. |
some_dom (a : α) : (some a).Dom :=
trivial | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some_dom | null |
mem_unique : ∀ {a b : α} {o : Part α}, a ∈ o → b ∈ o → a = b
| _, _, ⟨_, _⟩, ⟨_, rfl⟩, ⟨_, rfl⟩ => rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_unique | null |
mem_right_unique : ∀ {a : α} {o p : Part α}, a ∈ o → a ∈ p → o = p
| _, _, _, ⟨ho, _⟩, ⟨hp, _⟩ => ext' (iff_of_true ho hp) (by simp [*]) | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_right_unique | null |
Mem.left_unique : Relator.LeftUnique ((· ∈ ·) : α → Part α → Prop) := fun _ _ _ =>
mem_unique | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Mem.left_unique | null |
Mem.right_unique : Relator.RightUnique ((· ∈ ·) : α → Part α → Prop) := fun _ _ _ =>
mem_right_unique | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Mem.right_unique | null |
get_eq_of_mem {o : Part α} {a} (h : a ∈ o) (h') : get o h' = a :=
mem_unique ⟨_, rfl⟩ h | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | get_eq_of_mem | null |
protected subsingleton (o : Part α) : Set.Subsingleton { a | a ∈ o } := fun _ ha _ hb =>
mem_unique ha hb
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | subsingleton | null |
get_some {a : α} (ha : (some a).Dom) : get (some a) ha = a :=
rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | get_some | null |
mem_some (a : α) : a ∈ some a :=
⟨trivial, rfl⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_some | null |
mem_some_iff {a b} : b ∈ (some a : Part α) ↔ b = a :=
⟨fun ⟨_, e⟩ => e.symm, fun e => ⟨trivial, e.symm⟩⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_some_iff | null |
eq_some_iff {a : α} {o : Part α} : o = some a ↔ a ∈ o :=
⟨fun e => e.symm ▸ mem_some _, fun ⟨h, e⟩ => e ▸ ext' (iff_true_intro h) fun _ _ => rfl⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_some_iff | null |
eq_none_iff {o : Part α} : o = none ↔ ∀ a, a ∉ o :=
⟨fun e => e.symm ▸ notMem_none, fun h => ext (by simpa)⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_none_iff | null |
eq_none_iff' {o : Part α} : o = none ↔ ¬o.Dom :=
⟨fun e => e.symm ▸ id, fun h => eq_none_iff.2 fun _ h' => h h'.fst⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_none_iff' | null |
not_none_dom : ¬(none : Part α).Dom :=
id
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | not_none_dom | null |
some_ne_none (x : α) : some x ≠ none := by
intro h
exact true_ne_false (congr_arg Dom h)
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some_ne_none | null |
none_ne_some (x : α) : none ≠ some x :=
(some_ne_none x).symm | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | none_ne_some | null |
ne_none_iff {o : Part α} : o ≠ none ↔ ∃ x, o = some x := by
constructor
· rw [Ne, eq_none_iff', not_not]
exact fun h => ⟨o.get h, eq_some_iff.2 (get_mem h)⟩
· rintro ⟨x, rfl⟩
apply some_ne_none | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ne_none_iff | null |
eq_none_or_eq_some (o : Part α) : o = none ∨ ∃ x, o = some x :=
or_iff_not_imp_left.2 ne_none_iff.1 | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_none_or_eq_some | null |
some_injective : Injective (@Part.some α) := fun _ _ h =>
congr_fun (eq_of_heq (Part.mk.inj h).2) trivial
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some_injective | null |
some_inj {a b : α} : Part.some a = some b ↔ a = b :=
some_injective.eq_iff
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some_inj | null |
some_get {a : Part α} (ha : a.Dom) : Part.some (Part.get a ha) = a :=
Eq.symm (eq_some_iff.2 ⟨ha, rfl⟩) | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some_get | null |
get_eq_iff_eq_some {a : Part α} {ha : a.Dom} {b : α} : a.get ha = b ↔ a = some b :=
⟨fun h => by simp [h.symm], fun h => by simp [h]⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | get_eq_iff_eq_some | null |
get_eq_get_of_eq (a : Part α) (ha : a.Dom) {b : Part α} (h : a = b) :
a.get ha = b.get (h ▸ ha) := by
congr | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | get_eq_get_of_eq | null |
get_eq_iff_mem {o : Part α} {a : α} (h : o.Dom) : o.get h = a ↔ a ∈ o :=
⟨fun H => ⟨h, H⟩, fun ⟨_, H⟩ => H⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | get_eq_iff_mem | null |
eq_get_iff_mem {o : Part α} {a : α} (h : o.Dom) : a = o.get h ↔ a ∈ o :=
eq_comm.trans (get_eq_iff_mem h) | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_get_iff_mem | null |
eq_of_get_eq_get {a b : Part α} (ha : a.Dom) (hb : b.Dom) (hab : a.get ha = b.get hb) :
a = b :=
ext' (iff_of_true ha hb) fun _ _ => hab | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_of_get_eq_get | null |
eq_iff_of_dom {a b : Part α} (ha : a.Dom) (hb : b.Dom) : a.get ha = b.get hb ↔ a = b :=
⟨eq_of_get_eq_get ha hb, get_eq_get_of_eq a ha⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_iff_of_dom | null |
eq_of_mem {a b : Part α} (ha : a.Dom) (hb : a.get ha ∈ b) : a = b := by
have hb' : b.Dom := Part.dom_iff_mem.mpr ⟨a.get ha, hb⟩
rwa [← eq_get_iff_mem hb', eq_iff_of_dom ha hb'] at hb
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | eq_of_mem | null |
none_toOption [Decidable (@none α).Dom] : (none : Part α).toOption = Option.none :=
dif_neg id
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | none_toOption | null |
some_toOption (a : α) [Decidable (some a).Dom] : (some a).toOption = Option.some a :=
dif_pos trivial | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | some_toOption | null |
noneDecidable : Decidable (@none α).Dom :=
instDecidableFalse | instance | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | noneDecidable | null |
someDecidable (a : α) : Decidable (some a).Dom :=
instDecidableTrue | instance | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | someDecidable | null |
getOrElse (a : Part α) [Decidable a.Dom] (d : α) :=
if ha : a.Dom then a.get ha else d | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | getOrElse | Retrieves the value of `a : Part α` if it exists, and return the provided default value
otherwise. |
getOrElse_of_dom (a : Part α) (h : a.Dom) [Decidable a.Dom] (d : α) :
getOrElse a d = a.get h :=
dif_pos h | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | getOrElse_of_dom | null |
getOrElse_of_not_dom (a : Part α) (h : ¬a.Dom) [Decidable a.Dom] (d : α) :
getOrElse a d = d :=
dif_neg h
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | getOrElse_of_not_dom | null |
getOrElse_none (d : α) [Decidable (none : Part α).Dom] : getOrElse none d = d :=
none.getOrElse_of_not_dom not_none_dom d
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | getOrElse_none | null |
getOrElse_some (a : α) (d : α) [Decidable (some a).Dom] : getOrElse (some a) d = a :=
(some a).getOrElse_of_dom (some_dom a) d | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | getOrElse_some | null |
mem_toOption {o : Part α} [Decidable o.Dom] {a : α} : a ∈ toOption o ↔ a ∈ o := by
unfold toOption
by_cases h : o.Dom
· simpa [h] using ⟨fun h => ⟨_, h⟩, fun ⟨_, h⟩ => h⟩
· simp only [h, ↓reduceDIte, Option.mem_def, reduceCtorEq, false_iff]
exact mt Exists.fst h
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_toOption | null |
toOption_eq_some_iff {o : Part α} [Decidable o.Dom] {a : α} :
toOption o = Option.some a ↔ a ∈ o := by
rw [← Option.mem_def, mem_toOption] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | toOption_eq_some_iff | null |
protected Dom.toOption {o : Part α} [Decidable o.Dom] (h : o.Dom) : o.toOption = o.get h :=
dif_pos h | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Dom.toOption | null |
toOption_eq_none_iff {a : Part α} [Decidable a.Dom] : a.toOption = Option.none ↔ ¬a.Dom :=
Ne.dite_eq_right_iff fun _ => Option.some_ne_none _
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | toOption_eq_none_iff | null |
elim_toOption {α β : Type*} (a : Part α) [Decidable a.Dom] (b : β) (f : α → β) :
a.toOption.elim b f = if h : a.Dom then f (a.get h) else b := by
split_ifs with h
· rw [h.toOption]
rfl
· rw [Part.toOption_eq_none_iff.2 h]
rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | elim_toOption | null |
@[coe]
ofOption : Option α → Part α
| Option.none => none
| Option.some a => some a
@[simp] | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ofOption | Converts an `Option α` into a `Part α`. |
mem_ofOption {a : α} : ∀ {o : Option α}, a ∈ ofOption o ↔ a ∈ o
| Option.none => ⟨fun h => h.fst.elim, fun h => Option.noConfusion h⟩
| Option.some _ => ⟨fun h => congr_arg Option.some h.snd, fun h => ⟨trivial, Option.some.inj h⟩⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_ofOption | null |
ofOption_dom {α} : ∀ o : Option α, (ofOption o).Dom ↔ o.isSome
| Option.none => by simp [ofOption, none]
| Option.some a => by simp [ofOption] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ofOption_dom | null |
ofOption_eq_get {α} (o : Option α) : ofOption o = ⟨_, @Option.get _ o⟩ :=
Part.ext' (ofOption_dom o) fun h₁ h₂ => by
cases o
· simp at h₂
· rfl | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ofOption_eq_get | null |
mem_coe {a : α} {o : Option α} : a ∈ (o : Part α) ↔ a ∈ o :=
mem_ofOption
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_coe | null |
coe_none : (@Option.none α : Part α) = none :=
rfl
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | coe_none | null |
coe_some (a : α) : (Option.some a : Part α) = some a :=
rfl
@[elab_as_elim] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | coe_some | null |
protected induction_on {P : Part α → Prop} (a : Part α) (hnone : P none)
(hsome : ∀ a : α, P (some a)) : P a :=
(Classical.em a.Dom).elim (fun h => Part.some_get h ▸ hsome _) fun h =>
(eq_none_iff'.2 h).symm ▸ hnone | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | induction_on | null |
ofOptionDecidable : ∀ o : Option α, Decidable (ofOption o).Dom
| Option.none => Part.noneDecidable
| Option.some a => Part.someDecidable a
@[simp] | instance | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ofOptionDecidable | null |
to_ofOption (o : Option α) : toOption (ofOption o) = o := by cases o <;> rfl
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | to_ofOption | null |
of_toOption (o : Part α) [Decidable o.Dom] : ofOption (toOption o) = o :=
ext fun _ => mem_ofOption.trans mem_toOption | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | of_toOption | null |
noncomputable equivOption : Part α ≃ Option α :=
haveI := Classical.dec
⟨fun o => toOption o, ofOption, fun o => of_toOption o, fun o =>
Eq.trans (by dsimp; congr) (to_ofOption o)⟩ | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | equivOption | `Part α` is (classically) equivalent to `Option α`. |
assert (p : Prop) (f : p → Part α) : Part α :=
⟨∃ h : p, (f h).Dom, fun ha => (f ha.fst).get ha.snd⟩ | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | assert | We give `Part α` the order where everything is greater than `none`. -/
instance : PartialOrder (Part
α) where
le x y := ∀ i, i ∈ x → i ∈ y
le_refl _ _ := id
le_trans _ _ _ f g _ := g _ ∘ f _
le_antisymm _ _ f g := Part.ext fun _ => ⟨f _, g _⟩
instance : OrderBot (Part α) where
bot := none
bot_le := by rintro x _ ⟨⟨_⟩, _⟩
theorem le_total_of_le_of_le {x y : Part α} (z : Part α) (hx : x ≤ z) (hy : y ≤ z) :
x ≤ y ∨ y ≤ x := by
rcases Part.eq_none_or_eq_some x with (h | ⟨b, h₀⟩)
· rw [h]
left
apply OrderBot.bot_le _
right; intro b' h₁
rw [Part.eq_some_iff] at h₀
have hx := hx _ h₀; have hy := hy _ h₁
have hx := Part.mem_unique hx hy; subst hx
exact h₀
/-- `assert p f` is a bind-like operation which appends an additional condition
`p` to the domain and uses `f` to produce the value. |
protected bind (f : Part α) (g : α → Part β) : Part β :=
assert (Dom f) fun b => g (f.get b) | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind | The bind operation has value `g (f.get)`, and is defined when all the
parts are defined. |
@[simps]
map (f : α → β) (o : Part α) : Part β :=
⟨o.Dom, f ∘ o.get⟩ | def | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | map | The map operation for `Part` just maps the value and maintains the same domain. |
mem_map (f : α → β) {o : Part α} : ∀ {a}, a ∈ o → f a ∈ map f o
| _, ⟨_, rfl⟩ => ⟨_, rfl⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_map | null |
mem_map_iff (f : α → β) {o : Part α} {b} : b ∈ map f o ↔ ∃ a ∈ o, f a = b :=
⟨fun hb => match b, hb with
| _, ⟨_, rfl⟩ => ⟨_, ⟨_, rfl⟩, rfl⟩,
fun ⟨_, h₁, h₂⟩ => h₂ ▸ mem_map f h₁⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_map_iff | null |
map_none (f : α → β) : map f none = none :=
eq_none_iff.2 fun a => by simp
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | map_none | null |
map_some (f : α → β) (a : α) : map f (some a) = some (f a) :=
eq_some_iff.2 <| mem_map f <| mem_some _ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | map_some | null |
mem_assert {p : Prop} {f : p → Part α} : ∀ {a} (h : p), a ∈ f h → a ∈ assert p f
| _, x, ⟨h, rfl⟩ => ⟨⟨x, h⟩, rfl⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_assert | null |
mem_assert_iff {p : Prop} {f : p → Part α} {a} : a ∈ assert p f ↔ ∃ h : p, a ∈ f h :=
⟨fun ha => match a, ha with
| _, ⟨_, rfl⟩ => ⟨_, ⟨_, rfl⟩⟩,
fun ⟨_, h⟩ => mem_assert _ h⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_assert_iff | null |
assert_pos {p : Prop} {f : p → Part α} (h : p) : assert p f = f h := by
dsimp [assert]
cases h' : f h
simp only [h', mk.injEq, h, exists_prop_of_true, true_and]
apply Function.hfunext
· simp only [h, h', exists_prop_of_true]
· simp | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | assert_pos | null |
assert_neg {p : Prop} {f : p → Part α} (h : ¬p) : assert p f = none := by
dsimp [assert, none]; congr
· simp only [h, not_false_iff, exists_prop_of_false]
· apply Function.hfunext
· simp only [h, not_false_iff, exists_prop_of_false]
simp at * | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | assert_neg | null |
mem_bind {f : Part α} {g : α → Part β} : ∀ {a b}, a ∈ f → b ∈ g a → b ∈ f.bind g
| _, _, ⟨h, rfl⟩, ⟨h₂, rfl⟩ => ⟨⟨h, h₂⟩, rfl⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_bind | null |
mem_bind_iff {f : Part α} {g : α → Part β} {b} : b ∈ f.bind g ↔ ∃ a ∈ f, b ∈ g a :=
⟨fun hb => match b, hb with
| _, ⟨⟨_, _⟩, rfl⟩ => ⟨_, ⟨_, rfl⟩, ⟨_, rfl⟩⟩,
fun ⟨_, h₁, h₂⟩ => mem_bind h₁ h₂⟩ | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | mem_bind_iff | null |
protected Dom.bind {o : Part α} (h : o.Dom) (f : α → Part β) : o.bind f = f (o.get h) := by
ext b
simp only [Part.mem_bind_iff]
refine ⟨?_, fun hb => ⟨o.get h, Part.get_mem _, hb⟩⟩
rintro ⟨a, ha, hb⟩
rwa [Part.get_eq_of_mem ha] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Dom.bind | null |
Dom.of_bind {f : α → Part β} {a : Part α} (h : (a.bind f).Dom) : a.Dom :=
h.1
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | Dom.of_bind | null |
bind_none (f : α → Part β) : none.bind f = none :=
eq_none_iff.2 fun a => by simp
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_none | null |
bind_some (a : α) (f : α → Part β) : (some a).bind f = f a :=
ext <| by simp | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_some | null |
bind_of_mem {o : Part α} {a : α} (h : a ∈ o) (f : α → Part β) : o.bind f = f a := by
rw [eq_some_iff.2 h, bind_some] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_of_mem | null |
bind_some_eq_map (f : α → β) (x : Part α) : x.bind (fun y => some (f y)) = map f x :=
ext <| by simp [eq_comm] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_some_eq_map | null |
bind_toOption (f : α → Part β) (o : Part α) [Decidable o.Dom] [∀ a, Decidable (f a).Dom]
[Decidable (o.bind f).Dom] :
(o.bind f).toOption = o.toOption.elim Option.none fun a => (f a).toOption := by
by_cases h : o.Dom
· simp_rw [h.toOption, h.bind]
rfl
· rw [Part.toOption_eq_none_iff.2 h]
exact Part.toOption_eq_none_iff.2 fun ho => h ho.of_bind | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_toOption | null |
bind_assoc {γ} (f : Part α) (g : α → Part β) (k : β → Part γ) :
(f.bind g).bind k = f.bind fun x => (g x).bind k :=
ext fun a => by
simp only [mem_bind_iff]
exact ⟨fun ⟨_, ⟨_, h₁, h₂⟩, h₃⟩ => ⟨_, h₁, _, h₂, h₃⟩,
fun ⟨_, h₁, _, h₂, h₃⟩ => ⟨_, ⟨_, h₁, h₂⟩, h₃⟩⟩
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_assoc | null |
bind_map {γ} (f : α → β) (x) (g : β → Part γ) :
(map f x).bind g = x.bind fun y => g (f y) := by rw [← bind_some_eq_map, bind_assoc]; simp
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_map | null |
map_bind {γ} (f : α → Part β) (x : Part α) (g : β → γ) :
map g (x.bind f) = x.bind fun y => map g (f y) := by
rw [← bind_some_eq_map, bind_assoc]; simp [bind_some_eq_map] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | map_bind | null |
map_map (g : β → γ) (f : α → β) (o : Part α) : map g (map f o) = map (g ∘ f) o := by
simp [map, Function.comp_assoc] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | map_map | null |
map_id' {f : α → α} (H : ∀ x : α, f x = x) (o) : map f o = o := by
rw [show f = id from funext H]; exact id_map o
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | map_id' | null |
bind_some_right (x : Part α) : x.bind some = x := by
rw [bind_some_eq_map]
simp [map_id']
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | bind_some_right | null |
pure_eq_some (a : α) : pure a = some a :=
rfl
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | pure_eq_some | null |
ret_eq_some (a : α) : (return a : Part α) = some a :=
rfl
@[simp] | theorem | Data | [
"Mathlib.Algebra.Notation.Defs",
"Mathlib.Data.Set.Subsingleton",
"Mathlib.Logic.Equiv.Defs"
] | Mathlib/Data/Part.lean | ret_eq_some | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.