Skip to content

Commit

Permalink
chore(order/basic): move Prop.partial_order to order/basic (#15884)
Browse files Browse the repository at this point in the history
This ensures, among other things, that `r ≤ s` is almost always available as notation for subrelations.

We don't move `Prop.linear_order` since doing so means we need to manually prove `or = max_default` and `and = min_default`.
  • Loading branch information
vihdzp committed Aug 8, 2022
1 parent dff563e commit 7fbadc6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
17 changes: 17 additions & 0 deletions src/order/basic.lean
Expand Up @@ -770,6 +770,23 @@ instance : densely_ordered punit := ⟨λ _ _, false.elim⟩

end punit

section prop

/-- Propositions form a complete boolean algebra, where the `≤` relation is given by implication. -/
instance Prop.has_le : has_le Prop := ⟨(→)⟩

@[simp] lemma le_Prop_eq : ((≤) : PropPropProp) = (→) := rfl

lemma subrelation_iff_le {r s : α → α → Prop} : subrelation r s ↔ r ≤ s := iff.rfl

instance Prop.partial_order : partial_order Prop :=
{ le_refl := λ _, id,
le_trans := λ a b c f g, g ∘ f,
le_antisymm := λ a b Hab Hba, propext ⟨Hab, Hba⟩,
..Prop.has_le }

end prop

variables {s : β → β → Prop} {t : γ → γ → Prop}

/-! ### Linear order from a total partial order -/
Expand Down
13 changes: 3 additions & 10 deletions src/order/bounded_order.lean
Expand Up @@ -346,12 +346,7 @@ end

/-- Propositions form a distributive lattice. -/
instance Prop.distrib_lattice : distrib_lattice Prop :=
{ le := λ a b, a → b,
le_refl := λ _, id,
le_trans := λ a b c f g, g ∘ f,
le_antisymm := λ a b Hab Hba, propext ⟨Hab, Hba⟩,

sup := or,
{ sup := or,
le_sup_left := @or.inl,
le_sup_right := @or.inr,
sup_le := λ a b c, or.rec,
Expand All @@ -361,7 +356,8 @@ instance Prop.distrib_lattice : distrib_lattice Prop :=
inf_le_right := @and.right,
le_inf := λ a b c Hab Hac Ha, and.intro (Hab Ha) (Hac Ha),
le_sup_inf := λ a b c H, or_iff_not_imp_left.2 $
λ Ha, ⟨H.1.resolve_left Ha, H.2.resolve_left Ha⟩ }
λ Ha, ⟨H.1.resolve_left Ha, H.2.resolve_left Ha⟩,
..Prop.partial_order }

/-- Propositions form a bounded order. -/
instance Prop.bounded_order : bounded_order Prop :=
Expand All @@ -376,9 +372,6 @@ instance Prop.le_is_total : is_total Prop (≤) :=
noncomputable instance Prop.linear_order : linear_order Prop :=
by classical; exact lattice.to_linear_order Prop

lemma subrelation_iff_le {r s : α → α → Prop} : subrelation r s ↔ r ≤ s := iff.rfl

@[simp] lemma le_Prop_eq : ((≤) : PropPropProp) = (→) := rfl
@[simp] lemma sup_Prop_eq : (⊔) = (∨) := rfl
@[simp] lemma inf_Prop_eq : (⊓) = (∧) := rfl

Expand Down

0 comments on commit 7fbadc6

Please sign in to comment.