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

Commit 091ccfb

Browse files
committed
feat(order/bounded_order): with_top.of_dual (#15727)
`with_top.to_dual : with_top α ≃ with_bot αᵒᵈ` Also define * `with_top.of_dual` * `with_bot.to_dual` * `with_bot.of_dual` API on the application of these added, their relation to `le` and `lt`, and how they interact with `with_{bot,top}.map` Some `with_top` proofs that broke through the `option` or `order_dual` API have been rephrased to carry over the `with_bot` proofs across these functions.
1 parent 75edc28 commit 091ccfb

File tree

2 files changed

+236
-56
lines changed

2 files changed

+236
-56
lines changed

src/order/bounded_order.lean

Lines changed: 204 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,34 @@ option.rec h₁ h₂
874874
@[simp] lemma rec_top_coe_coe {C : with_top α → Sort*} (d : C ⊤) (f : Π (a : α), C a)
875875
(x : α) : @rec_top_coe _ C d f ↑x = f x := rfl
876876

877+
/-- `with_top.to_dual` is the equivalence sending `⊤` to `⊥` and any `a : α` to `to_dual a : αᵒᵈ`.
878+
See `with_top.to_dual_bot_equiv` for the related order-iso.
879+
-/
880+
protected def to_dual : with_top α ≃ with_bot αᵒᵈ := equiv.refl _
881+
/-- `with_top.of_dual` is the equivalence sending `⊤` to `⊥` and any `a : αᵒᵈ` to `of_dual a : α`.
882+
See `with_top.to_dual_bot_equiv` for the related order-iso.
883+
-/
884+
protected def of_dual : with_top αᵒᵈ ≃ with_bot α := equiv.refl _
885+
/-- `with_bot.to_dual` is the equivalence sending `⊥` to `⊤` and any `a : α` to `to_dual a : αᵒᵈ`.
886+
See `with_bot.to_dual_top_equiv` for the related order-iso.
887+
-/
888+
protected def _root_.with_bot.to_dual : with_bot α ≃ with_top αᵒᵈ := equiv.refl _
889+
/-- `with_bot.of_dual` is the equivalence sending `⊥` to `⊤` and any `a : αᵒᵈ` to `of_dual a : α`.
890+
See `with_bot.to_dual_top_equiv` for the related order-iso.
891+
-/
892+
protected def _root_.with_bot.of_dual : with_bot αᵒᵈ ≃ with_top α := equiv.refl _
893+
894+
@[simp] lemma to_dual_symm_apply (a : with_bot αᵒᵈ) :
895+
with_top.to_dual.symm a = a.of_dual := rfl
896+
@[simp] lemma of_dual_symm_apply (a : with_bot α) :
897+
with_top.of_dual.symm a = a.to_dual := rfl
898+
899+
@[simp] lemma to_dual_apply_top : with_top.to_dual (⊤ : with_top α) = ⊥ := rfl
900+
@[simp] lemma of_dual_apply_top : with_top.of_dual (⊤ : with_top α) = ⊥ := rfl
901+
902+
@[simp] lemma to_dual_apply_coe (a : α) : with_top.to_dual (a : with_top α) = to_dual a := rfl
903+
@[simp] lemma of_dual_apply_coe (a : αᵒᵈ) : with_top.of_dual (a : with_top αᵒᵈ) = of_dual a := rfl
904+
877905
/-- Specialization of `option.get_or_else` to values in `with_top α` that respects API boundaries.
878906
-/
879907
def untop' (d : α) (x : with_top α) : α := rec_top_coe d id x
@@ -889,6 +917,16 @@ def map (f : α → β) : with_top α → with_top β := option.map f
889917
@[simp] lemma map_top (f : α → β) : map f ⊤ = ⊤ := rfl
890918
@[simp] lemma map_coe (f : α → β) (a : α) : map f a = f a := rfl
891919

920+
lemma map_to_dual (f : αᵒᵈ → βᵒᵈ) (a : with_bot α) :
921+
map f (with_bot.to_dual a) = a.map (to_dual ∘ f) := rfl
922+
lemma map_of_dual (f : α → β) (a : with_bot αᵒᵈ) :
923+
map f (with_bot.of_dual a) = a.map (of_dual ∘ f) := rfl
924+
925+
lemma to_dual_map (f : α → β) (a : with_top α) :
926+
with_top.to_dual (map f a) = with_bot.map (to_dual ∘ f ∘ of_dual) a.to_dual := rfl
927+
lemma of_dual_map (f : αᵒᵈ → βᵒᵈ) (a : with_top αᵒᵈ) :
928+
with_top.of_dual (map f a) = with_bot.map (of_dual ∘ f ∘ to_dual) a.of_dual := rfl
929+
892930
lemma ne_top_iff_exists {x : with_top α} : x ≠ ⊤ ↔ ∃ (a : α), ↑a = x := option.ne_none_iff_exists
893931

894932
/-- Deconstruct a `x : with_top α` to the underlying value in `α`, given a proof that `x ≠ ⊤`. -/
@@ -912,11 +950,26 @@ variables [has_le α]
912950
@[priority 10]
913951
instance : has_le (with_top α) := ⟨λ o₁ o₂ : option α, ∀ a ∈ o₂, ∃ b ∈ o₁, b ≤ a⟩
914952

915-
@[simp] lemma some_le_some : @has_le.le (with_top α) _ (some a) (some b) ↔ a ≤ b := by simp [(≤)]
916-
@[simp, norm_cast] lemma coe_le_coe : (a : with_top α) ≤ b ↔ a ≤ b := some_le_some
953+
lemma to_dual_le_iff {a : with_top α} {b : with_bot αᵒᵈ} :
954+
with_top.to_dual a ≤ b ↔ with_bot.of_dual b ≤ a := iff.rfl
955+
lemma le_to_dual_iff {a : with_bot αᵒᵈ} {b : with_top α} :
956+
a ≤ with_top.to_dual b ↔ b ≤ with_bot.of_dual a := iff.rfl
957+
@[simp] lemma to_dual_le_to_dual_iff {a b : with_top α} :
958+
with_top.to_dual a ≤ with_top.to_dual b ↔ b ≤ a := iff.rfl
959+
960+
lemma of_dual_le_iff {a : with_top αᵒᵈ} {b : with_bot α} :
961+
with_top.of_dual a ≤ b ↔ with_bot.to_dual b ≤ a := iff.rfl
962+
lemma le_of_dual_iff {a : with_bot α} {b : with_top αᵒᵈ} :
963+
a ≤ with_top.of_dual b ↔ b ≤ with_bot.to_dual a := iff.rfl
964+
@[simp] lemma of_dual_le_of_dual_iff {a b : with_top αᵒᵈ} :
965+
with_top.of_dual a ≤ with_top.of_dual b ↔ b ≤ a := iff.rfl
966+
967+
@[simp, norm_cast] lemma coe_le_coe : (a : with_top α) ≤ b ↔ a ≤ b :=
968+
by simp only [←to_dual_le_to_dual_iff, to_dual_apply_coe, with_bot.coe_le_coe, to_dual_le_to_dual]
917969

970+
@[simp] lemma some_le_some : @has_le.le (with_top α) _ (some a) (some b) ↔ a ≤ b := coe_le_coe
918971
@[simp] lemma le_none {a : with_top α} : @has_le.le (with_top α) _ a none :=
919-
λ b h, option.no_confusion h
972+
to_dual_le_to_dual_iff.mp with_bot.none_le
920973

921974
instance : order_top (with_top α) := { le_top := λ a, le_none, .. with_top.has_top }
922975

@@ -932,17 +985,23 @@ lemma not_top_le_coe (a : α) : ¬ (⊤ : with_top α) ≤ ↑a := with_bot.not_
932985
lemma le_coe : ∀ {o : option α}, a ∈ o → (@has_le.le (with_top α) _ o b ↔ a ≤ b) | _ rfl :=
933986
coe_le_coe
934987

935-
lemma le_coe_iff : ∀ {x : with_top α}, x ≤ b ↔ ∃ a : α, x = a ∧ a ≤ b
936-
| (some a) := by simp [some_eq_coe, coe_eq_coe]
937-
| none := iff_of_false (not_top_le_coe _) $ by simp [none_eq_top]
988+
lemma le_coe_iff {x : with_top α} : x ≤ b ↔ ∃ a : α, x = a ∧ a ≤ b :=
989+
by simpa [←to_dual_le_to_dual_iff, with_bot.coe_le_iff]
938990

939-
lemma coe_le_iff : ∀ {x : with_top α}, ↑a ≤ x ↔ ∀ b, x = ↑b → a ≤ b
940-
| (some b) := by simp [some_eq_coe, coe_eq_coe]
941-
| none := by simp [none_eq_top]
991+
lemma coe_le_iff {x : with_top α} : ↑a ≤ x ↔ ∀ b, x = ↑b → a ≤ b :=
992+
begin
993+
simp only [←to_dual_le_to_dual_iff, to_dual_apply_coe, with_bot.le_coe_iff, order_dual.forall,
994+
to_dual_le_to_dual],
995+
exact forall₂_congr (λ _ _, iff.rfl)
996+
end
942997

943-
protected lemma _root_.is_min.with_top (h : is_min a) : is_min (a : with_top α)
944-
| none _ := le_top
945-
| (some b) hb := some_le_some.2 $ h $ some_le_some.1 hb
998+
protected lemma _root_.is_min.with_top (h : is_min a) : is_min (a : with_top α) :=
999+
begin
1000+
-- defeq to is_max_to_dual_iff.mp (is_max.with_bot _), but that breaks API boundary
1001+
intros _ hb,
1002+
rw ←to_dual_le_to_dual_iff at hb,
1003+
simpa [to_dual_le_iff] using (is_max.with_bot h : is_max (to_dual a : with_bot αᵒᵈ)) hb
1004+
end
9461005

9471006
end has_le
9481007

@@ -952,50 +1011,138 @@ variables [has_lt α]
9521011
@[priority 10]
9531012
instance : has_lt (with_top α) := ⟨λ o₁ o₂ : option α, ∃ b ∈ o₁, ∀ a ∈ o₂, b < a⟩
9541013

955-
@[simp] lemma some_lt_some : @has_lt.lt (with_top α) _ (some a) (some b) ↔ a < b := by simp [(<)]
956-
@[simp, norm_cast] lemma coe_lt_coe : (a : with_top α) < b ↔ a < b := some_lt_some
1014+
lemma to_dual_lt_iff {a : with_top α} {b : with_bot αᵒᵈ} :
1015+
with_top.to_dual a < b ↔ with_bot.of_dual b < a := iff.rfl
1016+
lemma lt_to_dual_iff {a : with_bot αᵒᵈ} {b : with_top α} :
1017+
a < with_top.to_dual b ↔ b < with_bot.of_dual a := iff.rfl
1018+
@[simp] lemma to_dual_lt_to_dual_iff {a b : with_top α} :
1019+
with_top.to_dual a < with_top.to_dual b ↔ b < a := iff.rfl
9571020

958-
@[simp] lemma some_lt_none (a : α) : @has_lt.lt (with_top α) _ (some a) none :=
959-
⟨a, rfl, λ b hb, (option.not_mem_none _ hb).elim⟩
960-
lemma coe_lt_top (a : α) : (a : with_top α) < ⊤ := some_lt_none a
1021+
lemma of_dual_lt_iff {a : with_top αᵒᵈ} {b : with_bot α} :
1022+
with_top.of_dual a < b ↔ with_bot.to_dual b < a := iff.rfl
1023+
lemma lt_of_dual_iff {a : with_bot α} {b : with_top αᵒᵈ} :
1024+
a < with_top.of_dual b ↔ b < with_bot.to_dual a := iff.rfl
1025+
@[simp] lemma of_dual_lt_of_dual_iff {a b : with_top αᵒᵈ} :
1026+
with_top.of_dual a < with_top.of_dual b ↔ b < a := iff.rfl
1027+
1028+
end has_lt
1029+
1030+
end with_top
1031+
1032+
namespace with_bot
1033+
1034+
@[simp] lemma to_dual_symm_apply (a : with_top αᵒᵈ) : with_bot.to_dual.symm a = a.of_dual := rfl
1035+
@[simp] lemma of_dual_symm_apply (a : with_top α) : with_bot.of_dual.symm a = a.to_dual := rfl
1036+
1037+
@[simp] lemma to_dual_apply_bot : with_bot.to_dual (⊥ : with_bot α) = ⊤ := rfl
1038+
@[simp] lemma of_dual_apply_bot : with_bot.of_dual (⊥ : with_bot α) = ⊤ := rfl
1039+
@[simp] lemma to_dual_apply_coe (a : α) : with_bot.to_dual (a : with_bot α) = to_dual a := rfl
1040+
@[simp] lemma of_dual_apply_coe (a : αᵒᵈ) : with_bot.of_dual (a : with_bot αᵒᵈ) = of_dual a := rfl
1041+
1042+
lemma map_to_dual (f : αᵒᵈ → βᵒᵈ) (a : with_top α) :
1043+
with_bot.map f (with_top.to_dual a) = a.map (to_dual ∘ f) := rfl
1044+
lemma map_of_dual (f : α → β) (a : with_top αᵒᵈ) :
1045+
with_bot.map f (with_top.of_dual a) = a.map (of_dual ∘ f) := rfl
1046+
lemma to_dual_map (f : α → β) (a : with_bot α) :
1047+
with_bot.to_dual (with_bot.map f a) = map (to_dual ∘ f ∘ of_dual) a.to_dual := rfl
1048+
lemma of_dual_map (f : αᵒᵈ → βᵒᵈ) (a : with_bot αᵒᵈ) :
1049+
with_bot.of_dual (with_bot.map f a) = map (of_dual ∘ f ∘ to_dual) a.of_dual := rfl
1050+
1051+
section has_le
1052+
1053+
variables [has_le α] {a b : α}
1054+
1055+
lemma to_dual_le_iff {a : with_bot α} {b : with_top αᵒᵈ} :
1056+
with_bot.to_dual a ≤ b ↔ with_top.of_dual b ≤ a := iff.rfl
1057+
lemma le_to_dual_iff {a : with_top αᵒᵈ} {b : with_bot α} :
1058+
a ≤ with_bot.to_dual b ↔ b ≤ with_top.of_dual a := iff.rfl
1059+
@[simp] lemma to_dual_le_to_dual_iff {a b : with_bot α} :
1060+
with_bot.to_dual a ≤ with_bot.to_dual b ↔ b ≤ a := iff.rfl
1061+
1062+
lemma of_dual_le_iff {a : with_bot αᵒᵈ} {b : with_top α} :
1063+
with_bot.of_dual a ≤ b ↔ with_top.to_dual b ≤ a := iff.rfl
1064+
lemma le_of_dual_iff {a : with_top α} {b : with_bot αᵒᵈ} :
1065+
a ≤ with_bot.of_dual b ↔ b ≤ with_top.to_dual a := iff.rfl
1066+
@[simp] lemma of_dual_le_of_dual_iff {a b : with_bot αᵒᵈ} :
1067+
with_bot.of_dual a ≤ with_bot.of_dual b ↔ b ≤ a := iff.rfl
1068+
1069+
end has_le
1070+
1071+
section has_lt
1072+
1073+
variables [has_lt α] {a b : α}
1074+
1075+
lemma to_dual_lt_iff {a : with_bot α} {b : with_top αᵒᵈ} :
1076+
with_bot.to_dual a < b ↔ with_top.of_dual b < a := iff.rfl
1077+
lemma lt_to_dual_iff {a : with_top αᵒᵈ} {b : with_bot α} :
1078+
a < with_bot.to_dual b ↔ b < with_top.of_dual a := iff.rfl
1079+
@[simp] lemma to_dual_lt_to_dual_iff {a b : with_bot α} :
1080+
with_bot.to_dual a < with_bot.to_dual b ↔ b < a := iff.rfl
1081+
1082+
lemma of_dual_lt_iff {a : with_bot αᵒᵈ} {b : with_top α} :
1083+
with_bot.of_dual a < b ↔ with_top.to_dual b < a := iff.rfl
1084+
lemma lt_of_dual_iff {a : with_top α} {b : with_bot αᵒᵈ} :
1085+
a < with_bot.of_dual b ↔ b < with_top.to_dual a := iff.rfl
1086+
@[simp] lemma of_dual_lt_of_dual_iff {a b : with_bot αᵒᵈ} :
1087+
with_bot.of_dual a < with_bot.of_dual b ↔ b < a := iff.rfl
1088+
1089+
end has_lt
1090+
1091+
end with_bot
1092+
1093+
namespace with_top
1094+
1095+
section has_lt
1096+
variables [has_lt α] {a b : α}
1097+
1098+
@[simp, norm_cast] lemma coe_lt_coe : (a : with_top α) < b ↔ a < b :=
1099+
by simp only [←to_dual_lt_to_dual_iff, to_dual_apply_coe, with_bot.coe_lt_coe, to_dual_lt_to_dual]
1100+
@[simp] lemma some_lt_some : @has_lt.lt (with_top α) _ (some a) (some b) ↔ a < b := coe_lt_coe
1101+
1102+
lemma coe_lt_top (a : α) : (a : with_top α) < ⊤ :=
1103+
by simpa [←to_dual_lt_to_dual_iff] using with_bot.bot_lt_coe _
1104+
@[simp] lemma some_lt_none (a : α) : @has_lt.lt (with_top α) _ (some a) none := coe_lt_top a
9611105

9621106
@[simp] lemma not_none_lt (a : with_top α) : ¬ @has_lt.lt (with_top α) _ none a :=
963-
λ ⟨_, h, _⟩, option.not_mem_none _ h
1107+
begin
1108+
rw [←to_dual_lt_to_dual_iff],
1109+
exact with_bot.not_lt_none _
1110+
end
9641111

965-
lemma lt_iff_exists_coe : ∀ {a b : with_top α}, a < b ↔ ∃ p : α, a = p ∧ ↑p < b
966-
| (some a) b := by simp [some_eq_coe, coe_eq_coe]
967-
| none b := iff_of_false (not_none_lt _) $ by simp [none_eq_top]
1112+
lemma lt_iff_exists_coe {a b : with_top α} : a < b ↔ ∃ p : α, a = p ∧ ↑p < b :=
1113+
begin
1114+
rw [←to_dual_lt_to_dual_iff, with_bot.lt_iff_exists_coe, order_dual.exists],
1115+
exact exists_congr (λ _, and_congr_left' iff.rfl)
1116+
end
9681117

969-
lemma coe_lt_iff : ∀ {x : with_top α}, ↑a < x ↔ ∀ b, x = ↑b → a < b
970-
| (some b) := by simp [some_eq_coe, coe_eq_coe, coe_lt_coe]
971-
| none := by simp [none_eq_top, coe_lt_top]
1118+
lemma coe_lt_iff {x : with_top α} : ↑a < x ↔ ∀ b, x = ↑b → a < b :=
1119+
begin
1120+
simp only [←to_dual_lt_to_dual_iff, with_bot.lt_coe_iff, to_dual_apply_coe, order_dual.forall,
1121+
to_dual_lt_to_dual],
1122+
exact forall₂_congr (λ _ _, iff.rfl)
1123+
end
9721124

9731125
end has_lt
9741126

9751127
instance [preorder α] : preorder (with_top α) :=
9761128
{ le := (≤),
9771129
lt := (<),
978-
lt_iff_le_not_le := by { intros, cases a; cases b; simp [lt_iff_le_not_le]; simp [(<), (≤)] },
979-
le_refl := λ o a ha, ⟨a, ha, le_rfl⟩,
980-
le_trans := λ o₁ o₂ o₃ h₁ h₂ c hc,
981-
let ⟨b, hb, bc⟩ := h₂ c hc, ⟨a, ha, ab⟩ := h₁ b hb in
982-
⟨a, ha, le_trans ab bc⟩ }
1130+
lt_iff_le_not_le := by simp [←to_dual_lt_to_dual_iff, lt_iff_le_not_le],
1131+
le_refl := λ _, to_dual_le_to_dual_iff.mp le_rfl,
1132+
le_trans := λ _ _ _, by { simp_rw [←to_dual_le_to_dual_iff], exact function.swap le_trans } }
9831133

9841134
instance [partial_order α] : partial_order (with_top α) :=
985-
{ le_antisymm := λ o₁ o₂ h₁ h₂, begin
986-
cases o₂ with b,
987-
{ cases o₁ with a, {refl},
988-
rcases h₂ a rfl with ⟨_, ⟨⟩, _⟩ },
989-
{ rcases h₁ b rfl with ⟨a, ⟨⟩, h₁'⟩,
990-
rcases h₂ a rfl with ⟨_, ⟨⟩, h₂'⟩,
991-
rw le_antisymm h₁' h₂' }
992-
end,
1135+
{ le_antisymm := λ _ _, by { simp_rw [←to_dual_le_to_dual_iff], exact function.swap le_antisymm },
9931136
.. with_top.preorder }
9941137

9951138
lemma map_le_iff [preorder α] [preorder β] (f : α → β)
9961139
(a b : with_top α) (mono_iff : ∀ {a b}, f a ≤ f b ↔ a ≤ b) :
9971140
a.map f ≤ b.map f ↔ a ≤ b :=
998-
@with_bot.map_le_iff αᵒᵈ βᵒᵈ _ _ f (λ a b, mono_iff) b a
1141+
begin
1142+
rw [←to_dual_le_to_dual_iff, to_dual_map, to_dual_map, with_bot.map_le_iff,
1143+
to_dual_le_to_dual_iff],
1144+
simp [mono_iff]
1145+
end
9991146

10001147
instance [semilattice_inf α] : semilattice_inf (with_top α) :=
10011148
{ inf := option.lift_or_get (⊓),
@@ -1039,13 +1186,13 @@ instance [lattice α] : lattice (with_top α) :=
10391186
{ ..with_top.semilattice_sup, ..with_top.semilattice_inf }
10401187

10411188
instance decidable_le [has_le α] [@decidable_rel α (≤)] : @decidable_rel (with_top α) (≤) :=
1042-
λ x y, @with_bot.decidable_le αᵒᵈ _ _ y x
1189+
λ _ _, decidable_of_decidable_of_iff (with_bot.decidable_le _ _) (to_dual_le_to_dual_iff)
10431190

10441191
instance decidable_lt [has_lt α] [@decidable_rel α (<)] : @decidable_rel (with_top α) (<) :=
1045-
λ x y, @with_bot.decidable_lt αᵒᵈ _ _ y x
1192+
λ _ _, decidable_of_decidable_of_iff (with_bot.decidable_lt _ _) (to_dual_lt_to_dual_iff)
10461193

10471194
instance is_total_le [has_le α] [is_total α (≤)] : is_total (with_top α) (≤) :=
1048-
@order_dual.is_total_le (with_bot αᵒᵈ) _ _
1195+
⟨λ _ _, by { simp_rw ←to_dual_le_to_dual_iff, exact total_of _ _ _ }⟩
10491196

10501197
instance [linear_order α] : linear_order (with_top α) := lattice.to_linear_order _
10511198

@@ -1066,11 +1213,25 @@ have acc_some : ∀ a : α, acc ((<) : with_top α → with_top α → Prop) (so
10661213
(λ _ _, acc_some _))) acc_some⟩
10671214

10681215
lemma well_founded_gt [preorder α] (h : @well_founded α (>)) : @well_founded (with_top α) (>) :=
1069-
@with_bot.well_founded_lt αᵒᵈ _ h
1216+
⟨λ a, begin
1217+
-- ideally, use rel_hom_class.acc, but that is defined later
1218+
have : acc (<) a.to_dual := well_founded.apply (with_bot.well_founded_lt h) _,
1219+
revert this,
1220+
generalize ha : a.to_dual = b, intro ac,
1221+
induction ac with _ H IH generalizing a, subst ha,
1222+
exact ⟨_, λ a' h, IH (a'.to_dual) (to_dual_lt_to_dual.mpr h) _ rfl⟩
1223+
end
10701224

10711225
lemma _root_.with_bot.well_founded_gt [preorder α] (h : @well_founded α (>)) :
10721226
@well_founded (with_bot α) (>) :=
1073-
@with_top.well_founded_lt αᵒᵈ _ h
1227+
⟨λ a, begin
1228+
-- ideally, use rel_hom_class.acc, but that is defined later
1229+
have : acc (<) a.to_dual := well_founded.apply (with_top.well_founded_lt h) _,
1230+
revert this,
1231+
generalize ha : a.to_dual = b, intro ac,
1232+
induction ac with _ H IH generalizing a, subst ha,
1233+
exact ⟨_, λ a' h, IH (a'.to_dual) (to_dual_lt_to_dual.mpr h) _ rfl⟩
1234+
end
10741235

10751236
instance trichotomous.lt [preorder α] [is_trichotomous α (<)] : is_trichotomous (with_top α) (<) :=
10761237
begin

src/order/hom/basic.lean

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -836,25 +836,44 @@ by { rw [codisjoint, ←f.map_sup, ←f.map_top], exact f.monotone ha }
836836

837837
namespace with_bot
838838

839-
/-- Taking the dual then adding `⊥` is the same as adding `⊤` then taking the dual. -/
840-
protected def to_dual_top [has_le α] : with_bot αᵒᵈ ≃o (with_top α)ᵒᵈ := order_iso.refl _
839+
/-- Taking the dual then adding `⊥` is the same as adding `⊤` then taking the dual.
840+
This is the order iso form of `with_bot.of_dual`, as proven by `coe_to_dual_top_equiv_eq`.
841+
-/
842+
protected def to_dual_top_equiv [has_le α] : with_bot αᵒᵈ ≃o (with_top α)ᵒᵈ := order_iso.refl _
843+
844+
@[simp] lemma to_dual_top_equiv_coe [has_le α] (a : α) :
845+
with_bot.to_dual_top_equiv ↑(to_dual a) = to_dual (a : with_top α) := rfl
846+
@[simp] lemma to_dual_top_equiv_symm_coe [has_le α] (a : α) :
847+
with_bot.to_dual_top_equiv.symm (to_dual (a : with_top α)) = ↑(to_dual a) := rfl
848+
@[simp] lemma to_dual_top_equiv_bot [has_le α] :
849+
with_bot.to_dual_top_equiv (⊥ : with_bot αᵒᵈ) = ⊥ := rfl
850+
@[simp] lemma to_dual_top_equiv_symm_bot [has_le α] :
851+
with_bot.to_dual_top_equiv.symm (⊥ : (with_top α)ᵒᵈ) = ⊥ := rfl
841852

842-
@[simp] lemma to_dual_top_coe [has_le α] (a : α) :
843-
with_bot.to_dual_top ↑(to_dual a) = to_dual (a : with_top α) := rfl
844-
@[simp] lemma to_dual_top_symm_coe [has_le α] (a : α) :
845-
with_bot.to_dual_top.symm (to_dual (a : with_top α)) = ↑(to_dual a) := rfl
853+
lemma coe_to_dual_top_equiv_eq [has_le α] :
854+
(with_bot.to_dual_top_equiv : with_bot αᵒᵈ → (with_top α)ᵒᵈ) = to_dual ∘ with_bot.of_dual :=
855+
funext $ λ _, rfl
846856

847857
end with_bot
848858

849859
namespace with_top
850860

851-
/-- Taking the dual then adding `⊤` is the same as adding `⊥` then taking the dual. -/
852-
protected def to_dual_bot [has_le α] : with_top αᵒᵈ ≃o (with_bot α)ᵒᵈ := order_iso.refl _
853-
854-
@[simp] lemma to_dual_bot_coe [has_le α] (a : α) :
855-
with_top.to_dual_bot ↑(to_dual a) = to_dual (a : with_bot α) := rfl
856-
@[simp] lemma to_dual_bot_symm_coe [has_le α] (a : α) :
857-
with_top.to_dual_bot.symm (to_dual (a : with_bot α)) = ↑(to_dual a) := rfl
861+
/-- Taking the dual then adding `⊤` is the same as adding `⊥` then taking the dual.
862+
This is the order iso form of `with_top.of_dual`, as proven by `coe_to_dual_bot_equiv_eq`. -/
863+
protected def to_dual_bot_equiv [has_le α] : with_top αᵒᵈ ≃o (with_bot α)ᵒᵈ := order_iso.refl _
864+
865+
@[simp] lemma to_dual_bot_equiv_coe [has_le α] (a : α) :
866+
with_top.to_dual_bot_equiv ↑(to_dual a) = to_dual (a : with_bot α) := rfl
867+
@[simp] lemma to_dual_bot_equiv_symm_coe [has_le α] (a : α) :
868+
with_top.to_dual_bot_equiv.symm (to_dual (a : with_bot α)) = ↑(to_dual a) := rfl
869+
@[simp] lemma to_dual_bot_equiv_top [has_le α] :
870+
with_top.to_dual_bot_equiv (⊤ : with_top αᵒᵈ) = ⊤ := rfl
871+
@[simp] lemma to_dual_bot_equiv_symm_top [has_le α] :
872+
with_top.to_dual_bot_equiv.symm (⊤ : (with_bot α)ᵒᵈ) = ⊤ := rfl
873+
874+
lemma coe_to_dual_bot_equiv_eq [has_le α] :
875+
(with_top.to_dual_bot_equiv : with_top αᵒᵈ → (with_bot α)ᵒᵈ) = to_dual ∘ with_top.of_dual :=
876+
funext $ λ _, rfl
858877

859878
end with_top
860879

0 commit comments

Comments
 (0)