Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - chore(order/basic): add monotone.order_dual, strict_mono.order_dual #2778

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 1 addition & 19 deletions scripts/nolints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1999,25 +1999,7 @@ apply_nolint pell.xz doc_blame
apply_nolint pell.yz doc_blame

-- order/basic.lean
apply_nolint classical.DLO doc_blame
urkud marked this conversation as resolved.
Show resolved Hide resolved
apply_nolint decidable_linear_order_of_is_well_order doc_blame
apply_nolint dense_or_discrete ge_or_gt
apply_nolint directed_order doc_blame
apply_nolint ge.is_antisymm ge_or_gt
apply_nolint ge.is_linear_order ge_or_gt
apply_nolint ge.is_partial_order ge_or_gt
apply_nolint ge.is_preorder ge_or_gt
apply_nolint ge.is_refl ge_or_gt
apply_nolint ge.is_total ge_or_gt
apply_nolint ge.is_total_preorder ge_or_gt
apply_nolint ge.is_trans ge_or_gt
apply_nolint ge_of_eq ge_or_gt
apply_nolint gt.is_antisymm ge_or_gt
apply_nolint gt.is_asymm ge_or_gt
apply_nolint gt.is_irrefl ge_or_gt
apply_nolint gt.is_strict_order ge_or_gt
apply_nolint gt.is_trans ge_or_gt
apply_nolint gt.is_trichotomous ge_or_gt
apply_nolint well_founded.succ doc_blame
apply_nolint well_founded.sup doc_blame

Expand Down Expand Up @@ -3112,4 +3094,4 @@ apply_nolint uniform_space.separation_setoid doc_blame

-- topology/uniform_space/uniform_embedding.lean
apply_nolint uniform_embedding doc_blame
apply_nolint uniform_inducing doc_blame
apply_nolint uniform_inducing doc_blame
19 changes: 19 additions & 0 deletions src/order/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,48 @@ lemma antisymm_of_asymm (r) [is_asymm α r] : is_antisymm α r :=

/- Convert algebraic structure style to explicit relation style typeclasses -/
instance [preorder α] : is_refl α (≤) := ⟨le_refl⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_refl α (≥) := is_refl.swap _
instance [preorder α] : is_trans α (≤) := ⟨@le_trans _ _⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_trans α (≥) := is_trans.swap _
instance [preorder α] : is_preorder α (≤) := {}
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_preorder α (≥) := {}
instance [preorder α] : is_irrefl α (<) := ⟨lt_irrefl⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_irrefl α (>) := is_irrefl.swap _
instance [preorder α] : is_trans α (<) := ⟨@lt_trans _ _⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_trans α (>) := is_trans.swap _
instance [preorder α] : is_asymm α (<) := ⟨@lt_asymm _ _⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_asymm α (>) := is_asymm.swap _
instance [preorder α] : is_antisymm α (<) := antisymm_of_asymm _
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_antisymm α (>) := antisymm_of_asymm _
instance [preorder α] : is_strict_order α (<) := {}
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [preorder α] : is_strict_order α (>) := {}
instance preorder.is_total_preorder [preorder α] [is_total α (≤)] : is_total_preorder α (≤) := {}
instance [partial_order α] : is_antisymm α (≤) := ⟨@le_antisymm _ _⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [partial_order α] : is_antisymm α (≥) := is_antisymm.swap _
instance [partial_order α] : is_partial_order α (≤) := {}
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [partial_order α] : is_partial_order α (≥) := {}
instance [linear_order α] : is_total α (≤) := ⟨le_total⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [linear_order α] : is_total α (≥) := is_total.swap _
instance linear_order.is_total_preorder [linear_order α] : is_total_preorder α (≤) :=
by apply_instance
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [linear_order α] : is_total_preorder α (≥) := {}
instance [linear_order α] : is_linear_order α (≤) := {}
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [linear_order α] : is_linear_order α (≥) := {}
instance [linear_order α] : is_trichotomous α (<) := ⟨lt_trichotomy⟩
@[nolint ge_or_gt] -- see Note [nolint_ge]
instance [linear_order α] : is_trichotomous α (>) := is_trichotomous.swap _

theorem preorder.ext {α} {A B : preorder α}
Expand Down Expand Up @@ -445,6 +459,7 @@ lemma eq_of_le_of_forall_ge_of_dense [linear_order α] [densely_ordered α] {a
(h₁ : a₂ ≤ a₁) (h₂ : ∀a₃<a₁, a₂ ≥ a₃) : a₁ = a₂ :=
le_antisymm (le_of_forall_ge_of_dense h₂) h₁

@[nolint ge_or_gt] -- see Note [nolint_ge]
lemma dense_or_discrete [linear_order α] (a₁ a₂ : α) :
(∃a, a₁ < a ∧ a < a₂) ∨ ((∀a>a₁, a ≥ a₂) ∧ (∀a<a₂, a ≤ a₁)) :=
classical.or_iff_not_imp_left.2 $ assume h,
Expand Down Expand Up @@ -518,6 +533,8 @@ by letI LO := linear_order_of_STO' r; exact
{ decidable_le := λ x y, decidable_of_iff (¬ r y x) (@not_lt _ _ y x),
..LO }

/-- Any `linear_order` is a noncomputable `decidable_linear_order`. This is not marked
as an instance to avoid a loop. -/
noncomputable def classical.DLO (α) [LO : linear_order α] : decidable_linear_order α :=
{ decidable_le := classical.dec_rel _, ..LO }

Expand Down Expand Up @@ -753,6 +770,8 @@ theorem directed.mono_comp {ι} {rb : β → β → Prop} {g : α → β} {f :

section prio
set_option default_priority 100 -- see Note [default priority]
/-- A `preorder` is a `directed_order` if for any two elements `i`, `j`
there is an element `k` such that `i ≤ k` and `j ≤ k`. -/
class directed_order (α : Type u) extends preorder α :=
(directed : ∀ i j : α, ∃ k, i ≤ k ∧ j ≤ k)
end prio