IsSurjective( map )
IsSurjective
returns true
if the mapping map is surjective and
false
otherwise. Signals an error if map is a multi valued mapping.
A mapping map is surjective if for each element img of the range there is at least one element elm of the source that map maps to img.
gap> g := Group( (1,2,3,4), (2,4), (5,6,7) );; g.name := "g";; gap> p4 := MappingByFunction( g, g, x -> x^4 ); MappingByFunction( g, g, function ( x ) return x ^ 4; end ) gap> IsSurjective( p4 ); false gap> IsSurjective( InverseMapping( p4 ) ); Error, <map> must be a single valued mapping gap> p5 := MappingByFunction( g, g, x -> x^5 ); MappingByFunction( g, g, function ( x ) return x ^ 5; end ) gap> IsSurjective( p5 ); true gap> IsSurjective( InverseMapping( p5 ) ); true # 'p5' is a bijection
IsSurjective
first tests if the flag map.isSurjective
is bound. If
the flag is bound, it returns this value. Otherwise it calls
map.operations.IsSurjective( map )
, remembers the returned value in
map.isSurjective
, and returns it.
The default function called this way is MappingOps.IsSurjective
, which
compares the sizes of the range and image of map, and returns true
if
they are equal (see Image). Look in the index under IsSurjective to
see for which mappings this function is overlaid.
GAP 3.4.4