Nontrivial types #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
A type is nontrivial if it contains at least two elements. This is useful in particular for rings (where it is equivalent to the fact that zero is different from one) and for vector spaces (where it is equivalent to the fact that the dimension is positive).
We introduce a typeclass nontrivial
formalizing this property.
Predicate typeclass for expressing that a type is not reduced to a single element. In rings,
this is equivalent to 0 ≠ 1
. In vector spaces, this is equivalent to positive dimension.
Instances of this typeclass
- group_with_zero.to_nontrivial
- is_domain.to_nontrivial
- linear_ordered_add_comm_group_with_top.to_nontrivial
- strict_ordered_semiring.to_nontrivial
- strict_ordered_ring.to_nontrivial
- division_ring.to_nontrivial
- infinite.nontrivial
- is_simple_order.to_nontrivial
- euclidean_domain.to_nontrivial
- local_ring.to_nontrivial
- is_simple_group.to_nontrivial
- is_simple_add_group.to_nontrivial
- uniform_space.completion.nontrivial
- sort.nontrivial
- option.nontrivial
- nontrivial_prod_right
- nontrivial_prod_left
- pi.nontrivial
- function.nontrivial
- bool.nontrivial
- order_dual.nontrivial
- additive.nontrivial
- multiplicative.nontrivial
- mul_opposite.nontrivial
- add_opposite.nontrivial
- with_bot.nontrivial
- with_top.nontrivial
- set.nontrivial_of_nonempty
- with_one.nontrivial
- with_zero.nontrivial
- nat.nontrivial
- int.nontrivial
- fin.nontrivial
- finset.nontrivial'
- rat.nontrivial
- sym.nontrivial
- ulift.nontrivial
- associates.nontrivial
- subsemigroup.nontrivial
- add_subsemigroup.nontrivial
- submonoid.nontrivial
- add_submonoid.nontrivial
- subgroup.nontrivial
- add_subgroup.nontrivial
- finsupp.nontrivial
- linear_map.module.End.nontrivial
- submodule.nontrivial
- subsemiring_class.nontrivial
- subsemiring.nontrivial
- subring.nontrivial
- monoid_algebra.nontrivial
- add_monoid_algebra.nontrivial
- polynomial.nontrivial
- ideal.nontrivial
- enat.nontrivial
- cardinal.nontrivial
- polynomial.subalgebra.nontrivial
- fraction_ring.nontrivial
- self_adjoint.nontrivial
- matrix.nontrivial
- ordinal.nontrivial
- free_algebra.nontrivial
- zmod.nontrivial
- zmod.nontrivial'
- filter.nontrivial
- continuous_map.nontrivial
- nonneg.nontrivial
- real.nontrivial
- ennreal.nontrivial
- complex.nontrivial
- ereal.nontrivial
- affine_subspace.nontrivial
- filter.germ.nontrivial
- mv_power_series.nontrivial
- mv_power_series.subalgebra.nontrivial
- power_series.nontrivial
- power_series.subalgebra.nontrivial
- hahn_series.nontrivial
- hahn_series.subalgebra.nontrivial
- ratfunc.nontrivial
- field.direct_limit.nontrivial
- category_theory.End.nontrivial
- category_theory.subobject.nontrivial
- sym2.nontrivial
- quaternion.nontrivial
- mod_p.nontrivial
- fractional_ideal.nontrivial
- homogeneous_localization.at_prime.nontrivial
- ore_localization.nontrivial
- witt_vector.nontrivial
- lie_submodule.nontrivial
- nonempty_interval.nontrivial
- interval.nontrivial
- zsqrtd.nontrivial
- gaussian_int.nontrivial
- lucas_lehmer.X.nontrivial
- sym_alg.nontrivial
- tropical.nontrivial
- simple_graph.nontrivial
- hamming.nontrivial
- algebraic_geometry.LocallyRingedSpace.component_nontrivial
- alternating_group.nontrivial
- dihedral_group.nontrivial
- quaternion_group.nontrivial
- counterexample.int_with_epsilon.nontrivial
See Note [lower instance priority]
Note that since this and nonempty_of_inhabited
are the most "obvious" way to find a nonempty
instance if no direct instance can be found, we give this a higher priority than the usual 100
.
An inhabited type is either nontrivial, or has a unique element.
Equations
- nontrivial_psum_unique α = dite (nontrivial α) (λ (h : nontrivial α), psum.inl h) (λ (h : ¬nontrivial α), psum.inr {to_inhabited := {default := inhabited.default _inst_1}, uniq := _})
A type is either a subsingleton or nontrivial.
Pushforward a nontrivial
instance along an injective function.
Pullback a nontrivial
instance along a surjective function.
An injective function from a nontrivial type has an argument at which it does not take a given value.
A pi type is nontrivial if it's nonempty everywhere and nontrivial somewhere.
As a convenience, provide an instance automatically if (f default)
is nontrivial.
If a different index has the non-trivial type, then use haveI := nontrivial_at that_index
.