Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

feat(order/minimal): Image of maximals under a rel_embedding #17017

Closed
wants to merge 3 commits into from
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
29 changes: 29 additions & 0 deletions src/order/minimal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,35 @@ begin
rwa of_not_not (λ hab, ht ha (h hb) hab hr),
end

lemma image_maximals {α β : Type*} {r : α → α → Prop} {s : β → β → Prop} (f : α → β)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can take advantage of existing variables, and it might even make sense to move some more of these to the variables line at the top of the file.

(t : set α) (h₁ : ∀ x y ∈ t, r x y ↔ s (f x) (f y)) :
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this hypothesis ought to be h, and the hypothesis in the proof ought to be h' or h₁ or hf.

Suggested change
(t : set α) (h : ∀ x y ∈ t, r x y ↔ s (f x) (f y)) :
(t : set α) (h : ∀ x y ∈ t, r x y ↔ s (f x) (f y)) :

f '' maximals r t = maximals s (f '' t) :=
begin
ext,
split,
{ rintros ⟨x, hx, rfl⟩,
refine ⟨⟨_, hx.1, rfl⟩, _⟩,
rintros _ ⟨y, hy, rfl⟩ e,
exact (h₁ _ hy _ hx.1).mp (hx.2 hy ((h₁ _ hx.1 _ hy).mpr e)) },
Comment on lines +151 to +152
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's a minor golf, up to you.

Suggested change
rintros _ ⟨y, hy, rfl⟩ e,
exact (h₁ _ hy _ hx.1).mp (hx.2 hy ((h₁ _ hx.1 _ hy).mpr e)) },
rintros _ ⟨y, hy, rfl⟩,
exact (h₁ _ hy _ hx.1).mp hx.2 hy ∘ (h₁ _ hx.1 _ hy).mpr },

{ rintros ⟨⟨x, hx, rfl⟩, h⟩,
refine ⟨x, ⟨hx, _⟩, rfl⟩,
rintros y hy e,
exact (h₁ _ hy _ hx).mpr (h ⟨y, hy, rfl⟩ ((h₁ _ hx _ hy).mp e)) }
Comment on lines +154 to +156
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's a golf.

Suggested change
refine ⟨x, ⟨hx, _⟩, rfl⟩,
rintros y hy e,
exact (h₁ _ hy _ hx).mpr (h ⟨y, hy, rfl⟩ ((h₁ _ hx _ hy).mp e)) }
exact ⟨x, ⟨hx, λ y hy, (h₁ y hy x hx).mpr ∘ h ⟨y, hy, rfl⟩ ∘ (h₁ x hx y hy).mp⟩, rfl⟩ }

end

lemma image_minimals {α β : Type*} {r : α → α → Prop} {s : β → β → Prop} (f : α → β)
(t : set α) (h₁ : ∀ x y ∈ t, r x y ↔ s (f x) (f y)) :
f '' minimals r t = minimals s (f '' t) :=
image_maximals f t (λ x hx y hy, h₁ y hy x hx)

lemma rel_embedding.image_maximals {α β : Type*} {r : α → α → Prop} {s : β → β → Prop}
(f : r ↪r s) (t : set α) : f '' maximals r t = maximals s (f '' t) :=
image_maximals f t (λ _ _ _ _, f.map_rel_iff.symm)

lemma rel_embedding.image_minimals {α β : Type*} {r : α → α → Prop} {s : β → β → Prop}
(f : r ↪r s) (t : set α) : f '' minimals r t = minimals s (f '' t) :=
f.swap.image_maximals t

variables [partial_order α]

lemma is_least.mem_minimals (h : is_least s a) : a ∈ minimals (≤) s := ⟨h.1, λ b hb _, h.2 hb⟩
Expand Down