Typeclass for a type A
with an injective map to set B
#
This typeclass is primarily for use by subobjects like submonoid
and submodule
.
A typical subobject should be declared as:
structure my_subobject (X : Type*) :=
(carrier : set X)
(op_mem : ∀ {x : X}, x ∈ carrier → sorry ∈ carrier)
namespace my_subobject
variables (X : Type*)
instance : set_like (my_subobject X) X :=
⟨sub_mul_action.carrier, λ p q h, by cases p; cases q; congr'⟩
@[simp] lemma mem_carrier {p : my_subobject X} : x ∈ p.carrier ↔ x ∈ (p : set X) := iff.rfl
@[ext] theorem ext {p q : my_subobject X} (h : ∀ x, x ∈ p ↔ x ∈ q) : p = q := set_like.ext h
/-- Copy of a `my_subobject` with a new `carrier` equal to the old one. Useful to fix definitional
equalities. -/
protected def copy (p : my_subobject X) (s : set X) (hs : s = ↑p) : my_subobject X :=
{ carrier := s,
op_mem' := hs.symm ▸ p.op_mem' }
end my_subobject
This file will then provide a coe_sort
, a coe
to set, a partial_order
, and various
extensionality and simp lemmas.
@[class]
- coe : A → set B
- coe_injective' : function.injective set_like.coe
A class to indicate that there is a canonical injection between A
and set B
.
@[protected, instance]
Equations
@[protected, instance]
@[protected, nolint, instance]
@[protected, nolint, instance]
Equations
- set_like.partial_order = {le := λ (H K : A), ∀ ⦃x : B⦄, x ∈ H → x ∈ K, lt := partial_order.lt (partial_order.lift coe set_like.coe_injective), le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _}