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

Commit 2bdadb4

Browse files
committed
feat(order/imp): define lattice.imp and lattice.biimp (#10327)
1 parent 0a2a922 commit 2bdadb4

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

src/order/boolean_algebra.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ lemma sdiff_le_iff : y \ x ≤ z ↔ y ≤ x ⊔ z :=
365365
... ≤ (x ⊔ z) ⊔ x : sup_le_sup_right h x
366366
... ≤ z ⊔ x : by rw [sup_assoc, sup_comm, sup_assoc, sup_idem])⟩
367367

368-
lemma sdiff_eq_bot_iff : y \ x = ⊥ ↔ y ≤ x :=
368+
@[simp] lemma sdiff_eq_bot_iff : y \ x = ⊥ ↔ y ≤ x :=
369369
by rw [←le_bot_iff, sdiff_le_iff, sup_bot_eq]
370370

371371
lemma sdiff_le_comm : x \ y ≤ z ↔ x \ z ≤ y :=

src/order/imp.lean

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/-
2+
Copyright (c) 2021 Floris van Doorn. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Floris van Doorn, Yury Kudryashov
5+
-/
6+
import order.symm_diff
7+
import tactic.monotonicity.basic
8+
9+
/-!
10+
# Implication and equivalence as operations on a boolean algebra
11+
12+
In this file we define `lattice.imp` (notation: `a ⇒ₒ b`) and `lattice.biimp` (notation: `a ⇔ₒ b`)
13+
to be the implication and equivalence as operations on a boolean algebra. More precisely, we put
14+
`a ⇒ₒ b = aᶜ ⊔ b` and `a ⇔ₒ b = (a ⇒ₒ b) ⊓ (b ⇒ₒ a)`. Equivalently, `a ⇒ₒ b = (a \ b)ᶜ` and
15+
`a ⇔ₒ b = (a Δ b)ᶜ`. For propositions these operations are equal to the usual implication and `iff`.
16+
-/
17+
18+
variables {α β : Type*}
19+
20+
namespace lattice
21+
22+
/-- Implication as a binary operation on a boolean algebra. -/
23+
def imp [has_compl α] [has_sup α] (a b : α) : α := aᶜ ⊔ b
24+
25+
infix ` ⇒ₒ `:65 := lattice.imp
26+
27+
/-- Equivalence as a binary operation on a boolean algebra. -/
28+
def biimp [has_compl α] [has_sup α] [has_inf α] (a b : α) : α := (a ⇒ₒ b) ⊓ (b ⇒ₒ a)
29+
30+
infix ` ⇔ₒ `:60 := lattice.biimp
31+
32+
@[simp] lemma imp_eq_arrow (p q : Prop) : p ⇒ₒ q = (p → q) := propext imp_iff_not_or.symm
33+
34+
@[simp] lemma biimp_eq_iff (p q : Prop) : p ⇔ₒ q = (p ↔ q) := by simp [biimp, ← iff_def]
35+
36+
variables [boolean_algebra α] {a b c d : α}
37+
38+
@[simp] lemma compl_imp (a b : α) : (a ⇒ₒ b)ᶜ = a \ b := by simp [imp, sdiff_eq]
39+
40+
lemma compl_sdiff (a b : α) : (a \ b)ᶜ = a ⇒ₒ b := by rw [← compl_imp, compl_compl]
41+
42+
@[mono] lemma imp_mono (h₁ : a ≤ b) (h₂ : c ≤ d) : b ⇒ₒ c ≤ a ⇒ₒ d :=
43+
sup_le_sup (compl_le_compl h₁) h₂
44+
45+
lemma inf_imp_eq (a b c : α) : a ⊓ (b ⇒ₒ c) = (a ⇒ₒ b) ⇒ₒ (a ⊓ c) :=
46+
by unfold imp; simp [inf_sup_left]
47+
48+
@[simp] lemma imp_eq_top_iff : (a ⇒ₒ b = ⊤) ↔ a ≤ b :=
49+
by rw [← compl_sdiff, compl_eq_top, sdiff_eq_bot_iff]
50+
51+
@[simp] lemma imp_eq_bot_iff : (a ⇒ₒ b = ⊥) ↔ (a = ⊤ ∧ b = ⊥) := by simp [imp]
52+
53+
@[simp] lemma imp_bot (a : α) : a ⇒ₒ ⊥ = aᶜ := sup_bot_eq
54+
55+
@[simp] lemma top_imp (a : α) : ⊤ ⇒ₒ a = a := by simp [imp]
56+
57+
@[simp] lemma bot_imp (a : α) : ⊥ ⇒ₒ a = ⊤ := imp_eq_top_iff.2 bot_le
58+
59+
@[simp] lemma imp_top (a : α) : a ⇒ₒ ⊤ = ⊤ := imp_eq_top_iff.2 le_top
60+
61+
@[simp] lemma imp_self (a : α) : a ⇒ₒ a = ⊤ := compl_sup_eq_top
62+
63+
@[simp] lemma compl_imp_compl (a b : α) : aᶜ ⇒ₒ bᶜ = b ⇒ₒ a := by simp [imp, sup_comm]
64+
65+
lemma imp_inf_le {α : Type*} [boolean_algebra α] (a b : α) : (a ⇒ₒ b) ⊓ a ≤ b :=
66+
by { unfold imp, rw [inf_sup_right], simp }
67+
68+
lemma inf_imp_eq_imp_imp (a b c : α) : ((a ⊓ b) ⇒ₒ c) = (a ⇒ₒ (b ⇒ₒ c)) := by simp [imp, sup_assoc]
69+
70+
lemma le_imp_iff : a ≤ (b ⇒ₒ c) ↔ a ⊓ b ≤ c :=
71+
by rw [imp, sup_comm, is_compl_compl.le_sup_right_iff_inf_left_le]
72+
73+
lemma biimp_mp (a b : α) : (a ⇔ₒ b) ≤ (a ⇒ₒ b) := inf_le_left
74+
75+
lemma biimp_mpr (a b : α) : (a ⇔ₒ b) ≤ (b ⇒ₒ a) := inf_le_right
76+
77+
lemma biimp_comm (a b : α) : (a ⇔ₒ b) = (b ⇔ₒ a) :=
78+
by {unfold lattice.biimp, rw inf_comm}
79+
80+
@[simp] lemma biimp_eq_top_iff : a ⇔ₒ b = ⊤ ↔ a = b :=
81+
by simp [biimp, ← le_antisymm_iff]
82+
83+
@[simp] lemma biimp_self (a : α) : a ⇔ₒ a = ⊤ := biimp_eq_top_iff.2 rfl
84+
85+
lemma biimp_symm : a ≤ (b ⇔ₒ c) ↔ a ≤ (c ⇔ₒ b) := by rw biimp_comm
86+
87+
lemma compl_symm_diff (a b : α) : (a Δ b)ᶜ = a ⇔ₒ b :=
88+
by simp only [biimp, imp, symm_diff, sdiff_eq, compl_sup, compl_inf, compl_compl]
89+
90+
lemma compl_biimp (a b : α) : (a ⇔ₒ b)ᶜ = a Δ b := by rw [← compl_symm_diff, compl_compl]
91+
92+
@[simp] lemma compl_biimp_compl : aᶜ ⇔ₒ bᶜ = a ⇔ₒ b := by simp [biimp, inf_comm]
93+
94+
end lattice

src/order/lattice.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ end
451451
-/
452452

453453
/-- A lattice is a join-semilattice which is also a meet-semilattice. -/
454-
class lattice (α : Type u) extends semilattice_sup α, semilattice_inf α
454+
@[protect_proj] class lattice (α : Type u) extends semilattice_sup α, semilattice_inf α
455455

456456
instance (α) [lattice α] : lattice (order_dual α) :=
457457
{ .. order_dual.semilattice_sup α, .. order_dual.semilattice_inf α }

0 commit comments

Comments
 (0)