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] - feat(algebra/pointwise): introduce canonically_ordered_comm_semiring on set_semiring ... #11580

Closed
wants to merge 36 commits into from
Closed
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5eaf319
derive partial_order and additive
Jan 20, 2022
4dee667
more add instances
Jan 20, 2022
fe0c0e8
doc-string
Jan 20, 2022
ebb604c
remove erroneous file
Jan 20, 2022
7b4aac0
Johan's permissions fix
Jan 20, 2022
eb1c184
more
Jan 20, 2022
1fb1c29
y.ml
Jan 20, 2022
c61e9a0
-v sh
Jan 20, 2022
41ea14d
+ py
Jan 20, 2022
90718b1
fix mode
ericrbg Jan 20, 2022
a1f9be8
remove to_additive
Jan 20, 2022
f1e2156
instances on set_semiring
Jan 21, 2022
9360e5d
reduce assumptions
Jan 21, 2022
9435b89
brace to please the linter
Jan 21, 2022
b328d46
Update src/algebra/pointwise.lean
adomani Jan 21, 2022
a709ee2
Add rfl lemmas
eric-wieser Jan 21, 2022
1ff1916
Update src/algebra/pointwise.lean
eric-wieser Jan 21, 2022
381c226
use explicit instances, instead of derive
adomani Jan 23, 2022
dd130e2
remove brackets
adomani Jan 23, 2022
d2b6aca
fix
adomani Jan 23, 2022
aee0541
derive and no simp
adomani Jan 23, 2022
70c34bc
Merge branch 'adomani_set_semiring' into adomani_set_semiring_can
adomani Jan 23, 2022
8550314
Merge branch 'master' into adomani_set_semiring_can
adomani Jan 23, 2022
dd6ced6
left/right
adomani Jan 23, 2022
665ac1d
remove covt_cl (set_semiring α) _ (swap (+)) (≤)
adomani Jan 24, 2022
9eb2f53
doc-string fix
adomani Jan 24, 2022
b14ad11
Merge branch 'master' into adomani_set_semiring_can
adomani Jan 25, 2022
3647e08
typo
adomani Jan 25, 2022
61e599b
Apply suggestions from code review
adomani Jan 28, 2022
506f91d
fixes
adomani Jan 28, 2022
499db13
Merge branch 'master' into adomani_set_semiring_can
adomani Jan 28, 2022
ece7e7d
add a space
adomani Jan 28, 2022
cb1b868
one more golf
adomani Jan 28, 2022
824ed90
Apply suggestions from code review
adomani Jan 28, 2022
c992577
yaël's suggestions
adomani Jan 28, 2022
cf59f08
Merge branch 'adomani_set_semiring_can' of ssh://github.com/leanprove…
adomani Jan 28, 2022
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
35 changes: 34 additions & 1 deletion src/algebra/pointwise.lean
Expand Up @@ -880,9 +880,27 @@ by { simp only [← image2_mul, image_image2, image2_image_left, image2_image_ri
lemma preimage_mul_preimage_subset {s t : set β} : m ⁻¹' s * m ⁻¹' t ⊆ m ⁻¹' (s * t) :=
by { rintros _ ⟨_, _, _, _, rfl⟩, exact ⟨_, _, ‹_›, ‹_›, (m.map_mul _ _).symm ⟩ }

instance set_semiring.no_zero_divisors : no_zero_divisors (set_semiring α) :=
⟨λ a b ab, a.eq_empty_or_nonempty.imp_right $ λ ha, b.eq_empty_or_nonempty.resolve_right $
λ hb, nonempty.ne_empty ⟨_, mul_mem_mul ha.some_mem hb.some_mem⟩ ab⟩

/- Since addition on `set_semiring` is commutative (it is set union), there is no need
to also have the instance `covariant_class (set_semiring α) (set_semiring α) (swap (+)) (≤)`. -/
instance set_semiring.covariant_class_add :
covariant_class (set_semiring α) (set_semiring α) (+) (≤) :=
{ elim := λ a b c, union_subset_union_right _ }

instance set_semiring.covariant_class_mul_left :
covariant_class (set_semiring α) (set_semiring α) (*) (≤) :=
{ elim := λ a b c, mul_subset_mul_left }

instance set_semiring.covariant_class_mul_right :
covariant_class (set_semiring α) (set_semiring α) (swap (*)) (≤) :=
{ elim := λ a b c, mul_subset_mul_right }

end mul_hom

/-- The image of a set under function is a ring homomorphism
/-- The image of a set under a multiplicative homomorphism is a ring homomorphism
with respect to the pointwise operations on sets. -/
def image_hom [monoid α] [monoid β] (f : α →* β) : set_semiring α →+* set_semiring β :=
{ to_fun := image f,
Expand All @@ -893,6 +911,21 @@ def image_hom [monoid α] [monoid β] (f : α →* β) : set_semiring α →+* s

end monoid

section comm_monoid

variable [comm_monoid α]

instance : canonically_ordered_comm_semiring (set_semiring α) :=
{ add_le_add_left := λ a b, add_le_add_left,
le_iff_exists_add := λ a b, ⟨λ ab, ⟨b, (union_eq_right_iff_subset.2 ab).symm⟩,
by { rintro ⟨c, rfl⟩, exact subset_union_left _ _ }⟩,
..(infer_instance : comm_semiring (set_semiring α)),
..(infer_instance : partial_order (set_semiring α)),
..(infer_instance : order_bot (set_semiring α)),
..(infer_instance : no_zero_divisors (set_semiring α)) }

end comm_monoid

end set

open set
Expand Down