Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Mathlib/Logic/Relation.lean
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,24 @@ theorem mono {r p : α → α → Prop} (hrp : ∀ a b, r a b → p a b) (h : Eq
| symm a b _ ih => exact EqvGen.symm _ _ ih
| trans a b c _ _ hab hbc => exact EqvGen.trans _ _ _ hab hbc

lemma map (f : α → β) (r : β → β → Prop) (x y : α)
(h : EqvGen (fun x y ↦ r (f x) (f y)) x y) : EqvGen r (f x) (f y) := by
induction h with
| rel => apply EqvGen.rel; assumption
| refl => exact EqvGen.refl _
| symm => apply EqvGen.symm; assumption
| trans => apply EqvGen.trans <;> assumption
Comment on lines +805 to +811

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention seems to suggest:

theorem lift {p : β → β → Prop} {a b : α} (f : α → β) (h : ∀ a b, r a b → p (f a) (f b))
    (hab : EqvGen r a b) : EqvGen p (f a) (f b) := sorry

theorem lift' {p : β → β → Prop} {a b : α} (f : α → β) (h : ∀ a b, r a b → EqvGen p (f a) (f b))
    (hab : EqvGen r a b) : EqvGen p (f a) (f b) := sorry


@[simp]
lemma idempotent (r : α → α → Prop) : EqvGen (EqvGen r) = EqvGen r := by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that if placed at the very end of this module, we can write:

lemma idempotent (r : α → α → Prop) : EqvGen (EqvGen r) = EqvGen r :=
  Equivalence.eqvGen_eq (EqvGen.is_equivalence r)

I'm not 100% sure about the naming and statement. The analogous Relation.reflTransGen_idem uses a different naming, but this is also deprecated for the more general Relation.reflTransGen_eq_self. I think the situation is slightly different here because of Equivalence not being a typeclass that is inferred. If this were using IsEquiv, it'd be straightforward to just keep the generalization, but maybe here we need both.

ext x y
refine ⟨fun h ↦ ?_, fun h ↦ EqvGen.rel _ _ h⟩
induction h with
| rel => assumption
| refl => exact EqvGen.refl _
| symm => apply EqvGen.symm; assumption
| trans => apply EqvGen.trans <;> assumption

end EqvGen

/-- The join of a relation on a single type is a new relation for which
Expand Down
Loading