Module docstring
{"# Relator for functions, pairs, sums, and lists. "}
{"# Relator for functions, pairs, sums, and lists. "}
Relator.LiftFun
definition
(f : α → γ) (g : β → δ) : Prop
/-- The binary relations `R : α → β → Prop` and `S : γ → δ → Prop` induce a binary
relation on functions `LiftFun : (α → γ) → (β → δ) → Prop`. -/
def LiftFun (f : α → γ) (g : β → δ) : Prop :=
∀⦃a b⦄, R a b → S (f a) (g b)
Relator.term_⇒_
definition
: Lean.TrailingParserDescr✝
Relator.RightTotal
definition
: Prop
/-- A relation is "right total" if every element appears on the right. -/
def RightTotal : Prop := ∀ b, ∃ a, R a b
Relator.LeftTotal
definition
: Prop
/-- A relation is "left total" if every element appears on the left. -/
def LeftTotal : Prop := ∀ a, ∃ b, R a b
Relator.BiTotal
definition
: Prop
/-- A relation is "bi-total" if it is both right total and left total. -/
def BiTotal : Prop := LeftTotalLeftTotal R ∧ RightTotal R
Relator.LeftUnique
definition
: Prop
/-- A relation is "left unique" if every element on the right is paired with at
most one element on the left. -/
def LeftUnique : Prop := ∀ ⦃a b c⦄, R a c → R b c → a = b
Relator.RightUnique
definition
: Prop
/-- A relation is "right unique" if every element on the left is paired with at
most one element on the right. -/
def RightUnique : Prop := ∀ ⦃a b c⦄, R a b → R a c → b = c
Relator.BiUnique
definition
: Prop
/-- A relation is "bi-unique" if it is both left unique and right unique. -/
def BiUnique : Prop := LeftUniqueLeftUnique R ∧ RightUnique R
Relator.RightTotal.rel_forall
theorem
(h : RightTotal R) : ((R ⇒ (· → ·)) ⇒ (· → ·)) (fun p => ∀ i, p i) (fun q => ∀ i, q i)
lemma 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 _))
Relator.LeftTotal.rel_exists
theorem
(h : LeftTotal R) : ((R ⇒ (· → ·)) ⇒ (· → ·)) (fun p => ∃ i, p i) (fun q => ∃ i, q i)
lemma 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
Relator.BiTotal.rel_forall
theorem
(h : BiTotal R) : ((R ⇒ Iff) ⇒ Iff) (fun p => ∀ i, p i) (fun q => ∀ i, q i)
lemma 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 _))⟩
Relator.BiTotal.rel_exists
theorem
(h : BiTotal R) : ((R ⇒ Iff) ⇒ Iff) (fun p => ∃ i, p i) (fun q => ∃ i, q i)
lemma 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⟩
Relator.left_unique_of_rel_eq
theorem
{eq' : β → β → Prop} (he : (R ⇒ (R ⇒ Iff)) Eq eq') : LeftUnique R
lemma 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)
Relator.rel_imp
theorem
: (Iff ⇒ (Iff ⇒ Iff)) (· → ·) (· → ·)
lemma rel_imp : (IffIff ⇒ (Iff ⇒ Iff)) (· → ·) (· → ·) :=
fun _ _ h _ _ l => imp_congr h l
Relator.rel_not
theorem
: (Iff ⇒ Iff) Not Not
Relator.bi_total_eq
theorem
{α : Type u₁} : Relator.BiTotal (@Eq α)
lemma bi_total_eq {α : Type u₁} : Relator.BiTotal (@Eq α) :=
{ left := fun a => ⟨a, rfl⟩, right := fun a => ⟨a, rfl⟩ }
Relator.LeftUnique.flip
theorem
(h : LeftUnique r) : RightUnique (flip r)
lemma LeftUnique.flip (h : LeftUnique r) : RightUnique (flip r) :=
fun _ _ _ h₁ h₂ => h h₁ h₂
Relator.rel_and
theorem
: ((· ↔ ·) ⇒ (· ↔ ·) ⇒ (· ↔ ·)) (· ∧ ·) (· ∧ ·)
lemma rel_and : ((·↔·) ⇒ (·↔·) ⇒ (·↔·)) (·∧·) (·∧·) :=
fun _ _ h₁ _ _ h₂ => and_congr h₁ h₂
Relator.rel_or
theorem
: ((· ↔ ·) ⇒ (· ↔ ·) ⇒ (· ↔ ·)) (· ∨ ·) (· ∨ ·)
lemma rel_or : ((·↔·) ⇒ (·↔·) ⇒ (·↔·)) (·∨·) (·∨·) :=
fun _ _ h₁ _ _ h₂ => or_congr h₁ h₂
Relator.rel_iff
theorem
: ((· ↔ ·) ⇒ (· ↔ ·) ⇒ (· ↔ ·)) (· ↔ ·) (· ↔ ·)
lemma rel_iff : ((·↔·) ⇒ (·↔·) ⇒ (·↔·)) (·↔·) (·↔·) :=
fun _ _ h₁ _ _ h₂ => iff_congr h₁ h₂
Relator.rel_eq
theorem
{r : α → β → Prop} (hr : BiUnique r) : (r ⇒ r ⇒ (· ↔ ·)) (· = ·) (· = ·)
lemma 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₂⟩
Relator.LeftTotal.refl
theorem
(hr : ∀ a : α, r₁₁ a a) : LeftTotal r₁₁
Relator.LeftTotal.symm
theorem
(hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) : LeftTotal r₁₂ → RightTotal r₂₁
protected lemma symm (hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) :
LeftTotal r₁₂ → RightTotal r₂₁ :=
fun h a ↦ (h a).imp (fun _ ↦ hr _ _)
Relator.LeftTotal.trans
theorem
(hr : ∀ (a : α) (b : β) (c : γ), r₁₂ a b → r₂₃ b c → r₁₃ a c) : LeftTotal r₁₂ → LeftTotal r₂₃ → LeftTotal r₁₃
protected lemma 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⟩
Relator.RightTotal.refl
theorem
(hr : ∀ a : α, r₁₁ a a) : RightTotal r₁₁
protected lemma refl (hr : ∀ a : α, r₁₁ a a) : RightTotal r₁₁ :=
LeftTotal.refl hr
Relator.RightTotal.symm
theorem
(hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) : RightTotal r₁₂ → LeftTotal r₂₁
protected lemma symm (hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) :
RightTotal r₁₂ → LeftTotal r₂₁ :=
LeftTotal.symm (fun _ _ ↦ hr _ _)
Relator.RightTotal.trans
theorem
(hr : ∀ (a : α) (b : β) (c : γ), r₁₂ a b → r₂₃ b c → r₁₃ a c) : RightTotal r₁₂ → RightTotal r₂₃ → RightTotal r₁₃
protected lemma 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 _ _ _)
Relator.BiTotal.refl
theorem
(hr : ∀ a : α, r₁₁ a a) : BiTotal r₁₁
protected lemma refl (hr : ∀ a : α, r₁₁ a a) :
BiTotal r₁₁ :=
⟨LeftTotal.refl hr, RightTotal.refl hr⟩
Relator.BiTotal.symm
theorem
(hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) : BiTotal r₁₂ → BiTotal r₂₁
protected lemma symm (hr : ∀ (a : α) (b : β), r₁₂ a b → r₂₁ b a) :
BiTotal r₁₂ → BiTotal r₂₁ :=
fun h ↦ ⟨h.2.symm hr, h.1.symm hr⟩
Relator.BiTotal.trans
theorem
(hr : ∀ (a : α) (b : β) (c : γ), r₁₂ a b → r₂₃ b c → r₁₃ a c) : BiTotal r₁₂ → BiTotal r₂₃ → BiTotal r₁₃
protected lemma 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⟩