• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 35,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

Using GAP with the 3x3x3 Cube

Joined
Sep 3, 2017
Messages
49
In a reply to a previous thread I used GAP to compute the size of the group produced by closure of the 12 E-PERMs. I thought I would post how I represent cube states as facelet permutations in GAP so others might make use of this valuable tool.

I represent a cube state as a permutation of the 48 facelets moved by the cube turns numbered in the order:

UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR

The Up facelet of the UP-RIGHT cubie is numbered 1 through to the Right facelet of the Down-Back-Right cubie numbered 48. Numbered in this way the face turns are defined in GAP as:

R := (3,17,11,21)(4,18,12,22)(25,39,46,30)(26,37,47,28)(27,38,48,29);
U := (1,3,5,7)(2,4,6,8)(25,28,31,34)(26,29,32,35)(27,30,33,36);
F := (1,20,9,18)(2,19,10,17)(25,35,40,38)(26,36,41,39)(27,34,42,37);
L := (7,23,15,19)(8,24,16,20)(31,45,40,36)(32,43,41,34)(33,44,42,35);
D := (9,15,13,11)(10,16,14,12)(37,40,43,46)(38,41,44,47)(39,42,45,48);
B := (5,22,13,24)(6,21,14,23)(28,48,43,33)(29,46,44,31)(30,47,45,32);

A cube state defined by a turn sequence may then be entered into GAP as a product of these generators:

1 R U L U' R' U D R D' L' D R' U' D'

g1 := D^-1 * U^-1 * R^-1 * D * L^-1 * D^-1 * R * D * U * R^-1 * U^-1 * L * U * R;
(25,35)(26,36)(27,34)(37,42)(38,40)(39,41)

2 U2 R U2 R' B2 R U2 F2 L' D2 L F2 R' U2

g2 := U^2 * R^-1 * F^2 * L * D^2 * L^-1 * F^2 * U^2 * R * B^2 * R^-1 * U^2 * R * U^2;
(25,30)(26,28)(27,29)(37,47)(38,48)(39,46)

Note that group element multiplication proceeds right to left so the order of the turns is reversed.

In my previous post we were only interested in the position permutation. Numbering the 20 cubies in the order listed above the position permutations of the generating face turns are:

R := (2,9,6,11)(13,17,20,14);
U := (1,2,3,4)(13,14,15,16);
F := (1,10,5,9)(13,16,18,17);
L := (4,12,8,10)(15,19,18,16);
D := (5,8,7,6)(17,18,19,20);
B := (3,11,7,12)(14,20,19,15);
 
Joined
Sep 3, 2017
Messages
49
I hadn't used GAP for a while and found that my old GAPapp doesn't work with the latest MacOS (it's 32 bit). I downloaded a new GAPapp and found it can't read files saved by the old app. So I had to set up my Cube base file from scratch. I saved the input as a text file from which I can copy and paste into a GAPapp session. It defines the face turn generators and the 48 Cube Symmetries. Perhaps users of this forum might find it useful:

# 3 x 3 x 3 Group Generators as permutations of the facelets numbered in the order:
# UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR
#
#
R := (3,17,11,21)(4,18,12,22)(25,39,46,30)(26,37,47,28)(27,38,48,29);
U := (1,3,5,7)(2,4,6,8)(25,28,31,34)(26,29,32,35)(27,30,33,36);
F := (1,20,9,18)(2,19,10,17)(25,35,40,38)(26,36,41,39)(27,34,42,37);
L := (7,23,15,19)(8,24,16,20)(31,45,40,36)(32,43,41,34)(33,44,42,35);
D := (9,15,13,11)(10,16,14,12)(37,40,43,46)(38,41,44,47)(39,42,45,48);
B := (5,22,13,24)(6,21,14,23)(28,48,43,33)(29,46,44,31)(30,47,45,32);
#
# Facelet Permutation Representations of the 48 Cubic Group Symmetries (i.e. the Oh Symmetry Group)
#
# 0 E [ x, y, z]
Sym0 := ( );
# 1 C2x [ x,-y,-z]
Sym1 := (1,13)(2,14)(3,11)(4,12)(5,9)(6,10)(7,15)(8,16)(17,21)(18,22)(19,23)(20,24)(25,46)(26,47)(27,48)(28,37)(29,38)(30,39)(31,40)(32,41)(33,42)(34,43)(35,44)(36,45);
# 2 C2y [-x, y,-z]
Sym2 := (1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16)(17,23)(18,24)(19,21)(20,22)(25,31)(26,32)(27,33)(28,34)(29,35)(30,36)(37,43)(38,44)(39,45)(40,46)(41,47)(42,48);
# 3 C2z [-x,-y, z]
Sym3 := (1,9)(2,10)(3,15)(4,16)(5,13)(6,14)(7,11)(8,12)(17,19)(18,20)(21,23)(22,24)(25,40)(26,41)(27,42)(28,43)(29,44)(30,45)(31,46)(32,47)(33,48)(34,37)(35,38)(36,39);
# 4 C3xyz [ z, x, y]
Sym4 := (1,4,17)(2,3,18)(5,12,19)(6,11,20)(7,22,10)(8,21,9)(13,16,23)(14,15,24)(25,27,26)(28,38,36)(29,39,34)(30,37,35)(31,48,41)(32,46,42)(33,47,40)(43,44,45);
# 5 C23xyz [ y, z, x]
Sym5 := (1,17,4)(2,18,3)(5,19,12)(6,20,11)(7,10,22)(8,9,21)(13,23,16)(14,24,15)(25,26,27)(28,36,38)(29,34,39)(30,35,37)(31,41,48)(32,42,46)(33,40,47)(43,45,44);
# 6 C3xy'z' [-z,-x, y]
Sym6 := (1,8,19)(2,7,20)(3,24,10)(4,23,9)(5,16,17)(6,15,18)(11,22,14)(12,21,13)(25,33,41)(26,31,42)(27,32,40)(28,44,39)(29,45,37)(30,43,38)(34,35,36)(46,48,47);
# 7 C23xy'z' [-y, z,-x]
Sym7 := (1,19,8)(2,20,7)(3,10,24)(4,9,23)(5,17,16)(6,18,15)(11,14,22)(12,13,21)(25,41,33)(26,42,31)(27,40,32)(28,39,44)(29,37,45)(30,38,43)(34,36,35)(46,47,48);
# 8 C3x'yz' [ z,-x,-y]
Sym8 := (1,16,21)(2,15,22)(3,20,14)(4,19,13)(5,8,23)(6,7,24)(9,12,17)(10,11,18)(25,42,47)(26,40,48)(27,41,46)(28,35,45)(29,36,43)(30,34,44)(31,33,32)(37,38,39);
# 9 C23x'yz' [-y,-z, x]
Sym9 := (1,21,16)(2,22,15)(3,14,20)(4,13,19)(5,23,8)(6,24,7)(9,17,12)(10,18,11)(25,47,42)(26,48,40)(27,46,41)(28,45,35)(29,43,36)(30,44,34)(31,32,33)(37,39,38);
# 10 C3x'y'z [-z, x,-y]
Sym10 := (1,12,23)(2,11,24)(3,22,6)(4,21,5)(7,18,14)(8,17,13)(9,16,19)(10,15,20)(25,48,32)(26,46,33)(27,47,31)(28,29,30)(34,38,45)(35,39,43)(36,37,44)(40,42,41);
# C23x'y'z [ y,-z,-x]
Sym11 := (1,23,12)(2,24,11)(3,6,22)(4,5,21)(7,14,18)(8,13,17)(9,19,16)(10,20,15)(25,32,48)(26,33,46)(27,31,47)(28,30,29)(34,45,38)(35,43,39)(36,44,37)(40,41,42);
# 12 C4x [ x,-z, y]
Sym12 := (1,6,13,10)(2,5,14,9)(3,21,11,17)(4,22,12,18)(7,23,15,19)(8,24,16,20)(25,30,46,39)(26,28,47,37)(27,29,48,38)(31,45,40,36)(32,43,41,34)(33,44,42,35);
# 13 C34x [ x, z,-y]
Sym13 := (1,10,13,6)(2,9,14,5)(3,17,11,21)(4,18,12,22)(7,19,15,23)(8,20,16,24)(25,39,46,30)(26,37,47,28)(27,38,48,29)(31,36,40,45)(32,34,41,43)(33,35,42,44);
# 14 C4y [ z, y,-x]
Sym14 := (1,7,5,3)(2,8,6,4)(9,15,13,11)(10,16,14,12)(17,20,23,22)(18,19,24,21)(25,34,31,28)(26,35,32,29)(27,36,33,30)(37,40,43,46)(38,41,44,47)(39,42,45,48);
# 15 C34y [-z, y, x]
Sym15 := (1,3,5,7)(2,4,6,8)(9,11,13,15)(10,12,14,16)(17,22,23,20)(18,21,24,19)(25,28,31,34)(26,29,32,35)(27,30,33,36)(37,46,43,40)(38,47,44,41)(39,48,45,42);
# 16 C4z [-y, x, z]
Sym16 := (1,18,9,20)(2,17,10,19)(3,12,15,8)(4,11,16,7)(5,22,13,24)(6,21,14,23)(25,38,40,35)(26,39,41,36)(27,37,42,34)(28,48,43,33)(29,46,44,31)(30,47,45,32);
# 17 C34z [ y,-x, z]
Sym17 := (1,20,9,18)(2,19,10,17)(3,8,15,12)(4,7,16,11)(5,24,13,22)(6,23,14,21)(25,35,40,38)(26,36,41,39)(27,34,42,37)(28,33,43,48)(29,31,44,46)(30,32,45,47);
# 18 C2xy [ y, x,-z]
Sym18 := (1,22)(2,21)(3,4)(5,18)(6,17)(7,12)(8,11)(9,24)(10,23)(13,20)(14,19)(15,16)(25,29)(26,30)(27,28)(31,38)(32,39)(33,37)(34,48)(35,46)(36,47)(40,44)(41,45)(42,43);
# 19 C2xy' [-y,-x,-z]
Sym19 := (1,24)(2,23)(3,16)(4,15)(5,20)(6,19)(7,8)(9,22)(10,21)(11,12)(13,18)(14,17)(25,44)(26,45)(27,43)(28,42)(29,40)(30,41)(31,35)(32,36)(33,34)(37,48)(38,46)(39,47);
# 20 C2xz [ z,-y, x] ;
Sym20 := (1,11)(2,12)(3,9)(4,10)(5,15)(6,16)(7,13)(8,14)(17,18)(19,22)(20,21)(23,24)(25,37)(26,38)(27,39)(28,40)(29,41)(30,42)(31,43)(32,44)(33,45)(34,46)(35,47)(36,48);
# 21 C2xz' [-z,-y,-x]
Sym21 := (1,15)(2,16)(3,13)(4,14)(5,11)(6,12)(7,9)(8,10)(17,24)(18,23)(19,20)(21,22)(25,43)(26,44)(27,45)(28,46)(29,47)(30,48)(31,37)(32,38)(33,39)(34,40)(35,41)(36,42);
# 22 C2yz [-x, z, y]
Sym22 := (1,2)(3,19)(4,20)(5,10)(6,9)(7,17)(8,18)(11,23)(12,24)(13,14)(15,21)(16,22)(25,36)(26,34)(27,35)(28,41)(29,42)(30,40)(31,39)(32,37)(33,38)(43,47)(44,48)(45,46);
# 23 C2yz' [-x,-z,-y]
Sym23 := (1,14)(2,13)(3,23)(4,24)(5,6)(7,21)(8,22)(9,10)(11,19)(12,20)(15,17)(16,18)(25,45)(26,43)(27,44)(28,32)(29,33)(30,31)(34,47)(35,48)(36,46)(37,41)(38,42)(39,40);
# 24 σd_xy [ y, x, z]
Sym24 := (1,18)(2,17)(3,4)(5,22)(6,21)(7,12)(8,11)(9,20)(10,19)(13,24)(14,23)(15,16)(25,27)(28,29)(31,48)(32,47)(33,46)(34,38)(35,37)(36,39)(40,42)(43,44);
# 25 σd_xy' [-y,-x, z]
Sym25 := (1,20)(2,19)(3,16)(4,15)(5,24)(6,23)(7,8)(9,18)(10,17)(11,12)(13,22)(14,21)(25,42)(26,41)(27,40)(28,44)(29,43)(30,45)(31,33)(34,35)(37,38)(46,48);
# 26 σd_xz [ z, y, x]
Sym26 := (1,3)(2,4)(5,7)(6,8)(9,11)(10,12)(13,15)(14,16)(17,18)(19,22)(20,21)(23,24)(26,27)(28,34)(29,36)(30,35)(32,33)(38,39)(40,46)(41,48)(42,47)(44,45);
# 27 σd_xz' [-z, y,-x]
Sym27 := (1,7)(2,8)(3,5)(4,6)(9,15)(10,16)(11,13)(12,14)(17,24)(18,23)(19,20)(21,22)(25,31)(26,33)(27,32)(29,30)(35,36)(37,43)(38,45)(39,44)(41,42)(47,48);
# 28 σd_yz [ x, z, y]
Sym28 := (1,2)(3,17)(4,18)(5,10)(6,9)(7,19)(8,20)(11,21)(12,22)(13,14)(15,23)(16,24)(25,26)(28,39)(29,38)(30,37)(31,41)(32,40)(33,42)(34,36)(43,45)(46,47);
# 29 σd_yz' [ x,-z,-y] ;
Sym29 := (1,14)(2,13)(3,21)(4,22)(5,6)(7,23)(8,24)(9,10)(11,17)(12,18)(15,19)(16,20)(25,47)(26,46)(27,48)(28,30)(31,32)(34,45)(35,44)(36,43)(37,39)(40,41);
# 30 S4x [-x,-z, y]
Sym30 := (1,6,13,10)(2,5,14,9)(3,23,11,19)(4,24,12,20)(7,21,15,17)(8,22,16,18)(25,32,46,41)(26,31,47,40)(27,33,48,42)(28,45,37,36)(29,44,38,35)(30,43,39,34);
# 31 S34x [-x, z,-y]
Sym31 := (1,10,13,6)(2,9,14,5)(3,19,11,23)(4,20,12,24)(7,17,15,21)(8,18,16,22)(25,41,46,32)(26,40,47,31)(27,42,48,33)(28,36,37,45)(29,35,38,44)(30,34,39,43);
# 32 S4y [ z,-y,-x]
Sym32 := (1,15,5,11)(2,16,6,12)(3,9,7,13)(4,10,8,14)(17,20,23,22)(18,19,24,21)(25,40,31,46)(26,42,32,48)(27,41,33,47)(28,37,34,43)(29,39,35,45)(30,38,36,44);
# 33 S34y [-z,-y, x]
Sym33 := (1,11,5,15)(2,12,6,16)(3,13,7,9)(4,14,8,10)(17,22,23,20)(18,21,24,19)(25,46,31,40)(26,48,32,42)(27,47,33,41)(28,43,34,37)(29,45,35,39)(30,44,36,38);
# 34 S4z [-y, x,-z]
Sym34 := (1,22,9,24)(2,21,10,23)(3,12,15,8)(4,11,16,7)(5,18,13,20)(6,17,14,19)(25,48,40,33)(26,47,41,32)(27,46,42,31)(28,38,43,35)(29,37,44,34)(30,39,45,36);
# 35 S34z [ y,-x,-z]
Sym35 := (1,24,9,22)(2,23,10,21)(3,8,15,12)(4,7,16,11)(5,20,13,18)(6,19,14,17)(25,33,40,48)(26,32,41,47)(27,31,42,46)(28,35,43,38)(29,34,44,37)(30,36,45,39);
# 36 i [-x,-y,-z]
Sym36 := (1,13)(2,14)(3,15)(4,16)(5,9)(6,10)(7,11)(8,12)(17,23)(18,24)(19,21)(20,22)(25,43)(26,45)(27,44)(28,40)(29,42)(30,41)(31,37)(32,39)(33,38)(34,46)(35,48)(36,47);
# 37 σh_x [-x, y, z]
Sym37 := (3,7)(4,8)(11,15)(12,16)(17,19)(18,20)(21,23)(22,24)(25,34)(26,36)(27,35)(28,31)(29,33)(30,32)(37,40)(38,42)(39,41)(43,46)(44,48)(45,47);
# 38 σh_y [ x,-y, z]
Sym38 := (1,9)(2,10)(3,11)(4,12)(5,13)(6,14)(7,15)(8,16)(25,37)(26,39)(27,38)(28,46)(29,48)(30,47)(31,43)(32,45)(33,44)(34,40)(35,42)(36,41);
# 39 σh_z [ x, y,-z]
Sym39 := (1,5)(2,6)(9,13)(10,14)(17,21)(18,22)(19,23)(20,24)(25,28)(26,30)(27,29)(31,34)(32,36)(33,35)(37,46)(38,48)(39,47)(40,43)(41,45)(42,44);
# 40 S6xyz [-y,-z,-x]
Sym40 := (1,23,4,13,17,16)(2,24,3,14,18,15)(5,21,12,9,19,8)(6,22,11,10,20,7)(25,45,27,43,26,44)(28,47,38,40,36,33)(29,46,39,42,34,32)(30,48,37,41,35,31);
# 41 S56xyz [-z,-x,-y]
Sym41 := (1,16,17,13,4,23)(2,15,18,14,3,24)(5,8,19,9,12,21)(6,7,20,10,11,22)(25,44,26,43,27,45)(28,33,36,40,38,47)(29,32,34,42,39,46)(30,31,35,41,37,48);
# 42 S6xy'z' [ y,-z, x]
Sym42 := (1,21,8,13,19,12)(2,22,7,14,20,11)(3,6,24,15,10,18)(4,5,23,16,9,17)(25,30,33,43,41,38)(26,29,31,45,42,37)(27,28,32,44,40,39)(34,47,35,46,36,48);
# 43 S56xy'z' [ z, x,-y] ;
Sym43 := (1,12,19,13,8,21)(2,11,20,14,7,22)(3,18,10,15,24,6)(4,17,9,16,23,5)(25,38,41,43,33,30)(26,37,42,45,31,29)(27,39,40,44,32,28)(34,48,36,46,35,47);
# 44 S6x'yz' [ y, z,-x]
Sym44 := (1,19,16,13,21,4)(2,20,15,14,22,3)(5,17,8,9,23,12)(6,18,7,10,24,11)(25,36,42,43,47,29)(26,35,40,45,48,28)(27,34,41,44,46,30)(31,39,33,37,32,38);
# 45 S56x'yz' [-z, x, y]
Sym45 := (1,4,21,13,16,19)(2,3,22,14,15,20)(5,12,23,9,8,17)(6,11,24,10,7,18)(25,29,47,43,42,36)(26,28,48,45,40,35)(27,30,46,44,41,34)(31,38,32,37,33,39);
# 46 S6x'y'z [-y, z, x]
Sym46 := (1,17,12,13,23,8)(2,18,11,14,24,7)(3,10,22,15,6,20)(4,9,21,16,5,19)(25,39,48,43,32,35)(26,38,46,45,33,34)(27,37,47,44,31,36)(28,41,29,40,30,42);
# 47 S56x'y'z [ z,-x, y]
Sym47 := (1,8,23,13,12,17)(2,7,24,14,11,18)(3,20,6,15,22,10)(4,19,5,16,21,9)(25,35,32,43,48,39)(26,34,33,45,46,38)(27,36,31,44,47,37)(28,42,30,40,29,41);
#
#
T := Group( Sym4 , Sym6 );
#
Td := ClosureGroup(T , Sym24);
#
Th := ClosureGroup( T , Sym36 );
#
O := ClosureGroup( T , Sym12);
#
Oh := ClosureGroup(O , Sym36);
 
Last edited:
Joined
Sep 3, 2017
Messages
49
Example: The Two Face Group

Back over ten years ago now I wrote a cube simulation with a three step solution algorithm. 1. Solve a 2x2x2 block using all six face turns. 2. Extend the 2x2x2 block to a 3x2x2 block using turns of the three faces which do not mess up the 2x2x2. 3. Complete the solution using turns of only two faces. I found that in general one can't solve the cube from a 3x2x2 block using only two faces. Here I use GAP to analyze this problem.

# 3 x 3 x 3 Group Generators as permutations of the facelets numbered in the order:
# UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR
#
#
R := (3,17,11,21)(4,18,12,22)(25,39,46,30)(26,37,47,28)(27,38,48,29);
U := (1,3,5,7)(2,4,6,8)(25,28,31,34)(26,29,32,35)(27,30,33,36);
F := (1,20,9,18)(2,19,10,17)(25,35,40,38)(26,36,41,39)(27,34,42,37);
L := (7,23,15,19)(8,24,16,20)(31,45,40,36)(32,43,41,34)(33,44,42,35);
D := (9,15,13,11)(10,16,14,12)(37,40,43,46)(38,41,44,47)(39,42,45,48);
B := (5,22,13,24)(6,21,14,23)(28,48,43,33)(29,46,44,31)(30,47,45,32);
#
gap> UR := Group( U , R );
<permutation group with 2 generators>
gap> Size(UR);
73483200
gap> # Edge Flip: U F' U F R B L U' F U' F' L' B' R'
gap> EdgeFlip := R^-1 * B^-1 * L^-1 * F^-1 * U^-1 * F * U^-1 * L * B * R * F * U * F^-1 * U;
(1,2)(3,4)
gap> C1 := ClosureGroup( UR , EdgeFlip );
<permutation group with 3 generators>
gap> Size(C1);
4702924800
gap> # J PERM: R U2 F' R' F U' F' R F U' R' U'
gap> JPerm := U^-1 * R^-1 * U^-1 * F * R * F^-1 * U^-1 * F * R^-1 * F^-1 * U^2 * R;
(1,3)(2,4)(25,28)(26,29)(27,30)
gap> C2 := ClosureGroup( C1 , JPerm );
<permutation group with 4 generators>
gap> Size( C2 );
28217548800

There are 3^5 * 2^6 * 6! * 7! / 2 = 28,217,548,800 cube positions with a given 3x2x2 block solved. Using turns of two faces as calculated above only 73,483,200 of these can be solved. If one adds an edge flip to the generators this number goes up to 4,702,924,800--still not the whole 3x2x2 block group. Adding a J-Perm to the generators then gives the whole group. So, once a 3x2x2 block is solved neither the edge orientation nor the position permutation can in general be solved using turns of the remaining two faces.
 
Top