and 1 contributors

# Name

Math::Groups - Find automorphisms of groups and isomorphisms between groups.

# Synopsis

``````  use Math::Groups;
use Data::Dump qw(dump);
use Math::Cartesian::Product;

# Print a cyclic group of order 4

print dump(Group{(\$_*\$_) % 5} 1..4)."\n";

#   elements => {
#                 1 => { 1 => 1, 2 => 2, 3 => 3, 4 => 4 },
#                 2 => { 1 => 2, 2 => 4, 3 => 1, 4 => 3 },
#                 3 => { 1 => 3, 2 => 1, 3 => 4, 4 => 2 },
#                 4 => { 1 => 4, 2 => 3, 3 => 2, 4 => 1 },
#               },
#   identity => 1,
#   inverses => { 1 => 1, 2 => 3, 3 => 2, 4 => 4 },
#   orders   => { 1 => 0, 2 => 4, 3 => 4, 4 => 2 },

# Find the automorphisms of the cyclic group of order 4

autoMorphisms {print dump({@_})."\n"}
Group{(\$_+\$_) % 4} 0..3;

#   { 1 => 1, 2 => 2, 3 => 3 }
#   { 1 => 3, 2 => 2, 3 => 1 }

# Find the automorphisms of dihedral group of order 4

my \$corners = [cartesian {1} ([1,-1]) x 2];
my \$cornerNumbers;
map {my (\$a, \$b) = @{\$\$corners[\$_]};
\$cornerNumbers->{\$a}{\$b} = \$_
} 0..\$#\$corners;

autoMorphisms {print dump({@_})."\n"}
Group
{my (\$a, \$b, \$c, \$d) = map {@\$_} @\$corners[@_];
\$cornerNumbers->{\$a*\$c}{\$b*\$d}
} 0..\$#\$corners;

#   { 1 => 1, 2 => 2, 3 => 3 }
#   { 1 => 1, 2 => 3, 3 => 2 }
#   { 1 => 2, 2 => 1, 3 => 3 }
#   { 1 => 3, 2 => 1, 3 => 2 }
#   { 1 => 2, 2 => 3, 3 => 1 }
#   { 1 => 3, 2 => 2, 3 => 1 }``````

# Description

Find automorphisms of groups and isomorphisms between groups.

A group automorphism is a bijection on the set of elements of a group which preserves the group product.

A group isomorphism is a bijection between the sets of elements of two groups which preserves the group product.

## identity(group)

Returns the identity element.

## inverse(group, element)

Returns the inverse of an element.

## orders(group)

Returns a hash which supplies the order of each element. The identity is assigned an order of zero.

## order(group, element)

Returns the order of an element with the group.

## elements(group)

Returns a hash whose keys are the elements if the group. The value at each key of this hash is another hash which gives the product in this group.

## Group sub elements...

Creates a group with the specified elements as multiplied by `sub`. The first parameter is a subroutine that forms the product of each pair of elements drawn from the following list of elements.

## abelian(group)

Returns 1 if the group is Abelian, else 0.

## cyclic(group)

If the group is cyclic, returns an element that generates the group, else undef.

## subGroup(groups, elements...)

Returns 1 if the elements specified plus the identity element form a sub group of the group else 0.

## homoMorphic(group1, group2, mapping...)

Returns 1 if mapping forms a homomorphism from group 1 to group 2, else 0.

The mapping is a subset of the Cartesian product of the elements of group 1 and the elements of group 2 flattened into a list. The pair:

`` (identity of group 1, identity of group 2)``

is added for you so there is no need to specify it unless you wish to.

## isoMorphic(group1, group2, mapping...)

Returns 1 if the mapping is an isomorphism from group 1 to group 2, else 0.

The mapping is a subset of the Cartesian product of the elements of group 1 and the elements of group 2 flattened into a list. The pair:

`` (identity of group 1, identity of group 2)``

is added for you so there is no need to specify it unless you wish to.

## isoMorphisms sub group1, group 2

Finds all the isomorphisms between two groups and calls `sub` to process each of them as they are discovered.

The parameter list to sub is a pair for each element of group 1 indicating the corresponding element of group 2 under the isomorphism.

## autoMorphic(group, mapping)

Returns 1 if the mapping is an automorphism from the group to itself, else 0.

The mapping is a subset of the Cartesian product of the elements of the group squared flattened into a list. The pair:

`` (identity of group, identity of group)``

is added for you so there is no need to specify it unless you wish to.

## autoMorphisms sub group

Finds all the automorphisms of the groups and calls `sub` to process each of them as they are discovered.

The parameter list to sub is a pair for each element of the group indicating the corresponding element under the automorphism.

# Export

The `Group()`, `isoMorphisms()`, `autoMorphisms()` functions are exported.

# Installation

Standard Module::Build process for building and installing modules:

``````  perl Build.PL
./Build
./Build test
./Build install``````

Or, if you're on a platform (like DOS or Windows) that doesn't require the "./" notation, you can do this:

``````  perl Build.PL
Build
Build test
Build install``````

# Author

Philip R Brenan at gmail dot com

http://www.appaapps.com

# See Also

Math::Cartesian::Product
Math::Permute::List

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.