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 ⌀ |
|---|---|---|---|---|---|---|
reflTransGen_minimal {r' : α → α → Prop} (hr₁ : Reflexive r') (hr₂ : Transitive r')
(h : ∀ x y, r x y → r' x y) {x y : α} (hxy : ReflTransGen r x y) : r' x y := by
simpa [reflTransGen_eq_self hr₁ hr₂] using ReflTransGen.mono h hxy | lemma | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_minimal | null |
reflexive_reflTransGen : Reflexive (ReflTransGen r) := fun _ ↦ refl | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflexive_reflTransGen | null |
transitive_reflTransGen : Transitive (ReflTransGen r) := fun _ _ _ ↦ trans | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | transitive_reflTransGen | null |
reflTransGen_idem : ReflTransGen (ReflTransGen r) = ReflTransGen r :=
reflTransGen_eq_self reflexive_reflTransGen transitive_reflTransGen | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_idem | null |
ReflTransGen.lift' {p : β → β → Prop} {a b : α} (f : α → β)
(h : ∀ a b, r a b → ReflTransGen p (f a) (f b))
(hab : ReflTransGen r a b) : ReflTransGen p (f a) (f b) := by
simpa [reflTransGen_idem] using hab.lift f h | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | ReflTransGen.lift' | null |
reflTransGen_closed {p : α → α → Prop} :
(∀ a b, r a b → ReflTransGen p a b) → ReflTransGen r a b → ReflTransGen p a b :=
ReflTransGen.lift' id | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_closed | null |
ReflTransGen.swap (h : ReflTransGen r b a) : ReflTransGen (swap r) a b := by
induction h with
| refl => rfl
| tail _ hbc ih => exact ih.head hbc | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | ReflTransGen.swap | null |
reflTransGen_swap : ReflTransGen (swap r) a b ↔ ReflTransGen r b a :=
⟨ReflTransGen.swap, ReflTransGen.swap⟩
@[simp] lemma reflGen_transGen : ReflGen (TransGen r) = ReflTransGen r := by
ext x y
simp_rw [reflTransGen_iff_eq_or_transGen, reflGen_iff]
@[simp] lemma transGen_reflGen : TransGen (ReflGen r) = ReflTransGen r := by
ext x y
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· simpa [reflTransGen_idem]
using TransGen.to_reflTransGen <| TransGen.mono (fun _ _ ↦ ReflGen.to_reflTransGen) h
· obtain (rfl | h) := reflTransGen_iff_eq_or_transGen.mp h
· exact .single .refl
· exact TransGen.mono (fun _ _ ↦ .single) h
@[simp] lemma reflTransGen_reflGen : ReflTransGen (ReflGen r) = ReflTransGen r := by
simp only [← transGen_reflGen, reflGen_eq_self reflexive_reflGen]
@[simp] lemma reflTransGen_transGen : ReflTransGen (TransGen r) = ReflTransGen r := by
simp only [← reflGen_transGen, transGen_idem] | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_swap | null |
reflTransGen_eq_transGen (hr : Reflexive r) :
ReflTransGen r = TransGen r := by
rw [← transGen_reflGen, reflGen_eq_self hr] | lemma | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_eq_transGen | null |
reflTransGen_eq_reflGen (hr : Transitive r) :
ReflTransGen r = ReflGen r := by
rw [← reflGen_transGen, transGen_eq_self hr] | lemma | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_eq_reflGen | null |
is_equivalence : Equivalence (@EqvGen α r) :=
Equivalence.mk EqvGen.refl (EqvGen.symm _ _) (EqvGen.trans _ _ _) | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | is_equivalence | null |
setoid : Setoid α :=
Setoid.mk _ (EqvGen.is_equivalence r) | def | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | setoid | `EqvGen.setoid r` is the setoid generated by a relation `r`.
The motivation for this definition is that `Quot r` behaves like `Quotient (EqvGen.setoid r)`,
see for example `Quot.eqvGen_exact` and `Quot.eqvGen_sound`. |
mono {r p : α → α → Prop} (hrp : ∀ a b, r a b → p a b) (h : EqvGen r a b) :
EqvGen p a b := by
induction h with
| rel a b h => exact EqvGen.rel _ _ (hrp _ _ h)
| refl => exact EqvGen.refl _
| symm a b _ ih => exact EqvGen.symm _ _ ih
| trans a b c _ _ hab hbc => exact EqvGen.trans _ _ _ hab hbc | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | mono | null |
Join (r : α → α → Prop) : α → α → Prop := fun a b ↦ ∃ c, r a c ∧ r b c | def | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | Join | The join of a relation on a single type is a new relation for which
pairs of terms are related if there is a third term they are both
related to. For example, if `r` is a relation representing rewrites
in a term rewriting system, then *confluence* is the property that if
`a` rewrites to both `b` and `c`, then `join r` relates `b` and `c`
(see `Relation.church_rosser`). |
church_rosser (h : ∀ a b c, r a b → r a c → ∃ d, ReflGen r b d ∧ ReflTransGen r c d)
(hab : ReflTransGen r a b) (hac : ReflTransGen r a c) : Join (ReflTransGen r) b c := by
induction hab with
| refl => exact ⟨c, hac, refl⟩
| @tail d e _ hde ih =>
rcases ih with ⟨b, hdb, hcb⟩
have : ∃ a, ReflTransGen r e a ∧ ReflGen r b a := by
clear hcb
induction hdb with
| refl => exact ⟨e, refl, ReflGen.single hde⟩
| @tail f b _ hfb ih =>
rcases ih with ⟨a, hea, hfa⟩
cases hfa with
| refl => exact ⟨b, hea.tail hfb, ReflGen.refl⟩
| single hfa =>
rcases h _ _ _ hfb hfa with ⟨c, hbc, hac⟩
exact ⟨c, hea.trans hac, hbc⟩
rcases this with ⟨a, hea, hba⟩
cases hba with
| refl => exact ⟨b, hea, hcb⟩
| single hba => exact ⟨a, hea, hcb.tail hba⟩ | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | church_rosser | A sufficient condition for the Church-Rosser property. |
join_of_single (h : Reflexive r) (hab : r a b) : Join r a b :=
⟨b, hab, h b⟩ | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | join_of_single | null |
symmetric_join : Symmetric (Join r) := fun _ _ ⟨c, hac, hcb⟩ ↦ ⟨c, hcb, hac⟩ | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | symmetric_join | null |
reflexive_join (h : Reflexive r) : Reflexive (Join r) := fun a ↦ ⟨a, h a, h a⟩ | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflexive_join | null |
transitive_join (ht : Transitive r) (h : ∀ a b c, r a b → r a c → Join r b c) :
Transitive (Join r) :=
fun _ b _ ⟨x, hax, hbx⟩ ⟨y, hby, hcy⟩ ↦
let ⟨z, hxz, hyz⟩ := h b x y hbx hby
⟨z, ht hax hxz, ht hcy hyz⟩ | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | transitive_join | null |
equivalence_join (hr : Reflexive r) (ht : Transitive r)
(h : ∀ a b c, r a b → r a c → Join r b c) : Equivalence (Join r) :=
⟨reflexive_join hr, @symmetric_join _ _, @transitive_join _ _ ht h⟩ | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | equivalence_join | null |
equivalence_join_reflTransGen
(h : ∀ a b c, r a b → r a c → ∃ d, ReflGen r b d ∧ ReflTransGen r c d) :
Equivalence (Join (ReflTransGen r)) :=
equivalence_join reflexive_reflTransGen transitive_reflTransGen fun _ _ _ ↦ church_rosser h | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | equivalence_join_reflTransGen | null |
join_of_equivalence {r' : α → α → Prop} (hr : Equivalence r) (h : ∀ a b, r' a b → r a b) :
Join r' a b → r a b
| ⟨_, hac, hbc⟩ => hr.trans (h _ _ hac) (hr.symm <| h _ _ hbc) | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | join_of_equivalence | null |
reflTransGen_of_transitive_reflexive {r' : α → α → Prop} (hr : Reflexive r)
(ht : Transitive r) (h : ∀ a b, r' a b → r a b) (h' : ReflTransGen r' a b) : r a b := by
induction h' with
| refl => exact hr _
| tail _ hbc ih => exact ht ih (h _ _ hbc) | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_of_transitive_reflexive | null |
reflTransGen_of_equivalence {r' : α → α → Prop} (hr : Equivalence r) :
(∀ a b, r' a b → r a b) → ReflTransGen r' a b → r a b :=
reflTransGen_of_transitive_reflexive hr.1 (fun _ _ _ ↦ hr.trans) | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | reflTransGen_of_equivalence | null |
Quot.eqvGen_exact (H : Quot.mk r a = Quot.mk r b) : EqvGen r a b :=
@Quotient.exact _ (EqvGen.setoid r) a b (congrArg
(Quot.lift (Quotient.mk (EqvGen.setoid r)) (fun x y h ↦ Quot.sound (EqvGen.rel x y h))) H) | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | Quot.eqvGen_exact | null |
Quot.eqvGen_sound (H : EqvGen r a b) : Quot.mk r a = Quot.mk r b :=
EqvGen.rec
(fun _ _ h ↦ Quot.sound h)
(fun _ ↦ rfl)
(fun _ _ _ IH ↦ Eq.symm IH)
(fun _ _ _ _ _ IH₁ IH₂ ↦ Eq.trans IH₁ IH₂)
H | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | Quot.eqvGen_sound | null |
Equivalence.eqvGen_iff (h : Equivalence r) : EqvGen r a b ↔ r a b :=
Iff.intro
(by
intro h
induction h with
| rel => assumption
| refl => exact h.1 _
| symm => apply h.symm; assumption
| trans _ _ _ _ _ hab hbc => exact h.trans hab hbc)
(EqvGen.rel a b) | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | Equivalence.eqvGen_iff | null |
Equivalence.eqvGen_eq (h : Equivalence r) : EqvGen r = r :=
funext fun _ ↦ funext fun _ ↦ propext <| h.eqvGen_iff | theorem | Logic | [
"Mathlib.Logic.Relator",
"Mathlib.Tactic.Use",
"Mathlib.Tactic.MkIffOfInductiveProp",
"Mathlib.Tactic.SimpRw",
"Mathlib.Logic.Basic",
"Mathlib.Order.Defs.Unbundled"
] | Mathlib/Logic/Relation.lean | Equivalence.eqvGen_eq | null |
LiftFun (f : α → γ) (g : β → δ) : Prop :=
∀ ⦃a b⦄, R a b → S (f a) (g b) | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | LiftFun | The binary relations `R : α → β → Prop` and `S : γ → δ → Prop` induce a binary
relation on functions `LiftFun : (α → γ) → (β → δ) → Prop`. |
RightTotal : Prop := ∀ b, ∃ a, R a b | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | RightTotal | `(R ⇒ S) f g` means `LiftFun R S f g`. -/
scoped infixr:40 " ⇒ " => LiftFun
end
section
variable {α : Type u₁} {β : Type u₂} (R : α → β → Prop)
/-- A relation is "right total" if every element appears on the right. |
LeftTotal : Prop := ∀ a, ∃ b, R a b | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | LeftTotal | A relation is "left total" if every element appears on the left. |
BiTotal : Prop := LeftTotal R ∧ RightTotal R | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | BiTotal | A relation is "bi-total" if it is both right total and left total. |
LeftUnique : Prop := ∀ ⦃a b c⦄, R a c → R b c → a = b | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | LeftUnique | A relation is "left unique" if every element on the right is paired with at
most one element on the left. |
RightUnique : Prop := ∀ ⦃a b c⦄, R a b → R a c → b = c | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | RightUnique | A relation is "right unique" if every element on the left is paired with at
most one element on the right. |
BiUnique : Prop := LeftUnique R ∧ RightUnique R
variable {R} | def | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | BiUnique | A relation is "bi-unique" if it is both left unique and right unique. |
RightTotal.rel_forall (h : RightTotal R) :
((R ⇒ (· → ·)) ⇒ (· → ·)) (fun p => ∀ i, p i) (fun q => ∀ i, q i) :=
fun _ _ Hrel H b => Exists.elim (h b) (fun _ Rab => Hrel Rab (H _)) | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | RightTotal.rel_forall | null |
LeftTotal.rel_exists (h : LeftTotal R) :
((R ⇒ (· → ·)) ⇒ (· → ·)) (fun p => ∃ i, p i) (fun q => ∃ i, q i) :=
fun _ _ Hrel ⟨a, pa⟩ => (h a).imp fun _ Rab => Hrel Rab pa | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | LeftTotal.rel_exists | null |
BiTotal.rel_forall (h : BiTotal R) :
((R ⇒ Iff) ⇒ Iff) (fun p => ∀ i, p i) (fun q => ∀ i, q i) :=
fun _ _ Hrel =>
⟨fun H b => Exists.elim (h.right b) (fun _ Rab => (Hrel Rab).mp (H _)),
fun H a => Exists.elim (h.left a) (fun _ Rab => (Hrel Rab).mpr (H _))⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | BiTotal.rel_forall | null |
BiTotal.rel_exists (h : BiTotal R) :
((R ⇒ Iff) ⇒ Iff) (fun p => ∃ i, p i) (fun q => ∃ i, q i) :=
fun _ _ Hrel =>
⟨fun ⟨a, pa⟩ => (h.left a).imp fun _ Rab => (Hrel Rab).1 pa,
fun ⟨b, qb⟩ => (h.right b).imp fun _ Rab => (Hrel Rab).2 qb⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | BiTotal.rel_exists | null |
left_unique_of_rel_eq {eq' : β → β → Prop} (he : (R ⇒ (R ⇒ Iff)) Eq eq') : LeftUnique R :=
fun a b c (ac : R a c) (bc : R b c) => (he ac bc).mpr ((he bc bc).mp rfl) | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | left_unique_of_rel_eq | null |
rel_imp : (Iff ⇒ (Iff ⇒ Iff)) (· → ·) (· → ·) :=
fun _ _ h _ _ l => imp_congr h l | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | rel_imp | null |
rel_not : (Iff ⇒ Iff) Not Not :=
fun _ _ h => not_congr h | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | rel_not | null |
bi_total_eq {α : Type u₁} : Relator.BiTotal (@Eq α) :=
{ left := fun a => ⟨a, rfl⟩, right := fun a => ⟨a, rfl⟩ }
variable {α : Type*} {β : Type*} {γ : Type*}
variable {r : α → β → Prop} | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | bi_total_eq | null |
LeftUnique.flip (h : LeftUnique r) : RightUnique (flip r) :=
fun _ _ _ h₁ h₂ => h h₁ h₂ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | LeftUnique.flip | null |
rel_and : ((· ↔ ·) ⇒ (· ↔ ·) ⇒ (· ↔ ·)) (· ∧ ·) (· ∧ ·) :=
fun _ _ h₁ _ _ h₂ => and_congr h₁ h₂ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | rel_and | null |
rel_or : ((· ↔ ·) ⇒ (· ↔ ·) ⇒ (· ↔ ·)) (· ∨ ·) (· ∨ ·) :=
fun _ _ h₁ _ _ h₂ => or_congr h₁ h₂ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | rel_or | null |
rel_iff : ((· ↔ ·) ⇒ (· ↔ ·) ⇒ (· ↔ ·)) (· ↔ ·) (· ↔ ·) :=
fun _ _ h₁ _ _ h₂ => iff_congr h₁ h₂ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | rel_iff | null |
rel_eq {r : α → β → Prop} (hr : BiUnique r) : (r ⇒ r ⇒ (· ↔ ·)) (· = ·) (· = ·) :=
fun _ _ h₁ _ _ h₂ => ⟨fun h => hr.right h₁ <| h.symm ▸ h₂, fun h => hr.left h₁ <| h.symm ▸ h₂⟩
open Function
variable {r₁₁ : α → α → Prop} {r₁₂ : α → β → Prop} {r₂₁ : β → α → Prop}
{r₂₃ : β → γ → Prop} {r₁₃ : α → γ → Prop} | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | rel_eq | null |
protected refl (hr : ∀ a : α, r₁₁ a a) :
LeftTotal r₁₁ :=
fun a ↦ ⟨a, hr _⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | refl | null |
protected symm (hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) :
LeftTotal r₁₂ → RightTotal r₂₁ :=
fun h a ↦ (h a).imp (fun _ ↦ hr _ _) | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | symm | null |
protected trans (hr : ∀ (a : α) (b : β) (c : γ), r₁₂ a b → r₂₃ b c → r₁₃ a c) :
LeftTotal r₁₂ → LeftTotal r₂₃ → LeftTotal r₁₃ :=
fun h₁ h₂ a ↦ let ⟨b, hab⟩ := h₁ a; let ⟨c, hbc⟩ := h₂ b; ⟨c, hr _ _ _ hab hbc⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | trans | null |
protected refl (hr : ∀ a : α, r₁₁ a a) : RightTotal r₁₁ :=
LeftTotal.refl hr | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | refl | null |
protected symm (hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) :
RightTotal r₁₂ → LeftTotal r₂₁ :=
LeftTotal.symm (fun _ _ ↦ hr _ _) | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | symm | null |
protected trans (hr : ∀ (a : α) (b : β) (c : γ), r₁₂ a b → r₂₃ b c → r₁₃ a c) :
RightTotal r₁₂ → RightTotal r₂₃ → RightTotal r₁₃ :=
swap <| LeftTotal.trans (fun _ _ _ ↦ swap <| hr _ _ _) | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | trans | null |
protected refl (hr : ∀ a : α, r₁₁ a a) :
BiTotal r₁₁ :=
⟨LeftTotal.refl hr, RightTotal.refl hr⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | refl | null |
protected symm (hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) :
BiTotal r₁₂ → BiTotal r₂₁ :=
fun h ↦ ⟨h.2.symm hr, h.1.symm hr⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | symm | null |
protected trans (hr : ∀ (a : α) (b : β) (c : γ), r₁₂ a b → r₂₃ b c → r₁₃ a c) :
BiTotal r₁₂ → BiTotal r₂₃ → BiTotal r₁₃ :=
fun h₁ h₂ ↦ ⟨h₁.1.trans hr h₂.1, h₁.2.trans hr h₂.2⟩ | lemma | Logic | [
"Mathlib.Logic.Function.Defs"
] | Mathlib/Logic/Relator.lean | trans | null |
@[ext]
Unique (α : Sort u) extends Inhabited α where
/-- In a `Unique` type, every term is equal to the default element (from `Inhabited`). -/
uniq : ∀ a : α, a = default
attribute [class] Unique | structure | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Unique | `Unique α` expresses that `α` is a type with a unique term `default`.
This is implemented as a type, rather than a `Prop`-valued predicate,
for good definitional properties of the default term. |
unique_iff_existsUnique (α : Sort u) : Nonempty (Unique α) ↔ ∃! _ : α, True :=
⟨fun ⟨u⟩ ↦ ⟨u.default, trivial, fun a _ ↦ u.uniq a⟩,
fun ⟨a, _, h⟩ ↦ ⟨⟨⟨a⟩, fun _ ↦ h _ trivial⟩⟩⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | unique_iff_existsUnique | null |
unique_subtype_iff_existsUnique {α} (p : α → Prop) :
Nonempty (Unique (Subtype p)) ↔ ∃! a, p a :=
⟨fun ⟨u⟩ ↦ ⟨u.default.1, u.default.2, fun a h ↦ congr_arg Subtype.val (u.uniq ⟨a, h⟩)⟩,
fun ⟨a, ha, he⟩ ↦ ⟨⟨⟨⟨a, ha⟩⟩, fun ⟨b, hb⟩ ↦ by
congr
exact he b hb⟩⟩⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | unique_subtype_iff_existsUnique | null |
uniqueOfSubsingleton {α : Sort*} [Subsingleton α] (a : α) : Unique α where
default := a
uniq _ := Subsingleton.elim _ _ | abbrev | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | uniqueOfSubsingleton | Given an explicit `a : α` with `Subsingleton α`, we can construct
a `Unique α` instance. This is a def because the typeclass search cannot
arbitrarily invent the `a : α` term. Nevertheless, these instances are all
equivalent by `Unique.Subsingleton.unique`.
See note [reducible non-instances]. |
PUnit.instUnique : Unique PUnit.{u} where
default := PUnit.unit
uniq x := subsingleton x _
@[simp] | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | PUnit.instUnique | null |
PUnit.default_eq_unit : (default : PUnit) = PUnit.unit :=
rfl | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | PUnit.default_eq_unit | null |
uniqueProp {p : Prop} (h : p) : Unique.{0} p where
default := h
uniq _ := rfl | def | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | uniqueProp | Every provable proposition is unique, as all proofs are equal. |
eq_default (a : α) : a = default :=
uniq _ a | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | eq_default | null |
default_eq (a : α) : default = a :=
(uniq _ a).symm | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | default_eq | null |
forall_iff {p : α → Prop} : (∀ a, p a) ↔ p default :=
⟨fun h ↦ h _, fun h x ↦ by rwa [Unique.eq_default x]⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | forall_iff | null |
exists_iff {p : α → Prop} : Exists p ↔ p default :=
⟨fun ⟨a, ha⟩ ↦ eq_default a ▸ ha, Exists.intro default⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | exists_iff | null |
@[ext]
protected subsingleton_unique' : ∀ h₁ h₂ : Unique α, h₁ = h₂
| ⟨⟨x⟩, h⟩, ⟨⟨y⟩, _⟩ => by congr; rw [h x, h y] | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | subsingleton_unique' | null |
subsingleton_unique : Subsingleton (Unique α) :=
⟨Unique.subsingleton_unique'⟩ | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | subsingleton_unique | null |
mk' (α : Sort u) [h₁ : Inhabited α] [Subsingleton α] : Unique α :=
{ h₁ with uniq := fun _ ↦ Subsingleton.elim _ _ } | abbrev | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | mk' | Construct `Unique` from `Inhabited` and `Subsingleton`. Making this an instance would create
a loop in the class inheritance graph. |
nonempty_unique (α : Sort u) [Subsingleton α] [Nonempty α] : Nonempty (Unique α) := by
inhabit α
exact ⟨Unique.mk' α⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | nonempty_unique | null |
unique_iff_subsingleton_and_nonempty (α : Sort u) :
Nonempty (Unique α) ↔ Subsingleton α ∧ Nonempty α :=
⟨fun ⟨u⟩ ↦ by constructor <;> exact inferInstance,
fun ⟨hs, hn⟩ ↦ nonempty_unique α⟩
variable {α : Sort*}
@[simp] | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | unique_iff_subsingleton_and_nonempty | null |
Pi.default_def {β : α → Sort v} [∀ a, Inhabited (β a)] :
@default (∀ a, β a) _ = fun a : α ↦ @default (β a) _ :=
rfl | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Pi.default_def | null |
Pi.default_apply {β : α → Sort v} [∀ a, Inhabited (β a)] (a : α) :
@default (∀ a, β a) _ a = default :=
rfl | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Pi.default_apply | null |
Pi.unique {β : α → Sort v} [∀ a, Unique (β a)] : Unique (∀ a, β a) where
uniq := fun _ ↦ funext fun _ ↦ Unique.eq_default _ | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Pi.unique | null |
Pi.uniqueOfIsEmpty [IsEmpty α] (β : α → Sort v) : Unique (∀ a, β a) where
default := isEmptyElim
uniq _ := funext isEmptyElim | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Pi.uniqueOfIsEmpty | There is a unique function on an empty domain. |
eq_const_of_subsingleton {β : Sort*} [Subsingleton α] (f : α → β) (a : α) :
f = Function.const α (f a) :=
funext fun x ↦ Subsingleton.elim x a ▸ rfl | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | eq_const_of_subsingleton | null |
eq_const_of_unique {β : Sort*} [Unique α] (f : α → β) : f = Function.const α (f default) :=
eq_const_of_subsingleton .. | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | eq_const_of_unique | null |
heq_const_of_unique [Unique α] {β : α → Sort v} (f : ∀ a, β a) :
f ≍ Function.const α (f default) :=
(Function.hfunext rfl) fun i _ _ ↦ by rw [Subsingleton.elim i default]; rfl | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | heq_const_of_unique | null |
protected Injective.subsingleton (hf : Injective f) [Subsingleton β] : Subsingleton α :=
⟨fun _ _ ↦ hf <| Subsingleton.elim _ _⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Injective.subsingleton | If the codomain of an injective function is a subsingleton, then the domain
is a subsingleton as well. |
protected Surjective.subsingleton [Subsingleton α] (hf : Surjective f) : Subsingleton β :=
⟨hf.forall₂.2 fun x y ↦ congr_arg f <| Subsingleton.elim x y⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Surjective.subsingleton | If the domain of a surjective function is a subsingleton, then the codomain is a subsingleton as
well. |
protected Surjective.unique {α : Sort u} (f : α → β) (hf : Surjective f) [Unique.{u} α] :
Unique β :=
@Unique.mk' _ ⟨f default⟩ hf.subsingleton | def | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Surjective.unique | If the domain of a surjective function is a singleton,
then the codomain is a singleton as well. |
protected Injective.unique [Inhabited α] [Subsingleton β] (hf : Injective f) : Unique α :=
@Unique.mk' _ _ hf.subsingleton | def | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Injective.unique | If `α` is inhabited and admits an injective map to a subsingleton type, then `α` is `Unique`. |
Surjective.uniqueOfSurjectiveConst (α : Type*) {β : Type*} (b : β)
(h : Function.Surjective (Function.const α b)) : Unique β :=
@uniqueOfSubsingleton _ (subsingleton_of_forall_eq b <| h.forall.mpr fun _ ↦ rfl) b | def | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Surjective.uniqueOfSurjectiveConst | If a constant function is surjective, then the codomain is a singleton. |
uniqueElim [Unique ι] (x : α (default : ι)) (i : ι) : α i := by
rw [Unique.eq_default i]
exact x
@[simp] | def | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | uniqueElim | Given one value over a unique, we get a dependent function. |
uniqueElim_default {_ : Unique ι} (x : α (default : ι)) : uniqueElim x (default : ι) = x :=
rfl
@[simp] | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | uniqueElim_default | null |
uniqueElim_const {β : Sort*} {_ : Unique ι} (x : β) (i : ι) :
uniqueElim (α := fun _ ↦ β) x i = x :=
rfl | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | uniqueElim_const | null |
Unique.bijective {A B} [Unique A] [Unique B] {f : A → B} : Function.Bijective f := by
rw [Function.bijective_iff_has_inverse]
refine ⟨default, ?_, ?_⟩ <;> intro x <;> simp | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Unique.bijective | null |
subsingleton_iff_isEmpty {α : Type u} : Subsingleton (Option α) ↔ IsEmpty α :=
⟨fun h ↦ ⟨fun x ↦ Option.noConfusion <| @Subsingleton.elim _ h x none⟩,
fun h ↦ ⟨fun x y ↦
Option.casesOn x (Option.casesOn y rfl fun x ↦ h.elim x) fun x ↦ h.elim x⟩⟩ | theorem | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | subsingleton_iff_isEmpty | `Option α` is a `Subsingleton` if and only if `α` is empty. |
Unique.subtypeEq (y : α) : Unique { x // x = y } where
default := ⟨y, rfl⟩
uniq := fun ⟨x, hx⟩ ↦ by congr | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Unique.subtypeEq | null |
Unique.subtypeEq' (y : α) : Unique { x // y = x } where
default := ⟨y, rfl⟩
uniq := fun ⟨x, hx⟩ ↦ by subst hx; congr | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Unique.subtypeEq' | null |
Fin.instUnique : Unique (Fin 1) where uniq _ := Subsingleton.elim _ _ | instance | Logic | [
"Mathlib.Logic.IsEmpty",
"Mathlib.Tactic.Inhabit"
] | Mathlib/Logic/Unique.lean | Fin.instUnique | null |
@[pp_with_univ, mk_iff]
UnivLE : Prop where
small (α : Type u) : Small.{v} α
attribute [instance] UnivLE.small
/- This is useless as an instance due to https://github.com/leanprover/lean4/issues/2297 -/ | class | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | UnivLE | A class expressing a universe inequality. `UnivLE.{u, v}` expresses that `u ≤ v`.
There used to be a stronger definition `∀ α : Type max u v, Small.{v} α` that immediately implies
`Small.{v} ((α : Type u) → (β : Type v))` which is essential for proving that `Type v` has
`Type u`-indexed limits when `u ≤ v`. However the current weaker condition
`∀ α : Type u, Small.{v} α` also implies the same, so we switched to use it for
its simplicity and transitivity.
The strong definition easily implies the weaker definition (see below),
but we cannot prove the reverse implication.
This is because in Lean's type theory, while `max u v` is at least at big as `u` and `v`,
it could be bigger than both!
See also `Mathlib/CategoryTheory/UnivLE.lean` for the statement that the stronger definition is
equivalent to `EssSurj (uliftFunctor : Type v ⥤ Type max u v)`. |
univLE_max : UnivLE.{u, max u v} where small α := small_max.{v} α | theorem | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | univLE_max | null |
Small.trans_univLE (α : Type w) [hα : Small.{u} α] [h : UnivLE.{u, v}] :
Small.{v} α :=
let ⟨β, ⟨f⟩⟩ := hα.equiv_small
let ⟨_, ⟨g⟩⟩ := (h.small β).equiv_small
⟨_, ⟨f.trans g⟩⟩ | theorem | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | Small.trans_univLE | null |
UnivLE.trans [UnivLE.{u, v}] [UnivLE.{v, w}] : UnivLE.{u, w} where
small α := Small.trans_univLE α | theorem | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | UnivLE.trans | null |
UnivLE.self : UnivLE.{u, u} := ⟨inferInstance⟩ | instance | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | UnivLE.self | null |
UnivLE.zero : UnivLE.{0, u} := ⟨inferInstance⟩ | instance | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | UnivLE.zero | null |
UnivLE.succ [UnivLE.{u, v}] : UnivLE.{u, v + 1} := @UnivLE.trans _ ⟨inferInstance⟩
/- This is the crucial instance that subsumes `univLE_max`. -/ | theorem | Logic | [
"Mathlib.Logic.Small.Defs"
] | Mathlib/Logic/UnivLE.lean | UnivLE.succ | This is redundant as an instance given the below. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.