(* Toda.m               Neil Strickland  January 2004                   *)

(* This file contains information from Toda's book "Composition Methods *)
(* in Homotopy Groups of Spheres" (study 49 in Annals of Mathematics    *)
(* Studies, Princeton University Press), expressed in Mathematica form. *)

<<TeXToMath.m
 
(************************************************************************)
(* Definitions for working with finitely generated Abelian groups.      *)

Group::usage = 
 TeXToMath[StringJoin[
  "Group[{\\(a_1,d_1\\),...,{\\(a_n,d_n\\)}] represents the direct sum ",
  "of cyclic groups of order \\(d_i\\) generated by the elements ",
  "\\(a_i\\).  The value \\(d_i\\)=Infinity is allowed."
 ]]
CyclicFormat[{x_, Infinity}] :=
  SequenceForm[\[DoubleStruckCapitalZ\], x]
CyclicFormat[{x_, n_Integer}] :=
  SequenceForm[Subscript[\(\[DoubleStruckCapitalZ\]\),n], x]
Format[Group[]]    = 0
Format[Group[C_]] := CyclicFormat[C]
Format[A_Group]   := CyclicFormat /@ (CirclePlus @@ A) /; Length[A] > 1

GType::usage = 
 TeXToMath[StringJoin[
  "GType[\\(d_1\\),...,\\(d_n\\)] represents the isomorphism class of ",
  "abelian groups containing \\(\\Z_{d_1}\\oplus...\\oplus\\Z_{d_n}\\). ",
  "The \\(d_i\\) should be in nondecreasing order and may be infinite. ",
  "This should be improved to deal better with the case of groups with ",
  "torsion at more than one prime."
 ]]
Format[GType[]]  = 0
Format[GType[Infinity]]  = \[DoubleStruckCapitalZ]
Format[GType[n_Integer]] :=
 Subscript[\[DoubleStruckCapitalZ],n]
Format[GType[l__]] :=
 GType /@ CirclePlus[l] /; Length[{l}] > 1

GroupType::usage =
 "GroupType[A] is the isomorphism class of the group A."
GroupType[A_Group]      := GType @@ Sort[Last /@ (List @@ A)]
GroupType[l_List]       := GroupType /@ l

GroupOrder::usage =
 "GroupOrder[A] is the order of the group A."
GroupOrder[A_Group]     := Times @@ GroupType[A]
GroupOrder[l_List]      := GroupOrder /@ l

FiniteQ::usage =
 "FiniteQ[A] is True iff the group A is finite."
FiniteQ[A_Group]        := (GroupOrder[A] =!= Infinity)
FiniteQ[l_List]         := FiniteQ /@ l

GroupRank::usage = 
 StringJoin[
  "GroupRank[A] is the number of cyclic factors in the group A. ",
  "This should be improved to deal better with the case of groups with ",
  "torsion at more than one prime."
 ]
GroupRank[A_Group]      := Length[A]
GroupRank[l_List]       := GroupRank /@ l

GroupExponent::usage = 
 StringJoin[
  "GroupExponent[A] is the least integer \\(m\\) such that \\(ma=0\\) for ",
  "all \\(a \\in A\\), or Infinity if no such \\(m\\) exists. "
 ]
GroupExponent[A_Group] :=
 If[Length[A] == 0,
  1,
  If[Max @@ (Last /@ A) === Infinity,
     Infinity,
     LCM @@ (Last /@ A)]
 ]
GroupExponent[l_List]   := GroupExponent /@ l
Generators[A_Group]     := First /@ (List @@ A)
Generators[l_List]      := Generators /@ l

TorsionSubgroup[G_Group] := 
 Select[G,Last[#] =!= Infinity &]

pBasis[A_Group] :=
 Flatten[# (2^ Range[0,Log[2,AdditiveOrder[#]] - 1]) & /@ Generators[A]]

GroupGeneratedBy::usage = 
 TeXToMath[StringJoin[
  "GroupGeneratedBy[\\(a_1\\),...,\\(a_n\\)] gives ",
  "Group[{\\(a_1,d_1\\)},...,{\\(a_n,d_n\\)}], where ",
  "\\(d_i\\) = AdditiveOrder[\\(a_i\\)].  This is just a convenience ",
  "function for declaring groups and is not intended for use in ",
  "calculation."
 ]]
GroupGeneratedBy[gens___] := 
 Group @@ ({#,AdditiveOrder[#]} & /@ {gens})

Elements::usage = 
 "Elements[A] is the list of all elements of the finite group A."
ElementsAux[{a_,m_}]    := Table[k a,{k,0,m-1}]
Elements[Group[]] = {0}
Elements[A_Group]       := 
 Flatten[Outer @@ Join[{Plus},ElementsAux /@ List @@ A],Length[A]-1] /;
 FiniteQ[A]


(* Here is a very naive function for checking whether an element is     *)
(* is contained in a specified group.  It assumes that the generators   *)
(* are symbols, and will not work if they are linear combinations of    *)
(* symbols.                                                             *)

ElementQ[0,A_Group] := True

ElementQ[a_Plus,A_Group] := 
 And @@ (ElementQ[#,A] & /@ (List @@ a))

ElementQ[n_Integer a_,A_Group] := ElementQ[a,A]

ElementQ[l_List,A_Group] := 
 And @@ (ElementQ[#,A] & /@ l)

ElementQ[a_,A_Group] := True /; MemberQ[Generators[A],a]

ElementQ[_,A_Group] := False


 

Coset[a_,{u___,0,v___}] := Coset[a,{u,v}]
Coset /: n_Integer Coset[a_,B_List] := Coset[Expand[n a],Expand[n B]]
Coset[a_,{}] := a

(************************************************************************)

AllRelations = {}
AllRelationsTeXReasons = {}
AllRelationsReasons = {}
AllRelationsStatements = {}
ExplainedRelations = {}
ElementDocumentation = ""

Verbosify[rel_,statement_,reason_] :=
 Module[{exrel,STATEMENT,REASON,CONDITION,SOW},
  Off[RuleDelayed::rhs];
  exrel = rel /. Condition -> CONDITION;
  exrel =
   exrel /.
    {Rule[a_,b_] :>
      RuleDelayed[a,(Sow[{a,b,STATEMENT,REASON}]; b)],
     RuleDelayed[a_,CONDITION[b_,c_]] :> 
      RuleDelayed[a,CONDITION[(Sow[{a /. t_Pattern :> First[t],b,STATEMENT,REASON}]; b),c]],
     RuleDelayed[a_,b_] :>
      RuleDelayed[a,(Sow[{a /. t_Pattern :> First[t],b,STATEMENT,REASON}]; b)]
    };
  exrel = exrel /. CONDITION -> Condition
                /. {STATEMENT -> statement,
                    REASON -> reason,
                    SOW -> Sow};
  On[RuleDelayed::rhs];
  exrel
 ]

AddRelation[rel_,reason_] :=
 Module[{mreason,exrel,state,MREASON},
  AllRelations = Join[AllRelations,{rel}];
  AllRelationsTeXReasons = Join[AllRelationsTeXReasons,{reason}];
  mreason = TeXToMath[reason];
  If[Head[rel] === RuleDelayed,
   state = ToString[InputForm[rel]],
  (* Else *)
   state = ""
  ];
  AllRelationsReasons = Join[AllRelationsReasons,{mreason}];
  AllRelationsStatements = 
   Join[AllRelationsStatements,{state}];
  ExplainedRelations =
   Join[ExplainedRelations,{Verbosify[rel,state,mreason]}];
 ]

AddRelation[rel_,state_,reason_] :=
 Module[{mreason,exrel,STATE,MREASON},
  AllRelations = Join[AllRelations,{rel}];
  AllRelationsTeXReasons = Join[AllRelationsTeXReasons,{reason}];
  mreason = TeXToMath[reason];
  AllRelationsReasons = Join[AllRelationsReasons,{mreason}];
  AllRelationsStatements = 
   Join[AllRelationsStatements,{state}];
  ExplainedRelations =
   Join[ExplainedRelations,{Verbosify[rel,state,mreason]}];
 ]

Zop[x_] := 
 Module[{y},
  y = Expand[x] //. AllRelations;
  If[ Length[y] > 0,
   y = (# //. AllRelations) & /@ y;];
  y
 ]

Zap[x_] := FixedPoint[Zop,x]


(************************************************************************)

HomotopyGroup[n_Integer,X_] := HomotopySet[Sphere[n],X]
SpherePi[n_,m_] := HomotopySet[Sphere[n],Sphere[m]]

Format[Sphere[n_]] := Superscript["S",n]
SphereQ[X_] := MatchQ[X,Sphere[_Integer]]

(************************************************************************)
(* If a : S^k -> S^l and b : S^l -> S^m then                            *)
(* Source[a] = Sphere[k], Target[a] = Sphere[l], and o[b,a] is the      *)
(* composite.                                                           *)

Format[t_o] := Infix[t,\[EmptySmallCircle]] /; Length[t] > 1

SetAttributes[o,{Flat,OneIdentity}]

o[a_, b_] := Uncomposable /;
 SphereQ[Source[a]] && SphereQ[Target[b]] && Source[a] =!= Target[b]

Source[o[a__,b_]]       := Source[b]
Target[o[a_,b__]]       := Target[a]
Source[n_Integer a_]    := Source[a]
Target[n_Integer a_]    := Target[a]

SourceSphere[a_] := First[Source[a]] /; SphereQ[Source[a]]
TargetSphere[a_] := First[Target[a]] /; SphereQ[Target[a]]

Source[x_Plus] :=
 Module[{l},
  l = Source /@ (List @@ x);
  If[Equal @@ l,First[l],Inhomogeneous]
 ]

Target[x_Plus] :=
 Module[{l},
  l = Target /@ (List @@ x);
  If[Equal @@ l,First[l],Inhomogeneous]
 ]

Source[Coset[0,{y__}]] :=
 Module[{l},
  l = Source /@ {y};
  If[Equal @@ l,First[l],Inhomogeneous]
 ]

Target[Coset[0,{y__}]] :=
 Module[{l},
  l = Target /@ {y};
  If[Equal @@ l,First[l],Inhomogeneous]
 ]

Source[Coset[x_,{y__}]] :=
 Module[{l},
  l = Source /@ {x,y};
  If[Equal @@ l,First[l],Inhomogeneous]
 ]

Target[Coset[x_,{y__}]] :=
 Module[{l},
  l = Target /@ {x,y};
  If[Equal @@ l,First[l],Inhomogeneous]
 ]

Source[PlusOrMinus[x_]] := Source[x]
Target[PlusOrMinus[x_]] := Target[x]

Stem[a_] := 
 Module[{s,t},
  s = Source[a];
  t = Target[a];
  If[s === Inhomogeneous || t === Inhomogeneous,
   Return[Inhomogeneous]
  ];
  If[Head[s] =!= Sphere || Head[t] =!= Sphere,
   Return[Inhomogeneous]
  ];
  First[s] - First[t]
 ]

o[a_,b_Plus]            := o[a,#] & /@ b
o[a_,n_Integer b_]      := Expand[n o[a,b]]
o[a_,n_Integer]         := Expand[n a]
o[a_,Coset[b_,C_List]]  := Coset[o[a,b],o[a,#]& /@ C]
o[a_Plus,b_]            := o[#,b] & /@ a /; IsSuspension[b]
o[n_Integer a_,b_]      := Expand[n o[a,b]] /; IsSuspension[b]
o[n_Integer,b_]         := Expand[n b] /; IsSuspension[b]
o[Coset[a_,B_List],c_]  := Coset[o[a,c],o[#,c] & /@ B] /; IsSuspension[c]
o[a_,_iota]             := a
o[_iota,b_]             := b

o[a_,0]                 := 0
o[0,b_]                 := 0

(* Whitehead, GTM61, Theorem XI.8.9, modulo odd torsion, assuming *)
(* Hilton-Hopf = James-Hopf:                                      *)
o[k_Integer b_,a_] :=
  k o[b,a] + Expand[(k(k-1)/2) o[b,w[SourceSphere[b]],Hopf[a]]] /;
   SphereQ[Source[b]] && SphereQ[Target[b]] && SphereQ[Source[a]]

ST[x_]                  := {SourceSphere[x],TargetSphere[x]}

Home[x_] := HomotopySet[Source[x],Target[x]]

ShowHome[x_]            :=
 Module[{s,t,nm},
  s = Source[x];
  t = Target[x];
  If[Head[s] === Sphere,
   nm = SequenceForm[Subscript[\[Pi],First[s]],t];
   rf = SequenceForm["\n",SpherePiReference[First[s],First[t]]],
   (* Else *)
   nm = SequenceForm["[",s,",",t,"]"];
   rf = "";
  ];
  SequenceForm[nm," = ",HomotopySet[s,t],rf]
 ]

ShowSpherePi[n_,m_] := 
 SequenceForm[
  Subsuperscript["\[Pi]",n,m], " = ",
  SpherePi[n,m],
  "\n(",SpherePiReference[n,m],")\n"
 ]

(************************************************************************)

(* TodaBracket[{a,b,c},n] is the coset that Toda denotes by             *)
(* {a,Sigma^n b,Sigma^n c}_n.  It is defined when a o Sigma^n b = 0 and *)
(* c o b = 0, and it is a coset of                                      *)
(* (Sigma^{n+1} c)^* [Sigma^{n+1}X, Z] + a_* Sigma^n [Sigma W,Y].       *)

Indeterminacy[TodaBracket[u__]] := TodaBracketIndeterminacy[u]

TodaBracketIndeterminacy[x_List, n_] := 
  Module[{a,b,c,W,X,Y,Z,G,H,indet},
      a = x[[1]]; b = x[[2]]; c = x[[3]];
      W = Source[c];
      X = Source[b];
      Y = Target[b];
      Z = Target[a];
      G = HomotopySet[SigmaIterate[n + 1, X], Z];
      H = HomotopySet[Sigma[W], Y];
      indet = 
        Union[o[#, SigmaIterate[n + 1, c]] & /@ Generators[G], 
          o[a, SigmaIterate[n, #]] & /@ Generators[H]];
      indet = Select[indet, # =!= 0 &];
      indet] /; Length[x] == 3

(************************************************************************)
(* If a : S^k -> S^l then                                               *)
(* Sigma[a]      : S^{k+1} -> S^{l+1}     is the suspension.            *)
(* Hopf[a]       : S^k -> S^{2l-1}        is the Hopf invariant.        *)
(* WhiteheadP[a] : S^{k-2} -> S^{(l-1)/2} is the Whitehead product.     *)

Sigma::usage =
 TeXToMath["\\(\\Sigma\\) is the suspension functor. "]

Format[Sigma] = \[CapitalSigma]

Format[Sigma[a_]] := SequenceForm[\[CapitalSigma],a]

Sigma[Sphere[n_]] := Sphere[n+1]

SourceShift[Sigma] = (#+1) & 
TargetShift[Sigma] = (#+1) & 

Source[Sigma[a_]]       := Sigma[Source[a]]
Target[Sigma[a_]]       := Sigma[Target[a]]

Sigma[l_List]           := Sigma /@ l
Sigma[A_Group]          := Sigma /@ Generators[A]
Sigma[0]                 = 0
Sigma[a_Plus]           := Sigma /@ a
Sigma[n_Integer a_]     := Expand[n Sigma[a]]
Sigma[Coset[a_,B_List]] := Coset[Sigma[a],Sigma /@ B]
Sigma[a_o]              := Sigma /@ a
Sigma[w[_]]             := 0
Sigma[WhiteheadP[_]]    := 0
IsSuspension[_Sigma]    := True
IsSuspension[a_]        := True /; IsDoubleSuspension[a]
IsSuspension[t_o]       := And @@ (IsSuspension /@ (List @@ t))

SigmaIterate[n_Integer,a_] := Nest[Sigma,a,n]

Hopf::usage = 
 TeXToMath[
  StringJoin[
   "Hopf[x] is the Hopf invariant of x (defined by the James-Hopf ",
   "procedure with the left-lexicographic ordering).  Thus Hopf ",
   "gives a homomorphism \\(\\pi_kS^n\\rightarrow\\pi_kS^{2n-1}\\), ",
   "conventionally denoted by \\(H\\)."
 ]]

SourceShift[Hopf]        = #&
TargetShift[Hopf]        = 2#-1 &
Source[Hopf[a_]]        := Source[a]
Target[Hopf[a_]]        := Sphere[2 TargetSphere[a] - 1] /;
                            SphereQ[Target[a]]
Hopf[l_List]            := Hopf /@ l
Hopf[A_Group]           := Hopf /@ Generators[A]
Hopf[0]                  = 0
Hopf[a_Plus]            := Hopf /@ a
Hopf[n_Integer a_]      := Expand[n Hopf[a]]
Hopf[Coset[a_,B_List]]  := Coset[Hopf[a],Hopf /@ B]
Hopf[_Sigma]            := 0
Hopf[a_]                := 0 /; IsSuspension[a]
Hopf[_iota]             := 0

AddRelation[
 Hopf[w[n_?EvenQ]] :> 2 iota[2n-1],
 TeXToMath["\\(H(w_{2k})=2\\iota_{4k-1}\\)"],
 StringJoin[
  "Toda says that this is well-known, up to sign.  I have fudged ",
  "the sign on the assumption that the definitions can be arranged ",
  "to make it plus."
 ]
]

AddRelation[
 Hopf[w[n_?OddQ]] :> 0,
 TeXToMath["\\(H(w_{2k+1})=0\\)"],
 StringJoin[
  "When \\(n\\) is odd, the class \\(w_n=[\\iota_n,\\iota_n]\\) ",
  "has order two, so \\(H(w_n)\\) has order two and is contained ",
  "in the free group \\(\\pi_{2n-1}S^{2n-1}\\), so it must vanish. "
 ]
]

AddRelation[
 Hopf[o[a_,b_]] :> 
  o[Hopf[a],b] + 
  o[SigmaIterate[TargetSphere[a]-1,a],
    SigmaIterate[SourceSphere[a]-1,a],Hopf[b]] /;
   SphereQ[Source[b]] && SourceSphere[b] > 1,
 TeXToMath["H(a\\circ b)=H(a)\\circ b+(a#a)\\circ H(b)\\)"],
 "This is by a formula
  of Baues.  The proof is not correct but I hope that the 
  result is.  There may be a sign issue as well.
 "
]

WhiteheadP::usage = 
 TeXToMath[
  StringJoin[
   "WhiteheadP represents the connecting map in the ",
   "EHP sequence, which is conventionally denoted by \\(P\\). ",
   "This is a homomorphism ",
   "\\(P:\\pi_kS^{2n-1}\\rightarrow\\pi_{k-2}S^{n-1}\\)."
 ]]

w::usage = 
 TeXToMath[
  StringJoin[
  "w[k] represents the Whitehead product ",
  "\\(w_k=[\\iota_k,\\iota_k]\\in\\pi_{2k-1}S^k\\)."
 ]]

SourceShift[WhiteheadP]  = (#-2) &
TargetShift[WhiteheadP]  = (#-1)/2 &
Source[WhiteheadP[a_]]  := Sphere[SourceSphere[a]-2] /;
                            SphereQ[Source[a]]
Target[WhiteheadP[a_]]  := Sphere[(TargetSphere[a]-1)/2] /;
                            SphereQ[Source[a]]
WhiteheadP[l_List]      := WhiteheadP /@ l
WhiteheadP[A_Group]     := WhiteheadP /@ Generators[A]
WhiteheadP[0]            = 0
WhiteheadP[a_Plus]      := WhiteheadP /@ a
WhiteheadP[n_Integer a_]:= Expand[n WhiteheadP[a]]
WhiteheadP[Coset[a_,B_List]] := Coset[WhiteheadP[a],WhiteheadP /@ B]
WhiteheadP[Hopf[_]]     := 0
WhiteheadP[iota[k_]]    := w[(k-1)/2] /; OddQ[k]

Source[w[k_]]           := Sphere[2k-1]
Target[w[k_]]           := Sphere[k]
Format[w[n_]]           := Subscript[w,n]

(************************************************************************)

DeclareFamily[name_,format_,source_,target_,defn_] := 
 Module[{k,ixformat},
  Format[name] = format;
  Format[Release[name][k_]] := Subscript[name,k];
  If[Head[format] == Superscript,
   Format[Release[name][k_]] := Subsuperscript[format[[1]],k,format[[2]]];
  ];
  Release[name][k_] := Undefined /; k < target;
  Source[Release[name][k_]] := Sphere[k - target + source];
  Target[Release[name][k_]] := Sphere[k];
  Sigma[Release[name][k_]]  := name[k+1];
  IsSuspension[Release[name][k_]] := True /; k > target;
  WhiteheadP[Release[name][k_]] :=
   o[w[(k-1)/2],name[k-2]] /; k > target+1 && OddQ[k];
  WhiteheadP[o[a_,name[k_]]] :=
   o[WhiteheadP[a],name[k-2]] /; k > target+1;
  Defn[name] = defn;
  Defn[Release[name][_]] := defn;
  MessageName[name,"usage"]  = TeXToMath[defn];
  If[Head[ElementDocumentation] =!= String,
     ElementDocumentation = ""];
  ElementDocumentation = 
   StringJoin[
    ElementDocumentation,
    "\n\\item ",defn,
    " Mathematica notation is {\\tt ",ToString[InputForm[name]],"[n]}.\n"
   ];
 ]

DeclareElement[name_,format_,source_,target_,defn_] := 
 Module[{},
  Format[name] = format;
  Source[name] = Sphere[source];
  Target[name] = Sphere[target];
  Defn[name]   = defn;
  MessageName[name,"usage"]  = TeXToMath[defn];
  If[Head[ElementDocumentation] =!= String,
     ElementDocumentation = ""];
  ElementDocumentation = 
   StringJoin[
    ElementDocumentation,
    "\n\\item ",defn,
    " Mathematica notation is {\\tt ",ToString[InputForm[name]],"}.\n"
   ];
 ]

AdditiveOrder[_] := Infinity

OrderRule0 = 
 (k_Integer XXXX :> Mod[k,NNNN] XXXX /; k<0 || k>=NNNN)

OrderRule1 = 
 (k_Integer o[a__,XXXX] :> Mod[k,NNNN] o[a,XXXX] /; k<0 || k>=NNNN)

OrderRule2 =
 (k_Integer o[XXXX,b__] :> Mod[k,NNNN] o[XXXX,b] /; (k<0 || k>=NNNN) && IsSuspension[o[b]])

SetOrder[x_,n_,reason_] := 
 Module[{r},
  AdditiveOrder[x] = n;
  r = OrderRule0 /. {XXXX -> x,NNNN -> n};
  AddRelation[r,SequenceForm[n,Format[x],"=0"],reason];
  r = OrderRule1 /. {XXXX -> x,NNNN -> n};
  AddRelation[r,SequenceForm[n,Format[x],"=0"],reason];
  r = OrderRule2 /. {XXXX -> x,NNNN -> n};
  AddRelation[r,SequenceForm[n,Format[x],"=0"],reason];
 ]

StableOrderRule0 = 
 (k_Integer XXXX[m_] :> Mod[k,NNNN] XXXX[m] /;
   (m >= DDDD) && (k<0 || k>=NNNN))

StableOrderRule1 = 
 (k_Integer o[a__,XXXX[m_]] :> Mod[k,NNNN] o[a,XXXX[m]] /;
   (m >= DDDD) && (k<0 || k>=NNNN))

StableOrderRule2 = 
 (k_Integer o[XXXX[m_],b__] :> Mod[k,NNNN] o[XXXX[m],b] /;
   (m >= DDDD) && (k<0 || k>=NNNN) && IsSuspension[o[b]])

SetStableOrder[x_,n_,d_,reason_] := 
 Module[{r},
  AdditiveOrder[Release[x][k_]] := n /; k >= d;
  r = StableOrderRule0 /. {XXXX -> x,NNNN -> n,DDDD -> d};
  AddRelation[r,
   SequenceForm[n,Subscript[x,"k"],"=0 for k \[GreaterEqual] ",d],
   reason];
  r = StableOrderRule1 /. {XXXX -> x,NNNN -> n,DDDD -> d};
  AddRelation[r,
   SequenceForm[n,Subscript[x,"k"],"=0 for k \[GreaterEqual] ",d],
   reason];
  r = StableOrderRule2 /. {XXXX -> x,NNNN -> n,DDDD -> d};
  AddRelation[r,
   SequenceForm[n,Subscript[x,"k"],"=0 for k \[GreaterEqual] ",d],
   reason];
 ]

GeneralOrderRule = 
 (k_Integer XXXX :> Mod[k,NNNN] YYYY /; (k<0 || k>=NNNN) && CCCC)

AddOrderRule[pattern_,n_,criterion_,state_,reason_] :=
 Module[{r,rhs},
  AdditiveOrder[pattern] := n /; criterion;
  rhs = pattern /. {t_Pattern :> First[t],
                    t_PatternTest :> First[t]};
  r = GeneralOrderRule /. {XXXX -> pattern, YYYY -> rhs,
                           NNNN -> n, CCCC -> criterion};
  AddRelation[r,state,reason] 
 ]

(************************************************************************)

(* Declarations of elements and families of elements                    *)

DeclareFamily[
 iota,\[Iota],1,1,
 "\\(\\iota_n:S^n\\rightarrow S^n\\) is the identity map."
]

Indeterminacy[iota[1]] = {}

DeclareFamily[
 eta,\[Eta],3,2,
 StringJoin[
  "\\(\\eta_2:S^3\\rightarrow S^2\\) is the complex Hopf map.  ",
  "For \\(k\\geq 2\\) we put \\(\\eta_k=\\Sigma^{k-2}\\eta_2\\). "
 ]
]

Indeterminacy[eta[2]] = {}

DeclareFamily[
 nu,\[Nu],7,4,
 StringJoin[ 
  "\\(\\nu_4:S^7\\rightarrow S^4\\) is defined by the properties ",
  "\\(H(\\nu_4)=\\iota_7\\) and \\(2\\Sigma(\\nu_4)=\\Sigma^2\\nu'\\) ",
  "(Lemma 5.4).  I think this only defines it modulo \\(2\\nu'\\).  ",
  "However, I think we pin it down precisely by requiring that ",
  "\\(\\nu_4\\) should be equal to the quaternionic Hopf map plus an ",
  "odd torsion class, and that \\(\\Sigma\\nu_4\\) should be 2-torsion. ",
  "For \\(n\\geq 4\\) we put \\(\\nu_n=\\Sigma^{n-4}\\nu_4\\)."
 ]
]

Indeterminacy[nu[4]] = {}

DeclareFamily[
 sigma,\[Sigma],15,8,
 StringJoin[
  "\\(\\sigma_8:S^{15}\\rightarrow S^{8}\\) is the octonionic Hopf map ",
  "plus an odd torsion class, chosen so that \\(\\Sigma\\sigma_8\\) is ",
  "2-torsion.  Toda defines it (Lemma 5.14) by the property that ",
  "\\(H(\\sigma_8)=\\iota_{15}\\). ",
  "For \\(n\\geq 8\\) we put \\(\\sigma_n=\\Sigma^{n-8}\\sigma_8\\)."
 ]
]

Indeterminacy[sigma[8]] = {}

DeclareFamily[
 epsilon,\[Epsilon],11,3,
 StringJoin[
  "\\(\\epsilon_3:S^{11}\\rightarrow S^3\\) is the unique element of the ",
  "Toda bracket \\(\\langle\\eta_3,\\Sigma\\nu',\\nu_7\\rangle_1\\) (see ",
  "the beginning of Toda's Chapter VI). ",
  "For \\(k\\geq 3\\) we put \\(\\epsilon_k=\\Sigma^{k-3}\\epsilon_3\\)."
 ]
]

TodaBracketRepresentation[epsilon[3]] = 
 TodaBracket[{eta[3],nuprime,nu[6]},1]
Indeterminacy[epsilon[3]] = {}

DeclareFamily[
 nubar,OverBar[\[Nu]],14,6,
 StringJoin[
  "In Toda's Section VI(ii) he defines \\(\\nubar_6:S^{14}\\rightarrow S^6\\) ",
  "to be an element of the Toda bracket ",
  "\\(\\langle\\nu_6,\\eta_9,\\nu_{10}\\rangle_1\\).  We will let \\(\\nubar_6\\)",
  "denote the unique element of this Toda bracket that satisfies ",
  "\\(H(\\nubar_6)=\\nu_{11}\\).  This definition is validated in ",
  "the notes by Strickland. ",
  "We put \\(\\nubar_n=\\Sigma^{n-6}\\nubar_6\\) for \\(n\\geq 6\\)."
 ]
]

TodaBracketRepresentation[nubar[6]] = 
 TodaBracket[{nu[6],eta[8],nu[9]},1]
Indeterminacy[nubar[6]] = {}

DeclareFamily[
 mu,\[Mu],12,3,
 StringJoin[
  "The map \\(\\mu_3:S^{12}\\rightarrow S^3\\) is defined in Toda's ",
  "Section VI(iii) by a procedure of several steps, involving the cofibre ",
  "of the map \\(\\nu':S^6/8\\rightarrow S^3\\).  It turns out that the ",
  "indeterminacy is \\(\\{0,\\eta_3\\circ\\epsilon_4\\}\\) ",
  "(see the discussion preceeding Lemma 6.5, together with Theorem 7.1). ",
  "We also have ",
  "\\(\\pi_{12}S^3=\\Z_2\\mu_3\\oplus\\Z_2(\\eta_3\\circ\\epsilon_4)\\). ",
  "The element \\(\\eta_3\\circ\\epsilon_4\\) has Adams filtration 4, ",
  "and we make the unique choice of \\(\\mu_3\\) that has Adams ",
  "filtration 5. ",
  "We write \\(\\mu_k=\\Sigma^{k-3}\\mu_3\\) for \\(k\\geq 3\\). "
 ]
]

Indeterminacy[mu[3]] = {}

DeclareFamily[
 zeta,\[Zeta],16,5,
 StringJoin[
  "We define \\(\\zeta_5:S^{16}\\rightarrow S^5\\) to be the unique element ",
  "of the Toda bracket ",
  "\\(\\langle\\nu_5,8\\iota_8,\\Sigma\\sigma'\\rangle_1\\) that satisfies ",
  "\\(H(\\zeta_5)=8\\sigma_9\\) and \\(P(\\zeta_5)=\\pm\\eta_2\\circ\\mu'\\). ",
  "This is validated in the notes by Strickland, based on Toda's Section VI(v). ",
  "For \\(k\\geq 5\\) we put \\(\\zeta_k=\\Sigma^{k-5}\\zeta_5\\). "
 ]
]

TodaBracketRepresentation[zeta[5]] = 
 TodaBracket[{nu[5],8 iota[7],sigmaprime},1]
Indeterminacy[zeta[5]] = {}

DeclareFamily[
 kappa,\[Kappa],21,7,
 StringJoin[
  "The element \\(\\kappa_7:S^{21}\\rightarrow S^7\\) is defined in Toda's ",
  "Section X(i) as an element of a Toda bracket involving the Moore space ",
  "\\(S^9/2\\).  The indeterminacy is not given explicitly.  For \\(k\\geq 7\\) ",
  "we put \\(\\kappa_k=\\Sigma^{k-7}\\kappa_7\\)."
 ]
]

DeclareFamily[
 epsilonbar,OverBar[\[Epsilon]],18,3,
 StringJoin[
  "\\(\\epsilonbar_3:S^{18}\\rightarrow S^3\\) is the unique element of the Toda ",
  "bracket \\(\\langle \\epsilon_3,2\\iota_{5},\\nu_5\\circ\\nu_8\\rangle_6\\), ",
  "and the unique nonzero element of \\(\\pi_{18}^3\\).  See Toda's Section X(i) ",
  "and Theorem 10.5.  For \\(k\\geq 3\\) we put ",
  "\\(\\epsilonbar_k=\\Sigma^{k-3}\\epsilonbar_3\\). "
 ]
]

TodaBracketRepresentation[epsilonbar[3]] = 
 TodaBracket[{epsilon[3],2 iota[5],o[nu[5],nu[8]]},6]
Indeterminacy[epsilonbar[3]] = {}

DeclareFamily[
 rho,\[Rho],28,13,
 StringJoin[
  "\\(\\rho_{13}:S^{28}\\rightarrow S^{13}\\) is defined in Toda's Lemma 10.9 ",
  "by the properties \\(2\\rho_{13}=\\Sigma^4\\rho'\\) and ",
  "\\(\\Sigma^{\\infty}\\rho_{13}\\in\\langle\\sigma,2\\sigma,8\\iota\\rangle\\). ",
  "For \\(k\\geq 13\\) we put \\(\\rho_k=\\Sigma^{k-13}\\rho_{13}\\)."
 ]
]


DeclareFamily[
 zetabar,OverBar[\[Zeta]],24,5,
 StringJoin[
  "\\(\\zetabar_5:S^{24}\\rightarrow S^5\\) is an element of the Toda bracket ",
  "\\(\\langle\\zeta_5,8\\iota_{16},2\\sigma_{16}\\rangle_1\\). ",
  "See the preamble to Toda's Lemma 12.4. ",
  "For \\(k\\geq 5\\) we put \\(\\zetabar_k=\\Sigma^{k-5}\\zetabar_5\\)."
 ]
]

TodaBracketRepresentation[zetabar[5]] = 
 TodaBracket[{zeta[5],8 iota[15],2 sigma[15]},1]

DeclareFamily[
 sigmabar,OverBar[\[Sigma]],25,6,
 StringJoin[
  "\\(\\sigmabar_6:S^{25}\\rightarrow S^6\\) is an element of the Toda ",
  "bracket \\(\\langle\\nu_6,\\epsilon_9+\\nubar_9,\\sigma_{16}\\rangle_1\\). ",
  "See the preamble to Toda's Lemma 12.5. ",
  "For \\(k\\geq 6\\) we put \\(\\sigmabar_k=\\Sigma^{k-6}\\sigmabar_6\\)."
 ]
]

TodaBracketRepresentation[sigmabar[6]] = 
 TodaBracket[{nu[6],epsilon[8] + nubar[8],sigma[15]},1]

DeclareFamily[
 omega,\[Omega],30,14,
 StringJoin[
  "\\(\\omega_{14}:S^{30}\\rightarrow S^{14}\\) is defined in ",
  "Toda's Lemma 12.15(i) by the requirement that ",
  "\\(H(\\omega_{14})=\\nu_{27}\\).  The indeterminacy is ",
  "\\(\\{0,\\sigma_{14}\\circ\\mu_{21}\\}\\). ",
  "For \\(k\\geq 14\\) we put \\(\\omega_k=\\Sigma^{k-14}\\omega_{14}\\)."
 ]
]

Indeterminacy[omega[14]] = {o[sigma[14],mu[21]]}

DeclareFamily[
 etastar,Superscript[\[Eta],"*"],32,16,
 StringJoin[
  "\\(\\eta_{16}^{*}:S^{32}\\rightarrow S^{16}\\) is an element of the ",
  "Toda bracket ",
  "\\(\\langle\\sigma_{16},2\\sigma_{23},\\eta_{30}\\rangle_1\\). ",
  "See Toda's Section XII(iii). ",
  "For \\(k\\geq 16\\) we put \\(\\eta_{k}^{*}=\\Sigma^{k-16}\\eta_{16}^{*}\\).  ",
  "For \\(k\\geq 18\\) we have \\(\\eta_{k}^{*}=\\omega_{k}\\) modulo ",
  "\\({\\sigma_{k}}\\circ{\\mu_{k+7}}\\), so either \\(\\eta_{k}^{*}\\) or ",
  "\\(\\omega_{k}\\) can be used as a generator of \\(\\pi_{k+16}^{k}\\)."
 ]
]

TodaBracketRepresentation[etastar[16]] = 
 TodaBracket[{sigma[16],2 sigma[22],eta[29]},1]

DeclareFamily[
 epsilonstar,Superscript[\[Epsilon],"*"],29,12,
 StringJoin[
  "\\(\\epsilon_{12}^{*}:S^{29}\\rightarrow S^{12}\\) is defined in Toda's ",
  "Lemma 12.15(ii) by the properties ",
  "\\(H(\\epsilon_{12}^{*})=\\nu_{23}\\circ\\nu_{27}\\) and ",
  "\\(\\Sigma^2\\epsilon_{12}^{*}=\\omega_{14}\\circ\\eta_{30}\\). ",
  "This fixes \\(\\epsilon_{12}^{*}\\) as a function of ",
  "\\(\\omega_{14}\\).  However, the indeterminacy of ",
  "\\(\\sigma_{14}\\circ\\mu_{21}\\) in \\(\\omega_{14}\\) creates an indeterminacy ",
  "of \\(\\sigma_{12}\\circ\\eta_{19}\\circ\\mu_{20}\\) in \\(\\epsilon_{12}^{*}\\). ",
  "For \\(k\\geq 12\\) we put \\(\\epsilon_{k}^{*}=\\Sigma^{k-12}\\epsilon^{*}_{12}\\)."
 ]
]

DeclareFamily[
 mubar,OverBar[mu],20,3,
 StringJoin[
  "\\(\\mubar_3:S^{20}\\rightarrow S^3\\) is defined in the preamble to ",
  "Toda's Lemma 12.2 to be an element of the Toda bracket ",
  "\\(\\langle\\mu_3,2\\iota_{12},8\\sigma_{12}\\rangle_1\\). ",
  "I have not checked the indeterminacy. ",
  "For \\(k\\geq 3\\) we put \\(\\mubar_{k}=\\Sigma^{k-3}\\mubar_3\\). "
 ]
]

TodaBracketRepresentation[mubar[3]] = 
 TodaBracket[{mu[3],2 iota[11],8 sigma[11]},1]

DeclareFamily[
 nustar,Superscript[\[Nu],"*"],34,16,
 StringJoin[
  "\\(\\nu^*_{16}:S^{34}\\rightarrow S^{16}\\) is defined in Toda's ",
  "Section XII(iii) to be an element of the Toda bracket ",
  "\\(\\langle\\sigma_{16},2\\sigma_{23},\\nu_{30}\\rangle_1\\).  ",
  "I have not checked the indeterminacy. ",
  "For \\(k\\geq 16\\) we put \\(\\nu^*_{k}=\\Sigma^{k-16}\\nu^*_{16}\\). "
 ]
]

TodaBracketRepresentation[nustar[16]] = 
 TodaBracket[{sigma[16],2 sigma[22],nu[29]},1]

DeclareFamily[
 xi,\[Xi],30,12,
 StringJoin[
  "\\(\\xi_{12}:S^{30}\\rightarrow S^{12}\\) is defined in Toda's ",
  "Section XII(iii) to be an element of the Toda bracket ",
  "\\(\\langle\\sigma_{12},\\nu_{19},\\sigma_{22}\\rangle_1\\).  ",
  "I have not checked the indeterminacy. ",
  "For \\(k\\geq 12\\) we put \\(\\xi_{k}=\\Sigma^{k-12}\\xi_{16}\\). "
 ]
]

TodaBracketRepresentation[xi[12]] = 
 TodaBracket[{sigma[12],nu[18],sigma[21]},1]

DeclareElement[
 nuprime,\[Nu]',6,3,
 StringJoin[
  "\\(\\nu'\\) is an element of the Toda bracket ",
  "\\(\\langle\\nu_3,2\\iota_4,\\eta_4\\rangle_1\\).  I think it is also ",
  "obtained by applying the unstable J-homomorphism to the generator of ",
  "\\(\\pi_3SO(3)\\).  Toda's definition is indeterminate up to sign. ",
  "See Toda's Equations 5.3 and 5.4. "
 ]
]

TodaBracketRepresentation[nuprime] = 
 TodaBracket[{eta[3],2 iota[3],eta[3]},1]
Indeterminacy[nuprime] = {2 nuprime}

DeclareElement[
 sigmathird,\[Sigma]''',12,5,
 StringJoin[
  "\\(\\sigma''':S^{12}\\rightarrow S^5\\) is the unique element of the Toda bracket ",
  "\\(\\langle\\nu_5,8\\iota_8,\\nu_8\\rangle\\), and is the unique nonzero element ",
  "in \\(\\pi_{12}S^5\\).  See Toda's Lemma 5.13.  "
 ]
]

TodaBracketRepresentation[sigmathird] = 
 TodaBracket[{nu[5],8 iota[8],nu[8]},0]

Indeterminacy[sigmathird] = {}

DeclareElement[
 sigmasecond,\[\Sigma]'',13,6,
 StringJoin[
  "\\(\\sigma'':S^{13}\\rightarrow S^6\\) is characterised by the properties ",
  "\\(H(\\sigma'')=\\eta_{11}^2\\) and \\(\\Sigma^3\\sigma''=4\\sigma_9\\). ",
  "It has order \\(4\\) and generates \\(\\pi_{13}S^6\\).  See Toda's ",
  "Lemma 5.14 (corrected by replacing \\(\\sigma''\\) by \\(sigma'\\) on ",
  "the second line), and note that ",
  "\\(\\Sigma^3:\\pi_{13}^6\\rightarrow\\pi_{16}^9\\) is injective."
 ]
]

Indeterminacy[sigmasecond] = {}

DeclareElement[
 sigmaprime,\[\Sigma]',14,7,
 StringJoin[
  "\\(\\sigma':S^{14}\\rightarrow S^7\\) is characterised by the properties ",
  "\\(H(\\sigma')=\\eta_{13}\\) and \\(\\Sigma^2\\sigma'=2\\sigma_9\\). ",
  "It has order \\(8\\) and generates \\(\\pi_{14}S^7\\).  See Toda's ",
  "Lemma 5.14 (corrected by replacing \\(\\sigma''\\) by \\(sigma'\\) on ",
  "the second line), and note that ",
  "\\(\\Sigma^2:\\pi_{14}^7\\rightarrow\\pi_{16}^9\\) is injective."
 ]
]

Indeterminacy[sigmaprime] = {}

DeclareElement[
 epsilonprime,\[Epsilon]',13,3,
 StringJoin[
  "\\(\\epsilon':S^{13}\\rightarrow S^3\\) is the unique element of the Toda ",
  "bracket \\(\\langle\\nu',2\\nu_6,\\nu_9\\rangle_3\\).  ",
  "See Toda, Section VI(iv)."
 ]
]

TodaBracketRepresentation[epsilonprime] = 
 TodaBracket[{nuprime,nuprime,nu[6]},3]

Indeterminacy[epsilonprime] = {}

DeclareElement[
 muprime,\[Mu]',14,3,
 StringJoin[
  "The element \\(\\mu':S^{14}\\rightarrow S^3\\) lies in the Toda bracket ",
  "\\(\\langle\\eta_3,2\\iota_4,\\mu_4\\rangle_1\\) and satisfies ",
  "\\(H(\\mu')=\\mu_5\\) and \\(2\\mu'=\\eta_3\\circ\\eta_4\\circ\\mu_5\\); ",
  "this is explained at the beginning of Toda's ",
  "Section VII(ii).  Toda does not state the indeterminacy and I have not ",
  "worked it out."
 ]
]

TodaBracketRepresentation[muprime] =
 TodaBracket[{eta[3],2 iota[3],mu[3]},1]

DeclareElement[
 thetaprime,\[Theta]',23,11,
 StringJoin[
  "\\(\\theta':S^{23}\\rightarrow S^{11}\\) is the unique element of the ",
  "Toda bracket \\(\\langle\\sigma_{11},2\\nu_{18},\\eta_{21}\\rangle_1\\) ",
  "and the unique nonzero element of \\(\\pi_{23}^{11}\\).  See ",
  "Toda's Lemma 7.5."
 ]
]

TodaBracketRepresentation[thetaprime] = 
 TodaBracket[{sigma[11],2 nu[17],eta[20]},1]
Indeterminacy[thetaprime] = {}

DeclareElement[
 theta,\[Theta],24,12,
 StringJoin[
  "\\(\\theta:S^{24}\\rightarrow S^{12}\\) lies in the Toda bracket ",
  "\\(\\langle\\sigma_{12},\\nu_{19},\\eta_{22}\\rangle_1\\). ",
  "It is not clear whether the indeterminacy is zero."
 ]
]

TodaBracketRepresentation[theta] = 
 TodaBracket[{sigma[12],nu[18],eta[21]},1]

DeclareElement[
 rhofourth,\[Rho]'''',20,5,
 StringJoin[
  "\\(\\rho^{(4)}:S^{20}\\rightarrow S^5\\) is defined in Toda's ",
  "Section X(iii) to be an element of the Toda bracket ",
  "\\(\\langle\\sigma^{(3)},2\\iota_{12},8\\sigma_{12}\\rangle_1\\). ",
  "It is proved in the notes by Strickland that the indeterminacy is zero. "
 ]
]

TodaBracketRepresentation[rhofourth] = 
 TodaBracket[{sigmathird,2 iota[11],8 sigma[11]},1]
Indeterminacy[rhofourth] = {}

DeclareElement[
 rhothird,\[Rho]''',21,6,
 StringJoin[
  "\\(\\rho^{(3)}:S^{21}\\rightarrow S^6\\) is defined in Toda's ",
  "Section X(iii) to be an element of the Toda bracket ",
  "\\(\\langle\\sigma'',4\\iota_{13},4\\sigma_{13}\\rangle_1\\)."
 ]
]

TodaBracketRepresentation[rhothird] = 
 TodaBracket[{sigmasecond,4 iota[12],4 sigma[12]},1]

DeclareElement[
 rhosecond,\[Rho]'',22,7,
 StringJoin[
  "\\(\\rho'':S^{22}\\rightarrow S^7\\) is defined in Toda's ",
  "Section X(iii) to be an element of the Toda bracket ",
  "\\(\\langle\\sigma',8\\iota_{14},2\\sigma_{14}\\rangle_1\\). ",
  "We will take it to be the unique element for which ",
  "\\(H(\\rho'')=\\mu_{13}\\).  This is validated in the ",
  "notes by Strickland, prop-rho-second."
 ]
]

TodaBracketRepresentation[rhosecond] = 
 TodaBracket[{sigmaprime,8 iota[13],2 sigma[13]},1]

DeclareElement[
 rhoprime,\[Rho]',24,9,
 StringJoin[
  "\\(\\rho':S^{24}\\rightarrow S^9\\) is defined in Toda's ",
  "Section X(iii) to be an element of the Toda bracket ",
  "\\(\\langle\\sigma_9,16\\iota_{16},\\sigma_{16}\\rangle_1\\)."
 ]
]

TodaBracketRepresentation[rhoprime] = 
 TodaBracket[{sigma[9],16 iota[15],sigma[15]},1]

DeclareElement[
 zetaprime,\[Zeta]',22,6,
 StringJoin[
  "\\(\\zeta':S^{22}\\rightarrow S^6\\) is the unique element such that ",
  "\\(H(\\zeta')=\\zeta_{11} mod 2\\zeta_{11}\\) and ",
  "\\(\\Sigma\\zeta'=\\sigma'\\circ\\eta_{14}\\circ\\epsilon_{15}\\). ",
  "This is validated in the notes by Strickland, prop-zetaprime, which ",
  "refines Toda's Lemma 12.1."
 ]
]

Indeterminacy[zetaprime] = {}

DeclareElement[
 epsilonbarprime,OverBar[\[Epsilon]]',20,3,
 StringJoin[
  "\\(\\epsilonbar':S^{20}\\rightarrow S^3\\) is defined in Toda's ",
  "Lemma 12.3 by the properties ",
  "\\(2\\epsilonbar'=\\eta_{3}\\circ\\eta_{4}\\circ\\epsilonbar_5\\) ",
  "and \\(\\Sigma\\epsilonbar'=(\\Sigma\\nu')\\circ\\kappa_{7}\\). ",
  "The map \\(\\Sigma\\) here is injective by Toda's Theorem 12.7, ",
  "so this characterises \\(\\epsilonbar'\\) uniquely. "
 ]
]

DeclareElement[
 mubarprime,OverBar[\[Mu]]',22,3,
 StringJoin[
  "\\(\\mubar':S^{22}\\rightarrow S^3\\) is an element of the Toda ",
  "bracket \\(\\langle\\mu',4\\iota_{14},4\\sigma_{14}\\rangle_1\\). ",
  "See the preamble to Toda's Lemma 12.4. "
 ]
]

TodaBracketRepresentation[mubarprime] = 
 TodaBracket[{muprime,4 iota[13],4 sigma[13]},1]

DeclareElement[
 etastarprime,Superscript[\[Eta],"*"]',31,15,
 StringJoin[
  "\\({\\eta^*}':S^{31}\\rightarrow S^{15}\\) is an element of the ",
  "Toda bracket ",
  "\\(\\langle\\sigma_{15},4\\sigma_{22},\\eta_{29}\\rangle_1\\). ",
  "(There seems to be a filtration shift so this is not seen in Ext.) ",
  "See Toda's Section XII(iii). "
 ]
]

TodaBracketRepresentation[etastarprime] = 
 TodaBracket[{sigma[15],4 sigma[21],eta[28]},1]

DeclareElement[
 lambdasecond,\[Lambda]'',28,10,
 StringJoin[
  "\\(\\lambda'':S^{28}\\rightarrow S^{10}\\) is defined in Toda's ",
  "Lemma 12.19 by the properties ",
  "\\(\\Sigma\\lambda''=2\\lambda'\\) and ",
  "\\(H(\\lambda'')=\\eta_{19}\\circ\\epsilon_{20} mod ",
  "(\\eta_{19}\\circ\\epsilon_{20} + \\nu^3_{19}) \\).  ",
  "I have not checked the indeterminacy. "
 ]
]

DeclareElement[
 xisecond,\[Xi]'',28,10,
 StringJoin[
  "\\(\\xi'':S^{28}\\rightarrow S^{10}\\) is defined in Toda's ",
  "Lemma 12.19 by the properties ",
  "\\(\\Sigma\\xi''=2\\xi'\\) and ",
  "\\(H(\\xi'')=\\nu_{19}\\circ\\nu_{22}\\circ\\nu_{25}+\\eta_{13}\\circ\\epsilon_{20}\\). ",
  "I have not checked the indeterminacy. "
 ]
]

DeclareElement[
 lambdaprime,\[Lambda]',29,11,
 StringJoin[
  "\\(\\lambda':S^{29}\\rightarrow S^{11}\\) is defined in Toda's ",
  "Lemma 12.19 by the properties ",
  "\\(\\Sigma^2\\lambda'=2\\lambda\\) and ",
  "\\(H(\\lambda')=\\epsilon_{21} mod (\\nubar_{21}+\\epsilon_{21})\\). ",
  "I have not checked the indeterminacy. "
 ]
]

DeclareElement[
 xiprime,\[Xi]',29,11,
 StringJoin[
  "\\(\\xi':S^{29}\\rightarrow S^{11}\\) is defined in Toda's ",
  "Lemma 12.19 by the properties ",
  "\\(\\Sigma\\xi'=2\\xi_{12}\\pm w_{12}\\circ\\sigma_{23}\\) and ",
  "\\(H(\\xi')=\\nubar_{21}+\\epsilon_{21}\\). ",
  "I have not checked the indeterminacy. "
 ]
]

DeclareElement[
 lambda,\[Lambda],31,13,
 StringJoin[
  "\\(\\lambda:S^{31}\\rightarrow S^{13}\\) is defined in Toda's ",
  "Lemma 12.18 by the properties ",
  "\\(\\Sigma^3\\lambda=2\\nu^*_{16}\\pm w_{16}\\circ\\nu_{31}\\) and ",
  "\\(H(\\lambda)=\\nu_{25}\\circ\\nu_{28}\\). ",
  "I have not checked the indeterminacy. "
 ]
]

DeclareElement[
 omegaprime,\[Omega]',31,12,
 StringJoin[
  "\\(\\omega':S^{31}\\rightarrow S^{12}\\) is defined in Toda's ",
  "Lemma 12.21 by the properties ",
  "\\(\\Sigma^2\\omega'=2\\omega_{14}\\circ\\nu_{30}\\) and ",
  "\\(H(\\omega')=\\epsilon_{23} mod (\\nubar_{23}+\\epsilon_{23})\\). ",
  "I have not checked the indeterminacy. "
 ]
]

(************************************************************************)

(* Orders of elements                                                   *)

AddOrderRule[
 w[n_],2,OddQ[n],"Anticommutativity of the Whitehead product"
]

(* 1-stem *)
SetStableOrder[eta,2,3,"Toda, Proposition 5.1"]

(* 2-stem *)
Module[{n,m},AddOrderRule[
 o[eta[n_], eta[m_]], 
 2, 
 m == n + 1, 
 TeXToMath["\\(2\\eta_n\\circ\\eta_{n+1}=0\\) for \\(n\\geq 2\\)"],
 "Toda, Proposition 5.3"]
]

(* 3-stem *)
SetOrder[o[eta[2],eta[3],eta[4]],2,"Toda, Proposition 5.6"]
SetOrder[nuprime,4,"Toda, Proposition 5.6"]
SetOrder[Sigma[nuprime],4,"Toda, Proposition 5.6"]
SetStableOrder[nu,8,5,"Toda, Proposition 5.6"]

(* 4-stem *)
SetOrder[o[eta[2],nuprime],4,"Toda, Proposition 5.8"]
SetOrder[o[nuprime,eta[6]],2,"Toda, Proposition 5.8"]
SetOrder[o[Sigma[nuprime],eta[7]],2,"Toda, Proposition 5.8"]
Module[{n,m},
 AddOrderRule[
  o[nu[n_],eta[m_]],
  2,
  m == n+3,
  TeXToMath["\\(2\\nu_n\\circ\\eta_{n+3}=0\\) for \\(n\\geq 2\\)"],
  "Toda, Proposition 5.8"]]

(* 5-stem *)
SetOrder[o[eta[2],nuprime,eta[6]],2,"Toda, Proposition 5.9"]
SetOrder[o[nuprime,eta[6],eta[7]],2,"Toda, Proposition 5.9"]
SetOrder[o[Sigma[nuprime],eta[7],eta[8]],2,"Toda, Proposition 5.9"]
SetOrder[o[nu[4],eta[7],eta[8]],2,"Toda, Proposition 5.9"]
SetOrder[o[nu[5],eta[8],eta[9]],2,"Toda, Proposition 5.9"]

(* 6-stem *)
SetOrder[o[eta[2],nuprime,eta[6],eta[7]],2,"Toda, Proposition 5.11"]
SetOrder[o[nu[4],nu[7]],8,"Toda, Proposition 5.11"]
Module[{n,m},
 AddOrderRule[
  o[nu[n_],nu[m_]],
  2,
  (n >= 5) && (m == n+3),
  TeXToMath["\\(2\\nu_n\\circ\\nu_{n+3}=0\\) for \\(n\\geq 5\\)"],
  "Toda, Proposition 5.11"]]

(* 7-stem *)
SetOrder[sigmathird,2,"Toda, Proposition 5.15"]
SetOrder[sigmasecond,  4,"Toda, Proposition 5.15"]
SetOrder[sigmaprime,8,"Toda, Proposition 5.15"]
SetOrder[Sigma[sigmaprime],8,"Toda, Proposition 5.15"]
SetStableOrder[sigma,16,9,"Toda, Proposition 5.15"]

(* 8-stem *)
SetStableOrder[epsilon,2,3,"Toda, Theorem 7.1"]
SetOrder[nubar[6],8,"Toda, Theorem 7.1"]
SetStableOrder[nubar,2,7,"Toda, Theorem 7.1"]
SetOrder[o[sigmaprime,eta[14]],2,"Toda, Theorem 7.1"]
SetOrder[o[Sigma[sigmaprime],eta[15]],2,"Toda, Theorem 7.1"]
SetOrder[o[sigma[8],eta[15]],2,"Toda, Theorem 7.1"]
SetOrder[o[sigma[9],eta[16]],2,"Toda, Theorem 7.1"]

(* 9-stem *)
Module[{n,m},
 AddOrderRule[
  o[eta[n_],epsilon[m_]], 2, m == n+1,
  TeXToMath["\\(2\\eta_n\\circ\\epsilon_{n+1}=0\\) for \\(n\\geq 2\\)"],
  "Toda, Theorem 7.2"]]
SetStableOrder[mu,2,3,"Toda, Theorem 7.2"]
Module[{n,m,p},
 AddOrderRule[
  o[nu[n_],nu[m_],nu[p_]], 2,(m == n+3) && (p == m+3),
  TeXToMath["\\(2(\\nu_n\\circ\\nu_{n+3}\\circ\\nu_{n+6})=0\\) for \\(n\\geq 4\\)"],
  "Toda, Theorem 7.2"]]
SetOrder[o[sigmaprime,eta[14],eta[15]],2,"Toda, Theorem 7.2"]
SetOrder[o[Sigma[sigmaprime],eta[15],eta[16]],2,"Toda, Theorem 7.2"]
SetOrder[o[sigma[8],eta[15],eta[16]],2,"Toda, Theorem 7.2"]
SetOrder[o[sigma[9],eta[16],eta[17]],2,"Toda, Theorem 7.2"]

(* 10-stem *)

SetOrder[o[eta[2],eta[3],epsilon[4]],2,"Toda, Theorem 7.3"]
Module[{n,m},
 AddOrderRule[o[eta[n_],mu[m_]],2,m == n+1,
 TeXToMath["\\(2\\eta_n\\circ\\mu_{n+1}=0\\) for \\(n\\geq 2\\)"],
 "Toda, Theorem 7.3"]]
SetOrder[epsilonprime,4,"Toda, Theorem 7.3"]
SetOrder[Sigma[epsilonprime],4,"Toda, Theorem 7.3"]
SetOrder[o[nu[ 4],sigmaprime],8,"Toda, Theorem 7.3"]
SetOrder[o[nu[ 5],sigma[ 8]],8,"Toda, Theorem 7.3"]
SetOrder[o[nu[ 6],sigma[ 9]],8,"Toda, Theorem 7.3"]
SetOrder[o[nu[ 7],sigma[10]],8,"Toda, Theorem 7.3"]
SetOrder[o[nu[ 8],sigma[11]],8,"Toda, Theorem 7.3"]
SetOrder[o[sigma[ 8],nu[15]],8,"Toda, Theorem 7.3"]
SetOrder[o[sigma[ 9],nu[16]],8,"Toda, Theorem 7.3"]
SetOrder[o[sigma[10],nu[17]],4,"Toda, Theorem 7.3"]
SetOrder[o[sigma[11],nu[18]],2,"Toda, Theorem 7.3"]

(* 11-stem *)
SetOrder[o[eta[2],epsilonprime],4,"Toda, Theorem 7.4"]
SetOrder[o[eta[2],eta[3],mu[4]],2,"Toda, Theorem 7.4"]
SetOrder[muprime,4,"Toda, Theorem 7.4"]
SetOrder[Sigma[muprime],4,"Toda, Theorem 7.4"]
SetOrder[o[epsilon[3],nu[11]],2,"Toda, Theorem 7.4"]
SetOrder[o[epsilon[4],nu[12]],2,"Toda, Theorem 7.4"]
SetOrder[o[nuprime,epsilon[6]],2,"Toda, Theorem 7.4"]
SetOrder[o[Sigma[nuprime],epsilon[7]],2,"Toda, Theorem 7.4"]
SetOrder[o[nu[4],sigmaprime,eta[14]],2,"Toda, Theorem 7.4"]
SetOrder[o[nu[ 4],nubar[7]],2,"Toda, Theorem 7.4"]
SetOrder[o[nu[ 5],nubar[8]],2,"Toda, Theorem 7.4"]
SetOrder[o[nu[ 4],epsilon[7]],2,"Toda, Theorem 7.4"]
SetOrder[o[nu[ 5],epsilon[8]],2,"Toda, Theorem 7.4"]
SetStableOrder[zeta,8,5,"Toda, Theorem 7.4"]
SetOrder[o[nubar[ 6],nu[14]],4,"Toda, Theorem 7.4"]
SetOrder[o[nubar[ 7],nu[15]],2,"Toda, Theorem 7.4"]
SetOrder[o[nubar[ 8],nu[16]],2,"Toda, Theorem 7.4"]
SetOrder[o[nubar[ 9],nu[17]],2,"Toda, Theorem 7.4"]
SetOrder[o[nu[5],sigma[8],eta[15]],2,
 "\\(\\alpha\\circ\\eta_n\\) is always killed by 2 when \\(n>2\\)."
]

(* 12-stem *)
SetOrder[o[eta[2],muprime],4,"Toda, Theorem 7.6"]
SetOrder[o[eta[2],epsilon[3],nu[11]],2,"Toda, Theorem 7.6 and Equations 7.12"]
SetOrder[o[eta[2],nuprime,epsilon[6]],2,"Toda, Theorem 7.6"]
SetOrder[o[nuprime,mu[6]],2,"Toda, Theorem 7.6"]
SetOrder[o[nuprime,eta[6],epsilon[7]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[4],sigmaprime,eta[14],eta[15]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[4],nu[7],nu[10],nu[13]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[4],mu[7]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[4],eta[7],epsilon[8]],2,"Toda, Theorem 7.6"]
SetOrder[o[Sigma[nuprime],mu[7]],2,"Toda, Theorem 7.6"]
SetOrder[o[Sigma[nuprime],eta[7],epsilon[8]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[5],nu[8],nu[11],nu[14]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[5],mu[8]],2,"Toda, Theorem 7.6"]
SetOrder[o[nu[5],eta[8],epsilon[9]],2,"Toda, Theorem 7.6"]
SetOrder[o[w[6],sigma[11]],16,"Toda, Theorem 7.6"]
SetOrder[o[w[10],nu[19]],4,"Toda, Theorem 7.6"]
SetOrder[thetaprime,2,"Toda, Theorem 7.6"]
SetOrder[Sigma[thetaprime],2,"Toda, Theorem 7.6"]
SetOrder[theta,2,"Toda, Theorem 7.6"]
SetOrder[Sigma[theta],2,"Toda, Theorem 7.6"]

(* 13-stem *)

SetOrder[o[eta[2],nuprime,mu[6]],2,"Toda, Theorem 7.7"]
SetOrder[o[eta[2],nuprime,eta[6],epsilon[7]],2,"Toda, Theorem 7.7"]
SetOrder[o[nuprime,eta[6],mu[7]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[4],nu[7],sigma[10]],8,
 "Toda, Theorem 7.7.  Note that Toda refers to
  \\(\\nu_4^2\\circ\\sigma_8=\\nu_4\\circ\\nu_7\\circ\\sigma_8\\) 
  instead of \\(\\nu_4^2\\circ\\sigma_{10}\\).  This is not
  dimensionally consistent, and is a typo.
 "]
SetOrder[o[nu[4],eta[7],mu[8]],2,"Toda, Theorem 7.7"]
SetOrder[o[Sigma[nuprime],eta[7],mu[8]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[5],sigma[ 8],nu[15]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[6],sigma[ 9],nu[16]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[7],sigma[10],nu[17]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[8],sigma[11],nu[18]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[5],eta[8],mu[9]],2,"Toda, Theorem 7.7"]
SetOrder[o[sigma[ 8],nu[15],nu[18]],2,"Toda, Theorem 7.7"]
SetOrder[o[sigma[ 9],nu[16],nu[19]],2,"Toda, Theorem 7.7"]
SetOrder[o[sigma[10],nu[17],nu[20]],2,"Toda, Theorem 7.7"]
SetOrder[o[sigma[11],nu[18],nu[21]],2,"Toda, Theorem 7.7"]
SetOrder[o[nu[8],sigma[11],nu[18]],2,"Toda, Theorem 7.7"]
SetOrder[o[thetaprime,eta[23]],2,"Toda, Theorem 7.7"]
SetOrder[o[theta,eta[24]],2,"Toda, Theorem 7.7"]
SetOrder[o[Sigma[thetaprime],eta[24]],2,"Toda, Theorem 7.7"]
SetOrder[o[Sigma[theta],eta[25]],2,"Toda, Theorem 7.7"]

(* 14-stem *)

SetOrder[o[eta[2],nuprime,eta[6],mu[7]],2,"Toda, Theorem 10.3"]
SetOrder[o[epsilon[3],nu[11],nu[14]],2,"Toda, Theorem 10.3"]
SetOrder[o[epsilon[4],nu[12],nu[15]],2,"Toda, Theorem 10.3"]
SetOrder[o[nu[4],zeta[7]],8,"Toda, Theorem 10.3"]
SetOrder[o[nu[4],nubar[7],nu[15]],2,"Toda, Theorem 10.3"]
SetOrder[o[nu[5],zeta[8]],2,"Toda, Theorem 10.3"]
SetOrder[o[nu[5],nubar[8],nu[16]],2,"Toda, Theorem 10.3"]
SetOrder[o[sigmasecond,sigma[13]],4,"Toda, Theorem 10.3"]
SetOrder[o[nubar[6],nu[14],nu[17]],2,"Toda, Theorem 10.3"]
SetOrder[o[sigmaprime,sigma[14]],8,"Toda, Theorem 10.3"]
SetOrder[o[Sigma[sigmaprime],sigma[15]],8,"Toda, Theorem 10.3"]

SetOrder[kappa[7],4,"Toda, Theorem 10.3"]
SetOrder[kappa[8],4,"Toda, Theorem 10.3"]
SetOrder[kappa[9],4,"Toda, Theorem 10.3"]
SetStableOrder[kappa,2,10,"Toda, Theorem 10.3"]

SetOrder[o[sigma[ 8],sigma[15]],16,"Toda, Theorem 10.3"]
SetOrder[o[sigma[ 9],sigma[16]],16,"Toda, Theorem 10.3"]
SetOrder[o[sigma[10],sigma[17]],16,"Toda, Theorem 10.3"]
SetOrder[o[sigma[11],sigma[18]],16,"Toda, Theorem 10.3"]
SetOrder[o[sigma[12],sigma[19]],16,"Toda, Theorem 10.3"]
SetOrder[o[sigma[13],sigma[20]],16,"Toda, Theorem 10.3"]
SetOrder[o[sigma[14],sigma[21]],8,"Toda, Theorem 10.3"]
SetOrder[o[sigma[15],sigma[22]],4,"Toda, Theorem 10.3"]
Module[{n,m},
 AddOrderRule[o[sigma[n_],sigma[m_]],2,m == n+7 && n >= 16,
 TeXToMath["\\(2{\\sigma_n}\\circ{\\sigma_{n+7}}=0\\) for \\(n\\geq 16\\)"],
 "Toda, Theorem 10.3"]
]

SetOrder[o[w[12],nu[23]],4,"Toda, Theorem 10.3"]

(* 15-stem *)

SetStableOrder[epsilonbar,2,3,"Toda, Theorem 10.5"]
SetStableOrder[rho,32,13,"Toda, Theorem 10.10"]

SetOrder[o[eta[2],epsilon[3],nu[11],nu[14]],2,"Toda, Theorem 10.5"]
SetOrder[rhofourth,2,"Toda, Theorem 10.5"]
SetOrder[rhothird,4,"Toda, Theorem 10.5"]
SetOrder[rhosecond,8,"Toda, Theorem 10.5"]
SetOrder[Sigma[rhosecond],8,"Toda, Theorem 10.5"]
SetOrder[rhoprime,16,"Toda, Theorem 10.5"]
SetOrder[Sigma[rhoprime],16,"Toda, Theorem 10.5"]
SetOrder[Sigma[Sigma[rhoprime]],16,"Toda, Theorem 10.5"]
SetOrder[Sigma[Sigma[Sigma[rhoprime]]],16,"Toda, Theorem 10.5"]

SetOrder[o[sigmaprime,nubar[14]],2,"Toda, Theorem 10.5"]
SetOrder[o[Sigma[sigmaprime],nubar[15]],2,"Toda, Theorem 10.5"]
SetOrder[o[sigma[8],nubar[15]],2,"Toda, Theorem 10.5"]
SetOrder[o[sigma[9],nubar[16]],2,"Toda, Theorem 10.5"]
SetOrder[o[sigma[10],nubar[17]],2,"Toda, Theorem 10.5"]

SetOrder[o[sigmaprime,epsilon[14]],2,"Toda, Theorem 10.5"]
SetOrder[o[Sigma[sigmaprime],epsilon[15]],2,"Toda, Theorem 10.5"]
SetOrder[o[sigma[8],epsilon[15]],2,"Toda, Theorem 10.5"]
SetOrder[o[sigma[9],epsilon[16]],2,"Toda, Theorem 10.5"]

(* 16-stem *)

SetStableOrder[omega,2,15,"Toda, Theorem 12.16"]
SetStableOrder[etastar,2,16,"Toda, Theorem 12.16"]

Module[{n,m},AddOrderRule[
 o[mu[n_], sigma[m_]], 
 2, 
 m == n + 9 && n >= 3, 
 TeXToMath["\\(2\\mu_n\\circ\\sigma_{n+9}=0\\) for \\(n\\geq 3\\)"],
 StringJoin[
  "Toda, Theorem 12.6 (with the observation that stably we ",
  "have \\(\\mu\\sigma=\\sigma\\mu\\))."
 ]
]]

Module[{n,m},AddOrderRule[
 o[sigma[n_], mu[m_]], 
 2, 
 m == n + 7 && n >= 8, 
 TeXToMath["\\(2\\sigma_n\\circ\\mu_{n+7}=0\\) for \\(n\\geq 8\\)"],
 "Toda, Theorem 12.6"
 ]
]

Module[{n,m},AddOrderRule[
 o[eta[n_], epsilonbar[m_]], 
 2, 
 m == n + 1 && n >= 2 && n <= 8, 
 TeXToMath["\\(2\\eta_n\\circ\\epsilonbar_{n+1}=0\\) for \\(2\\leq n\\leq 8\\)"],
 "Toda, Theorem 12.6"
 ]
]

SetOrder[zetaprime,8,"Toda, Theorem 12.6"]
SetOrder[Sigma[zetaprime],2,"Toda, Theorem 12.6"]
SetOrder[Sigma[Sigma[zetaprime]],2,"Toda, Theorem 12.6"]
SetOrder[etastarprime,2,"Toda, Theorem 12.16"]
SetOrder[Sigma[etastarprime],2,"Toda, Theorem 12.16"]
SetOrder[o[sigmaprime,mu[14]],2,"Toda, Theorem 12.6"]
SetOrder[o[Sigma[sigmaprime],mu[15]],2,"Toda, Theorem 12.6"]
SetOrder[o[nu[4],nu[7],sigma[10],nu[17]],2,"Toda, Theorem 12.6"]
SetOrder[o[sigma[8],eta[15],epsilon[16]],2,"Toda, Theorem 12.6"]
SetOrder[o[sigma[9],eta[16],epsilon[17]],2,"Toda, Theorem 12.6"]
SetOrder[o[sigma[8],nu[15],nu[18],nu[21]],2,"Toda, Theorem 12.6"]
SetOrder[o[sigma[9],nu[16],nu[19],nu[22]],2,"Toda, Theorem 12.6"]
SetOrder[o[w[10],sigma[19]],16,"Toda, Theorem 12.16"]
SetOrder[omega[14],8,"Toda, Theorem 12.16"]

(* 17-stem *)


SetStableOrder[epsilonstar,2,12,"Toda, Theorem 12.17"]
SetStableOrder[mubar,2,3,"Toda, Theorem 12.7"]

SetOrder[epsilonbarprime,4,"Toda, Theorem 12.7"]
SetOrder[Sigma[epsilonbarprime],4,"Toda, Theorem 12.7"]
SetOrder[WhiteheadP[Sigma[theta]],2,"Toda, Theorem 12.8"]
SetOrder[o[etastarprime,eta[31]],2,"Toda, Theorem 12.17"]
SetOrder[o[Sigma[etastarprime],eta[32]],2,"Toda, Theorem 12.17"]
SetOrder[o[sigmaprime,eta[14],mu[15]],2,"Toda, Theorem 12.7"]
SetOrder[o[Sigma[sigmaprime],eta[15],mu[16]],2,"Toda, Theorem 12.7"]
SetOrder[o[eta[2],eta[3],epsilonbar[4]],2,"Toda, Theorem 12.7"]
SetOrder[o[etastar[16],eta[32]],2,"Toda, Theorem 12.17"]
SetOrder[o[etastar[17],eta[33]],2,"Toda, Theorem 12.17"]
SetOrder[o[nu[4],sigmaprime,sigma[14]],8,"Toda, Theorem 12.7"]
SetOrder[w[18],Infinity,"Toda, Theorem 12.17"]
SetOrder[o[nu[ 4],kappa[ 7]],4,"Toda, Theorem 12.7"]
SetOrder[o[nu[ 5],kappa[ 8]],4,"Toda, Theorem 12.7"]
SetOrder[o[nu[ 6],kappa[ 9]],4,"Toda, Theorem 12.7"]


Module[{m,n,p},
 AddOrderRule[
  o[eta[n_],mu[m_],sigma[p_]],2,(m == n+1) && (p == m+9),
  TeXToMath["\\(2\\eta_n\\circ\\mu_{n+1}\\circ\\sigma_{n+10}=0\\) for \\(n\\geq 2\\)"],
  "Toda, Theorem 12.7"]]


Module[{m,n},
 AddOrderRule[
  o[nu[n_],kappa[m_]],2, (m == n+3) && (n >= 8),
  TeXToMath["\\(2\\nu_n\\circ\\kappa_{n+3}=0\\) for \\(n\\geq 8\\)"],
  "Toda, Theorem 12.7"
 ]]

Module[{m,n,p},
 AddOrderRule[
  o[sigma[n_],eta[m_],mu[p_]],2, (m == n+7) && (p == m+1),
  TeXToMath["\\(2\\sigma_n\\circ\\eta_{n+7}\\circ\\mu_{n+8}=0\\) for \\(n\\geq 8\\)."],
  "Toda, Theorem 12.7"
 ]]

(* 18-stem *)

SetStableOrder[nustar,8,16,"Toda, Theorem 12.22"]
SetStableOrder[xi,8,13,"Toda, Theorem 12.22"]

SetOrder[xi[18]+nustar[18],4,"Toda, Theorem 12.22"]
SetOrder[xi[19]+nustar[19],2,"Toda, Theorem 12.22"]

SetOrder[lambdasecond,8,"Toda, Theorem 12.22"]
SetOrder[lambdaprime,8,"Toda, Theorem 12.22"]
SetOrder[Sigma[lambdaprime],4,"Toda, Theorem 12.22"]
SetOrder[lambda,8,"Toda, Theorem 12.22"]
SetOrder[Sigma[lambda],8,"Toda, Theorem 12.22"]
SetOrder[Sigma[Sigma[lambda]],8,"Toda, Theorem 12.22"]
SetOrder[Sigma[Sigma[Sigma[lambda]]],8,"Toda, Theorem 12.22"]
SetOrder[xisecond,2,"Toda, Theorem 12.22"]
SetOrder[xiprime,4,"Toda, Theorem 12.22"]
SetOrder[Sigma[xiprime],4,"Toda, Theorem 12.22"]
SetOrder[o[Sigma[muprime],sigma[15]],4,"Toda, Theorem 12.8"]
SetOrder[o[Sigma[nuprime],epsilonbar[7]],2,"Toda, Theorem 12.8"]
SetOrder[o[WhiteheadP[Sigma[theta]],eta[23]],2,"Toda, Theorem 12.8"]
SetOrder[o[eta[2],epsilonbarprime],4,"Toda, Theorem 12.8"]
SetOrder[o[eta[2],eta[3],mu[4],sigma[13]],2,"Toda, Theorem 12.8"]
SetOrder[o[muprime,sigma[14]],4,"Toda, Theorem 12.8"]
SetOrder[o[nu[4],epsilonbar[7]],2,"Toda, Theorem 12.8"]
SetOrder[o[nu[4],rhosecond],8,"Toda, Theorem 12.8"]
SetOrder[o[nu[4],sigmaprime,epsilon[14]],2,"Toda, Theorem 12.8"]
SetOrder[o[nu[4],sigmaprime,nubar[14]],2,"Toda, Theorem 12.8"]
SetOrder[o[nu[5],epsilonbar[8]],2,"Toda, Theorem 12.8"]
SetOrder[o[nuprime,epsilonbar[6]],2,"Toda, Theorem 12.8"]

SetOrder[o[sigma[8],zeta[15]],8,"Toda, Theorem 12.8"]
SetOrder[o[sigma[9],zeta[16]],8,"Toda, Theorem 12.8"]
SetOrder[o[zeta[5],sigma[16]],8,"Toda, Theorem 12.8"]
SetOrder[o[zeta[6],sigma[17]],8,"Toda, Theorem 12.8"]
SetOrder[o[zeta[7],sigma[18]],8,"Toda, Theorem 12.8"]
SetOrder[o[zeta[8],sigma[19]],8,"Toda, Theorem 12.8"]

SetOrder[xi[12],32,"Toda, Theorem 12.22"]

AddRelation[4 xi[18] -> 4 nustar[18],"Toda, Theorem 12.22"]
AddRelation[
 n_Integer xi[m_] :>
  2 Quotient[n,2] nustar[m] + Mod[n,2] xi[m] /; 
   (m >= 19) && (n < 0 || n > 1),
 TeXToMath["\\(2(\\xi_n+\\nu^*_n)=0\\) for \\(n\\geq 19\\)"],
 "Toda, Theorem 12.22"
]

Module[{m,n},
 AddOrderRule[
  o[eta[n_],mubar[m_]],2,m == n+1,
  TeXToMath["\\(2\\eta_n\\circ\\mubar_{n+1}=0\\) for \\(n\\geq 2\\)"],
  "Toda, Theorem 12.8"
 ]]
 

(* 19-stem *)

SetOrder[mubarprime,4,"Toda, Theorem 12.9"]
SetOrder[Sigma[mubarprime],4,"Toda, Theorem 12.9"]

SetOrder[omegaprime,2,"Toda, Theorem 12.23"]
SetOrder[Sigma[omegaprime],2,"Toda, Theorem 12.23"]

SetOrder[o[lambdaprime,eta[29]],2,"Toda, Theorem 12.23"]
SetOrder[o[Sigma[lambdaprime],eta[30]],2,"Toda, Theorem 12.23"]

SetOrder[o[nuprime,mu[6],sigma[15]],2,"Toda, Theorem 12.9"]
SetOrder[o[Sigma[nuprime],mu[7],sigma[16]],2,"Toda, Theorem 12.9"]
SetOrder[o[nu[4],mu[7],sigma[16]],2,"Toda, Theorem 12.9"]
SetOrder[o[nu[5],mu[8],sigma[17]],2,"Toda, Theorem 12.9"]

SetOrder[o[xiprime,eta[29]],2,"Toda, Theorem 12.23"]
SetOrder[o[Sigma[xiprime],eta[30]],2,"Toda, Theorem 12.23"]
SetOrder[o[xi[12],eta[30]],2,"Toda, Theorem 12.23"]
SetOrder[o[xi[13],eta[31]],2,"Toda, Theorem 12.23"]

SetOrder[o[eta[2],eta[3],mubar[4]],2,"Toda, Theorem 12.9"]
SetOrder[o[eta[2],muprime,sigma[14]],4,"Toda, Theorem 12.9"]
SetOrder[o[eta[2],nuprime,epsilonbar[6]],2,"Toda, Theorem 12.9"]

SetOrder[o[nu[4],Sigma[zetaprime]],2,"Toda, Theorem 12.9"]
SetOrder[o[nu[4],eta[7],epsilonbar[8]],2,"Toda, Theorem 12.9"]
SetOrder[o[nu[4],sigmaprime,mu[14]],2,"Toda, Theorem 12.9"]

SetOrder[o[omega[14],nu[30]],4,"Toda, Theorem 12.23"]
SetOrder[o[omega[15],nu[31]],2,"Toda, Theorem 12.23"]
SetOrder[o[omega[16],nu[32]],2,"Toda, Theorem 12.23"]
SetOrder[o[omega[17],nu[32]],2,"Toda, Theorem 12.23"]


SetOrder[sigmabar[6],32,"Toda, Theorem 12.9"]
SetStableOrder[sigmabar,2,7,"Toda, Theorem 12.9"]
SetStableOrder[zetabar,8,5,"Toda, Theorem 12.9"]

SetOrder[w[20],Infinity,"Toda, Theorem 12.9"]

(************************************************************************)
(* Here we give some information about orders of elements x that are    *)
(* chosen generators of the groups in which they live.  We hope to be   *)
(* able to write x in terms of standard generators, at which point this *)
(* information will become redundant.                                   *)

SetOrder[o[nu[9],sigma[12]],4,"Toda, Equations 7.20"]
SetOrder[o[nu[10],sigma[13]],2,"Toda, Equations 7.20"]
SetOrder[o[sigma[11],zeta[18]],2,"Toda, Equations 12.23"]
SetOrder[o[sigma[10],zeta[17]],4,"Toda, Equations 12.23"]


(************************************************************************)

AddRelation[epsilonstar[14] -> o[omega[14],eta[30]],"Toda, Lemma 12.15"]
AddRelation[
 etastar[n_] :> Coset[omega[n],{o[sigma[n],mu[n+7]]}] /; n >= 18,
 TeXToMath["\\(\\eta^*_n={\\omega_n} mod {\\sigma_n}\\circ{\\mu_{n+7}}\\) for \\(n\\geq 18\\)"],
 "Toda, Proposition 12.20(ii)"
]
AddRelation[
 xi[n_] :> - nustar[n] /; n >= 20,
 TeXToMath["\\(\\xi_n=-\\nu^*_n\\) for \\(n\\geq 20\\)"],
 "Toda, Corollary 12.25"
]

(************************************************************************)
(* Suspensions                                                          *)

AddRelation[
 Sigma[Sigma[nuprime]] -> 2 nu[5],
 "Toda, Lemma 5.4"
]

AddRelation[
 Sigma[sigmathird]  -> 2 sigmasecond,
 "Toda, Lemma 5.14"
]

AddRelation[
 Sigma[sigmasecond]    -> 2 sigmaprime,
 "Toda, Lemma 5.14"
]

AddRelation[
 Sigma[Sigma[sigmasecond]] -> 2 Sigma[sigma[8]],
 "Toda, Lemma 5.14"
]


AddRelation[
 Sigma[Sigma[sigmaprime]] -> 2 sigma[9],
 "In the proof of Toda's Lemma 5.14 we have
  \\(\\Sigma^2\\sigma'=2x\\Sigma\\alpha^*\\).  The final statement in the proof
  shows that \\(\\sigma_9=\\Sigma\\sigma_8=x\\Sigma\\alpha^*\\), so
  \\(\\Sigma^2\\sigma'=2\\sigma_9\\).
 "
]


AddRelation[
 Sigma[Sigma[epsilonprime]] -> 2 o[nu[5],sigma[8]],
 "Toda, Equations 7.10.  We have fudged a sign."
]

AddRelation[
 Sigma[Sigma[muprime]] -> 2 zeta[5],
 "Toda, Equations 7.14.  We have fudged a sign."
]

AddRelation[
 Sigma[Sigma[theta]] -> 0,
 "Toda, Equations 7.30 says that \\(\\Sigma\\theta\\) is in the image of P "
]

AddRelation[
 Sigma[Sigma[thetaprime]] -> 0,
 "Toda, Equations 7.30 says that \\(\\Sigma\\theta'\\) is in the image of P "
]


AddRelation[
 Sigma[Sigma[Sigma[Sigma[rhoprime]]]] -> 2 rho[13],
 "Toda, Lemma 10.9"
]

AddRelation[
 Sigma[Sigma[lambdaprime]] -> 2 lambda,
 "Toda, Lemma 12.19"
]

AddRelation[
 Sigma[Sigma[mubarprime]] -> 2 zetabar[5],
 "Toda, Lemma 12.4"
]

AddRelation[
 Sigma[Sigma[omegaprime]] -> 2 o[omega[14],nu[30]],
 "Toda, Equations 12.27"
]

AddRelation[
 Sigma[Sigma[omegaprime]] -> 2 o[omega[14],nu[30]],
 "Toda, Lemma 12.21"
]

AddRelation[
 Sigma[Sigma[rhosecond]] -> 2 rhoprime,
 "Toda, Remark before Lemma 10.7"
]

AddRelation[
 Sigma[lambdasecond] -> 2 lambdaprime,
 "Toda, Lemma 12.19"
]


AddRelation[
 Sigma[rhofourth] -> 2 rhothird,
 "Toda, Equations 10.15"
]

AddRelation[Sigma[rhothird] -> 2 rhosecond,
 "Toda, Equations 10.16"
]

AddRelation[
 Sigma[xisecond] -> 2 xiprime,
 "Toda, Lemma 12.19"
]

AddRelation[
 Sigma[Sigma[Sigma[zetaprime]]] -> 0,
 StringJoin[
  "Toda, Lemma 12.1 (together with the fact that \\(2\\pi_{23}^7=0\\)) ",
  "gives \\(\\Sigma\\zeta'=\\sigma'\\circ\\eta_{14}\\circ\\epsilon_{15}\\).  ",
  "We now suspend this twice and note that $\\Sigma^{2}\\sigma'=2\\sigma_9\\) ",
  "and \\(2\\eta_{16}=0\\) to get \\(\\Sigma^3\\zeta'=0\\). "
 ]
]

AddRelation[
 Sigma[Sigma[epsilonbarprime]] -> 2 o[nu[5],kappa[8]],
 StringJoin[
  "Suspend the relation ",
  "\\(\\Sigma{\\epsilonbar'}=(\\Sigma\\nu')\\circ\\kappa_7\\), ",
  "which is part of the definition of \\(\\epsilonbar'\\)."
 ]
]

(************************************************************************)

(* Composition                                                          *)

AddRelation[
 o[eta[3],eta[4],eta[5]] -> 2 nuprime,
 "Toda, Equations 5.3"
]

AddRelation[
 o[eta[4],eta[5],eta[6]] -> 2 Sigma[nuprime],
 "Toda, Equations 5.3"
]

Module[{k,l,m},AddRelation[
 o[eta[k_],eta[l_],eta[m_]] :>
  4 nu[k] /; l === k+1 && m === l+1 && k>=5,
 TeXToMath["\\({\\eta_k}\\circ{\\eta_{k+1}}\\circ{\\eta_{k+2}}=4\\nu_k\\) for \\(k\\geq 5\\)"],
 "Toda, Equations 5.5"
]]

AddRelation[
 o[eta[3],Sigma[nuprime]] -> 0,
 "Toda, Lemma 5.7"
]

Module[{n,m},AddRelation[
 o[eta[n_],nu[m_]] :> 0 /; m === n+1 && n >= 5,
 TeXToMath["\\({\\eta_n}\\circ{\\nu_{n+1}}=0\\) for \\(n\\geq 5\\)"],
 "Toda, Equations 5.9" 
]]

Module[{n,m},AddRelation[
 o[nu[n_],eta[m_]] :> 0 /; m === n+3 && n >= 6,
 TeXToMath["\\({\\nu_n}\\circ{\\eta_{n+3}}=0\\) for \\(n\\geq 6\\)"],
 "Toda, Equations 5.9" 
]]

AddRelation[
 o[nuprime,nu[6]] -> 0,
 "This is in \\(\\pi_9S^3=0\\) --- see Toda, Section V(vi)"
]

AddRelation[
 o[Sigma[nuprime],nu[7]] -> 0,
 "This is the suspension of the relation \\(\\nu'\\circ\\nu_6=0\\),
  which takes place in \\(\\pi_9S^3=0\\) --- see Toda, Section V(vi).
 "
]

Module[{n,m},AddRelation[
 o[epsilon[n_],nu[m_]] :> 0 /; m === n+8 && n>=5,
 TeXToMath["\\({\\epsilon_n}\\circ{\\nu_{n+8}}=0\\) for \\(n\\geq 5\\)"],
 "Toda's Equations 7.13 say that \\(\\epsilon_4\\circ\\nu_{12}=P(\\epsilon_9)\\),
  and we can suspend this to see that \\(\\epsilon_5\\circ\\nu_{13}=0\\).
 "
]]

AddRelation[
 o[sigmathird,eta[12]] -> 0,
 "Toda, Equations 7.4"
]

AddRelation[
 o[eta[3],Sigma[epsilonprime]] -> 0,
 "Notes by Strickland"
]

AddRelation[
 o[eta[5],sigmasecond] -> 0,
 "Toda, Equations 7.4"
]
 
AddRelation[
 o[eta[4],sigmathird] -> 0,
 "Toda, Equations 7.4"
]
 
AddRelation[
 o[eta[3],nu[4]] -> o[nuprime,eta[6]],
 "Toda, Equations 5.9"
]

AddRelation[
 o[eta[3],eta[4],epsilon[5]] -> 2 epsilonprime,
 "Toda, Lemma 6.6"
]

AddRelation[
 o[eta[3],eta[4],mu[5]] -> 2 muprime,
 "Toda, beginning of Section VII(ii)"
]

AddRelation[
 o[eta[4],eta[5],mu[6]] -> 2 Sigma[muprime],
 "Suspend the relation
  \\(\\eta_3\\circ\\eta_4\\circ\\mu_5=2\\mu'\\) given by 
  Toda at the beginning of Section VII(ii)
 "
]

AddRelation[
 o[eta[5],eta[6],mu[7]] -> 4 zeta[5],
 "Toda, proof of Equations 7.13"
]

AddRelation[
 o[eta[4],nu[5]] -> o[Sigma[nuprime],eta[7]],
 "Toda, Equations 5.9, suspended once"
]

AddRelation[
 o[nu[5],Sigma[sigmaprime]] -> 2 o[nu[5],sigma[8]],
 "Toda, Equations 7.16"
]

Module[{n,m},AddRelation[
 o[nubar[n_],eta[m_]] :> o[nu[n],nu[n+3],nu[n+6]] /; m === n+8 && n > 5,
 TeXToMath["\\({\\nubar_n}\\circ{\\eta_{n+8}}={\\nu_n}\\circ{\\nu_{n+3}}\\circ{\\nu_{n+6}}\\) for \\(n\\geq 6\\)"],
 "Toda, Lemma 6.3"
]]

Module[{n,m},AddRelation[
 o[eta[n_],nubar[m_]] :> o[nu[n],nu[n+3],nu[n+6]] /; m === n+1 && n > 5,
 TeXToMath["\\({\\eta_n}\\circ{\\nubar_{n+1}}={\\nu_n}\\circ{\\nu_{n+3}}\\circ{\\nu_{n+6}}\\) for \\(n\\geq 6\\)"],
 "Toda, Lemma 6.3"
]]

Module[{n,m},AddRelation[
 o[eta[n_],sigma[m_]] :> nubar[n] + epsilon[n] /; m === n+1 && n>8,
 TeXToMath["\\({\\eta_n}\\circ{\\sigma_{n+1}}=\\nubar_n+\\epsilon_n\\) for \\(n\\geq 9\\)"],
 "Toda, Lemma 6.4"
]]

Module[{n,m},AddRelation[
 o[sigma[n_],eta[m_]] :> nubar[n] + epsilon[n] /; m === n+7 && n>9,
 TeXToMath["\\({\\sigma_n}\\circ{\\eta_{n+7}}=\\nubar_n+\\epsilon_n\\) for \\(n\\geq 9\\)"],
 "Toda, Lemma 6.4"
]]


AddRelation[
 o[eta[3],eta[4],epsilon[5]] -> 2 epsilonprime,
 "Toda, Lemma 6.6"
]


AddRelation[
 o[eta[7],sigma[8]] -> o[sigmaprime,eta[14]] + nubar[7] + epsilon[7],
 "Toda, Equations 7.4"
]

AddRelation[
 o[eta[8],sigma[9]] ->
   o[Sigma[sigmaprime],eta[15]] + nubar[8] + epsilon[8],
 "Suspension of Toda's Equations 7.4"
]

AddRelation[
 o[eta[6],sigmaprime] -> 4 nubar[6],
 "Toda, Equations 7.4"
]

AddRelation[
 o[sigmasecond,eta[13]] -> 4 nubar[6],
 "Toda, Equations 7.4"
]

Module[{n,m},AddRelation[
 o[epsilon[n_],eta[m_]] :> o[eta[n],epsilon[n+1]] /; m === n+8,
 "Toda, Equations 7.5"
]]

Module[{n,m,p},AddRelation[
 o[eta[n_],eta[m_],epsilon[p_]] :> 4 o[nu[n],sigma[n+3]] /;
    m === n+1 && p === n+2 && n > 4,
 "Toda, Equations 7.10"
]]

AddRelation[
 o[nuprime,nubar[6]] -> o[epsilon[3],nu[11]],
 "Toda, Equations 7.12"
]

AddRelation[
 o[nuprime,w[6]] -> 0,
 "As \\(\\Sigma w_6=0\\) we have \\(\\Sigma(\\nu'\\circ w_6)=0\\),
  but \\(\\Sigma:\\pi_{11}^3=\\Z_2\\epsilon_3\\rightarrow\\pi_{12}^4=\\Z_2\\epsilon_4\\)
  is an isomorphism, so \\(\\nu'\\circ w_6=0\\).
 "
]

AddRelation[
 o[Sigma[nuprime],nubar[7]] -> o[epsilon[4],nu[12]],
 "Suspension of Toda's Equations 7.12"
]

AddRelation[
 o[epsilonprime,eta[13]] -> o[nuprime,epsilon[6]],
 "Toda, Equations 7.12"
]

AddRelation[
 o[Sigma[epsilonprime],eta[14]] -> o[Sigma[nuprime],epsilon[7]],
 "Toda, Equations 7.12"
]

AddRelation[
 o[nu[5],Sigma[sigmaprime],eta[15]] -> 0,
 "If \\(2y=0\\) and \\(y\\) is a suspension then
  \\((2x)\\circ y)=2(x\\circ y)=x\\circ(2y)=0\\).
  We have
  \\(\\nu_5\\circ\\Sigma\\sigma'=2\\nu_5\\circ\\sigma_8\\),
  and \\(\\eta_{15}\\) is a suspension and 
  \\(2\\eta_{15}=0\\).  It follows that 
  \\(\\nu_5\\circ\\Sigma\\sigma'\\circ\\eta_{15}=0\\).
 " 
]


Module[{m,n},AddRelation[
 o[nu[m_],epsilon[n_]] :> 2 o[nubar[m],nu[m+8]] /; n === m+3 && m >= 6,
 "Toda, Equations 7.18"
]]

Module[{m,n},AddRelations[
 o[nu[m_],nubar[n_]] :> 2 o[nubar[m],nu[m+8]] /; n === m+3 && m >= 6,
 "Toda, Equations 7.17 and 7.18"
]]

Module[{m,n},AddRelations[
 o[sigma[n_],nu[m_]] :> 0 /; m === n+7 && n >= 12,
 "Toda, Equations 7.20"
]]

Module[{m,n},AddRelations[
 o[nu[n_],sigma[m_]] :> 0 /; m === n+3 && n >= 11,
 "Toda, Equations 7.20"
]]

AddRelation[
 o[2 eta[2],epsilon[3]] -> 0,
 "Notes by Strickland"
]

AddRelation[
 o[2 eta[2],mu[3]] -> 0,
 "Notes by Strickland"
]

AddRelation[
 o[w[6],eta[11]] -> 0,
 "Apply P to the relation \\(H(\\sigma')=\\eta_{13}\\) in 
  Toda, Lemma 5.14
 "
]

AddRelation[
 o[w[6],nu[11]] -> 2 nubar[6],
 "Notes by Strickland"
]

AddRelation[
 o[eta[7],Sigma[sigmaprime]] -> 0,
 "Suspend the relation \\(\\eta_6\\circ\\sigma'=4\\nubar_6\\)"
]

Module[{m,n},AddRelation[
 o[mu[n_],eta[m_]] :> o[eta[n],mu[n+1]] /; m === n+9 && n >= 3,
 "Notes by Strickland"
]]

AddRelation[
 o[Sigma[nuprime],sigmaprime] -> 2Sigma[epsilonprime],
 "Notes by Strickland"
]

AddRelation[
 o[eta[4],eta[5],epsilon[6]] -> 2 Sigma[epsilonprime],
 "Suspend the relation
  \\(\\eta_3\\circ\\eta_4\\circ\\epsilon_5=2\\epsilon'\\) given
  by Toda, Lemma 6.6
 "
]

AddRelation[
 o[eta[8],eta[9],w[10]] -> 0,
 "This is in \\(\\pi_{19}^8\\), which is in the stable range,
  but it is killed by one suspension (because \\(\\Sigma w_{k}=0\\)
  for any \\(k\\)).
 "
]

AddRelation[
 o[nuprime,sigmasecond] -> 0,
 "Notes by Strickland"
]

AddRelation[
 o[nu[6],mu[9]] -> 8 o[w[6],sigma[11]],
 "Toda, Equations 7.25"
]

AddRelation[
 o[w[6],nubar[11]] -> 0,
 "Toda, Equations 7.27"
]

AddRelation[
 o[w[6],epsilon[11]] -> 0,
 "Toda, Equations 7.27"
]

AddRelation[
 o[w[12],eta[23]] -> Sigma[thetaprime],
 "Toda, Equations 7.30"
]

AddRelation[
 o[nu[7],zeta[10]] -> 4 o[sigmaprime,sigma[14]],
 "Toda, Lemma 9.2"
]

AddRelation[
 o[epsilonprime,nu[13]] -> 0,
 "Notes by Strickland"
]

AddRelation[
 o[nu[6],zeta[9]] -> 2 o[sigmasecond,sigma[13]],
 "Toda, Equations 10.7"
]

AddRelation[
 o[Sigma[theta],eta[25],eta[26]] -> 8 o[sigma[13],sigma[20]],
 StringJoin[
  "We have \\(\\Sigma\\theta=P(\\iota_{27})=w_{13}\\) by Toda's Equations 7.30, so ",
  "\\((\\Sigma\\theta)\\circ\\eta_{25}\\circ\\eta_{26}=P(\\eta_{25}\\circ\\eta_{26})\\), ",
  "and this is the same as \\(8\\sigma_{13}\\circ\\sigma_{20}\\) by ",
  "Toda's Equations 10.10."
 ]
]

AddRelation[o[w[14],eta[27]] -> 4 o[sigma[14],sigma[21]],"Toda, Equations 10.10"]
AddRelation[o[eta[9],eta[10],mu[11]] -> 4 zeta[9],"Toda, Equations 10.12"]
AddRelation[o[Sigma[nuprime],kappa[7]] -> Sigma[epsilonbarprime],"Toda, Lemma 12.3"]
Module[{n,m},
 AddRelation[o[epsilon[n_],epsilon[m_]] :> o[eta[n],epsilonbar[n+1]] /; m == n+8 && n >= 3,"Toda, Equations 12.4"]
]
Module[{n,m},
 AddRelation[o[epsilon[n_],nubar[m_]] :> o[eta[n],epsilonbar[n+1]] /; m == n+8 && n >= 3,"Toda, Equations 12.4"]
]
Module[{n,m},
 AddRelation[o[epsilon[n_],sigma[m_]] :> 0 /; m == n+8 && n >= 3,"Toda, Lemma 10.7"]
]
Module[{n,m},
 AddRelation[o[epsilonbar[n_],eta[m_]] :> o[eta[n],epsilonbar[n+1]] /; m == n+15 && n >= 3,"Toda, Equations 12.4"]
]
AddRelation[o[eta[12],rho[13]] -> o[sigma[12],mu[19]],"Toda, Proposition 12.20(i)"]
AddRelation[o[eta[3],eta[4],epsilonbar[5]] -> 2 epsilonbarprime,"Toda, Lemma 12.3"]
AddRelation[o[eta[3],eta[4],mubar[5]] -> 2 mubarprime,"Toda, Lemma 12.4"]
Module[{n,m},
 AddRelation[o[eta[n_],kappa[m_]] :> epsilonbar[n] /; m == n+1 && n >= 6,"Toda, Equations 10.23"]
]
Module[{n,m},
 AddRelation[o[eta[n_],rho[m_]] :> o[sigma[n],mu[n+7]] /; m==n+1 && n>=13,"Toda, Proposition 12.20(i)"]
]
Module[{n,m},
 AddRelation[o[kappa[n_],eta[m_]] :> epsilonbar[n] /; m == n+14 && n >= 9,"Toda, Equations 10.23"]
]
Module[{n,m},
 AddRelation[o[mu[n_],sigma[m_]] :> o[sigma[n],mu[n+7]] /; m==n+9 && n>=13,"Toda, Proposition 12.20(i)"]
]
Module[{n,m,p,q},
 AddRelation[o[nu[n_],sigma[m_],nu[p_],nu[q_]] :> o[eta[n],epsilonbar[n+1]] /; m==n+3 && p==n+10 && q==n+13 && n>=5,"Toda, Equations 12.4"]
]
Module[{n,m},
 AddRelation[o[nubar[n_],sigma[m_]] :> 0 /; m == n+8 && n >= 6,"Toda, Lemma 10.7"]
]
Module[{n,m},
 AddRelation[o[rho[n_],eta[m_]] :> o[sigma[n],mu[n+7]] /; m==n+16 && n>=13,"Toda, Proposition 12.20(i)"]
]
AddRelation[o[sigma[10],nubar[17]] -> o[sigma[10],epsilon[17]],"Toda, Equations 10.18"]
AddRelation[o[sigma[13],zeta[20]] -> 0,"Toda, Equations 12.23"]
Module[{n,m},
 AddRelation[o[sigma[n_],epsilon[m_]] :> 0 /; m == n+7 && n >= 11,"Toda, Lemma 10.7"]
]
Module[{n,m},
 AddRelation[o[sigma[n_],nubar[m_]] :> 0 /; m == n+7 && n >= 11 ,"Toda, Equations 10.18"]
]
AddRelation[o[w[14],nu[27],nu[30]] -> 2 o[omega[14],nu[30]],"Toda, Equations 12.27"]

AddRelation[
 o[sigmaprime,eta[14],epsilon[15]] -> Sigma[zetaprime],
 "Toda, Lemma 12.1 (noting that \\(2\\pi_{23}^{7}=0\\))"
]

AddRelation[
 o[Sigma[sigmaprime],eta[15],epsilon[16]] -> Sigma[zetaprime],
 "Toda, Lemma 12.1 (noting that \\(2\\pi_{23}^{7}=0\\))"
]

AddRelation[
 o[eta[5],w[6]] -> 0,
 StringJoin[
  "\\(\\eta_5\\circ w_6\\) lies in the kernel of the map ",
  "\\(\\Sigma:\\pi_{11}^5\\rightarrow\\pi_{12}^6\\), which is zero by ",
  "inspection of Toda's Proposition 5.11"
 ]
]

AddRelation[
 o[eta[5],nubar[6]] -> o[nu[5],nu[8],nu[11]],
 StringJoin[
  "This holds after one suspension by Toda's Lemma 6.3, but the map ",
  "\\(\\Sigma:\\pi_{14}^5\\rightarrow\\pi_{15}^6\\) is injective by ",
  "Toda's Theorem 7.2."
 ]
]

AddRelation[
 o[eta[3],Sigma[muprime]] -> 0,
 StringJoin[
  "We find by calculation that ",
  "\\(H:\\pi_{15}^3\\rightarrow\\pi_{15}^5\\) is injective, so ",
  "\\(\\Sigma:\\pi_{14}^2\\rightarrow\\pi_{15}^3\\) must be ",
  "zero.  In particular ",
  "\\({\\eta_3}\\circ\\Sigma\\mu'=\\Sigma(\\eta_2\\circ\\mu')=0\\)."
 ]
]

AddRelation[
 o[eta[3],epsilon[4],nu[12]] -> 0,
 StringJoin[
  "One checks that \\(H(\\eta_3\\circ\\epsilon_4\\circ\\nu_{12}=0\\), ",
  "but one can also calculate the Hopf invariants of Toda's ",
  "generators to see that \\(H:\\pi_{15}^3\\rightarrow\\pi_{15}^5\\) ",
  "is injective."
 ]
]

AddRelation[
 o[eta[3],Sigma[epsilonbarprime]] -> 0,
 StringJoin[
  "We have \\(\\Sigma{\\epsilonbar'}=(\\Sigma\\nu')\\circ\\kappa_7\\) ",
  "by Toda's Lemma 12.3, and \\(\\eta_3\\circ\\Sigma\\nu'=0\\) by ",
  "Toda's Lemma 5.7, so \\(\\eta_3\\circ\\Sigma{\\epsilonbar'}=0\\). "
 ]
]

AddRelation[
 o[nu[5],sigma[8],eta[15]] -> Coset[o[nu[5],epsilon[8]],{4 zeta[5]}],
 "Notes by Strickland, cor-nu-sigma-eta"
]

AddRelation[
 o[nu[n_],nu[m_],nu[p_],nu[q_]] :> 0 /; 
  m == n+3 && p == m+3 && q == p+3 && n >= 6,
  StringJoin[
   "\\({\\nu_n}\\circ{\\nu_{n+3}}\\circ{\\nu_{n+6}}\\circ{\\nu_{n+9}}=0\\)",
   "for \\(n \\geq 6)"
  ],
  "Notes by Strickland, prop-nu-nu-nu-nu"
]

AddRelation[
 o[nu[5],nu[8],sigma[11]] -> 0,
 "Notes by Strickland, prop-nu-nu-sigma"
]

AddRelation[
 o[epsilonprime,nu[13]] -> 0,
 "Notes by Strickland, prop-epsilonprime-nu"
]

AddRelation[
 o[Sigma[epsilonprime],nu[14]] -> 0,
 "Notes by Strickland, prop-epsilonprime-nu"
]

AddRelation[
 o[nu[6],nubar[9]] -> 2 o[nubar[6],nu[14]],
 "Notes by Strickland, prop-nu-nubar"
]

AddRelation[
 o[nubar[10],nu[18]] -> 0,
 "Notes by Strickland, prop-nubar-nu"
]

AddRelation[
 o[sigmathird,epsilon[12]] -> 0,
 "Notes by Strickland, prop-sigmathird-epsilon"
]

AddRelation[
 o[sigmathird,nubar[12]] -> 0,
 "Notes by Strickland, prop-sigmathird-nubar"
]

AddRelation[
 o[sigmasecond,epsilon[13]] -> 0,
 "Notes by Strickland, prop-sigmasecond-epsilon"
]

AddRelation[
 o[sigmasecond,nubar[13]] -> 0,
 "Notes by Strickland, prop-sigmasecond-nubar"
]

AddRelation[
 o[Sigma[theta],nu[25]] -> 0,
 "Toda, Equations 10.21 and 7.30"
]

Module[{m,n},AddRelation[
 o[nu[n_],epsilonbar[m_]] :> 0 /; m === n+3 && n>=6,
 "\\(\\nu_n\\circ\\epsilonbar_{n+3}=0\\) for \\(n\\geq 6\\)",
 StringJoin[ 
  "\\(\\nu_5\\circ\\epsilonbar_8=\\nu_5\\circ\\eta_8\\circ\\kappa_9=",
  "w_5\\circ\\kappa_9\\) by Toda's Equations 5.10 and 10.23.  The ",
  "claim follows by suspending."
 ]]]

AddRelation[
 o[w[10],eta[19]] -> 2 o[sigma[10],nu[17]],
 "Toda, Equations 7.21"
]

Module[{n,m},AddRelation[
 o[sigma[n_],nu[m_]] :> 0 /; m === n+7 && n >= 12,
 "\\(\\sigma_n\\circ\\nu_{n+7}=0\\) for \\(n\\geq 12\\)",
 "Toda, Equations 7.20"
]]

Module[{n,m},AddRelation[
 o[nu[n_],sigma[m_]] :> 0 /; m === n+3 && n >= 11,
 "\\(\\nu_n\\circ\\sigma_{n+3}=0\\) for \\(n\\geq 11\\)",
 "Toda, Equations 7.20"
]]

AddRelation[
 o[Sigma[sigmaprime],nu[15],nu[18]] -> o[nu[8],sigma[11],nu[18]],
 "Notes by Strickland, prop-sigmaprime-nu-nu"
]

AddRelation[
 o[eta[n_],epsilonbar[m_]] :> 0 /; m === n+1 && n >= 10,
 ""
]

UnknownComposites = {
o[eta[9], w[10]],
o[w[10], eta[19]], 
o[sigmaprime,nu[14]],
o[sigmasecond,nu[13]],
o[sigmathird,nu[12]],
o[nu[7], nubar[10]],
o[nu[9], sigma[12]],
o[nubar[10], nu[18]], 
o[Sigma[sigmaprime], nu[15]], 
o[nu[5], sigma[8], eta[15]]
}

(************************************************************************)

(* Hopf invariants                                                      *)

AddRelation[
 Hopf[eta[2]] ->  iota[3],
 "Definition of \\(\\eta_2\\) (Toda, Chapter V)"
]

AddRelation[
 Hopf[nu[4]] -> iota[7],
 "Definition of \\(\\nu_4\\) (Toda, Lemma 5.4)"
]

AddRelation[
 Hopf[sigma[8]] -> iota[15],
 "Definition of \\(\\sigma_8\\) (Toda, Lemma 5.14)"
]

AddRelation[
 Hopf[nuprime]         -> eta[5],
 "Toda, Equations 5.3"
]

AddRelation[
 Hopf[sigmathird]   -> 4 nu[9],
 "Toda, Lemma 5.14"
]

AddRelation[
 Hopf[sigmasecond]     -> o[eta[11],eta[12]],
 "Toda, Lemma 5.14"
]

AddRelation[ 
 Hopf[sigmaprime]   -> eta[13],
 "Toda, Lemma 5.14"
]

AddRelation[
 Hopf[epsilon[3]] -> o[nu[5],nu[8]],
 "Toda, Lemma 6.1"
]

AddRelation[
 Hopf[nubar[6]] -> nu[11],
 StringJoin[
  "For us this is part of the definition of \\(\\nubar_6\\). ",
  "Toda's Lemma 6.2 says that it is true modulo \\(2\\nu_{11}\\), which ",
  "is part of the validation of our definition. "
 ]
]

AddRelation[
 Hopf[mu[3]] -> sigmathird,
 "Toda, Lemma 6.5"
]

AddRelation[
 Hopf[epsilonprime] -> epsilon[5],
 "Toda, Lemma 6.6"
]

AddRelation[
 Hopf[muprime] -> mu[5],
 "Toda, beginning of Section VII(ii)"
]

AddRelation[
 Hopf[zeta[5]] -> 8 sigma[9],
 "Toda, Lemma 6.7"
]

AddRelation[
 Hopf[thetaprime] -> o[eta[21],eta[22]],
 "Toda, Lemma 7.5"
]

AddRelation[
 Hopf[theta] -> eta[23],
 "Toda, Lemma 7.5"
]

AddRelation[
 Hopf[epsilonbar[3]] -> o[nu[5],sigma[8],nu[15]],
 "Strickland, prop-hopf-epsilonbar"
]

AddRelation[
 Hopf[epsilonstar[12]] -> o[nu[23],nu[26]],
 "Toda, Lemma 12.15"
]

AddRelation[
 Hopf[lambda] -> o[nu[25],nu[28]],
 "Toda, Lemma 12.18"
]

AddRelation[
 Hopf[lambdaprime] -> Coset[epsilon[21],{nubar[21]+epsilon[21]}],
 "Toda, Lemma 12.19"
]

AddRelation[
 Hopf[lambdasecond] -> Coset[o[eta[19],epsilon[20]],{o[eta[19],epsilon[20]]+o[nu[19],nu[22],nu[25]]}],
 "Toda, Lemma 12.19"
]

AddRelation[
 Hopf[mubar[3]] -> rhofourth,
 "Toda, Lemma 12.2"
]

AddRelation[
 Hopf[mubarprime] -> Coset[mubar[5],Zap[Sigma[Sigma[Sigma[Generators[SpherePi[19,2]]]]]]],
 "Toda, Lemma 12.4"
]

AddRelation[
 Hopf[omega[14]] -> nu[27],
 "Toda, Lemma 12.15"
]

AddRelation[
 Hopf[omegaprime] -> Coset[epsilon[23],{nubar[23] + epsilon[23]}],
 "Toda, Lemma 12.21"
]

AddRelation[
 Hopf[rho[13]] -> 4 nu[25],
 "Toda, Equations 10.22"
]

AddRelation[
 Hopf[rhofourth] -> 4 zeta[9],
 "Toda, Equations 10.12"
]

AddRelation[
 Hopf[rhoprime] -> 8 sigma[17],
 "Toda, Equations 10.12"
]

AddRelation[
 Hopf[rhosecond] -> mu[13],
 StringJoin[
  "This is part of our definition of \\(\\rho''\\) - see the ",
  "notes by Strickland, prop-rho-second, and Toda, Equations 10.12"
 ]
]

AddRelation[
 Hopf[rhothird] -> o[eta[11],mu[12]],
 "Toda, Equations 10.12"
]

AddRelation[
 Hopf[sigmabar[6]] -> Coset[o[sigma[11],sigma[18]], {2 o[sigma[11],sigma[18]]}],
 "Toda, Lemma 12.5"
]

AddRelation[
 Hopf[xiprime] -> nubar[21] + epsilon[21],
 "Toda, Lemma 12.19"
]

AddRelation[
 Hopf[xisecond] -> o[eta[19],epsilon[20]]+o[nu[19],nu[22],nu[25]],
 "Toda, Lemma 12.19"
]

AddRelation[
 Hopf[zetabar[5]] -> 8 rhoprime,
 "Toda, Lemma 12.4"
]

AddRelation[
 Hopf[zetaprime] -> zeta[11],
 StringJoin[
  "This is part of our definition of \\(\\zeta'\\), which is validated in ",
  "the notes by Strickland, prop-zetaprime, which refines Toda's Lemma 12.1"
 ]
]

AddRelation[
 Hopf[etastarprime] -> o[eta[29],eta[30]],
 "Toda, Lemma 12.14"
]

AddRelation[
 Hopf[etastar[16]] -> eta[31],
 "Toda, Lemma 12.14"
]

AddRelation[
 Hopf[epsilonbarprime] -> Coset[epsilonbar[5],{rhofourth}],
 "Notes by Strickland, prop-H-epsilonbarprime"
]

AddRelation[
 Hopf[WhiteheadP[Sigma[theta]]] -> thetaprime,
 "Toda, Lemma 12.11"
]

AddRelation[
 Hopf[kappa[7]] -> epsilon[13],
 "Notes by Strickland, prop-H-kappa"
]

(************************************************************************)

(* The Whitehead map                                                    *)

AddRelation[
 WhiteheadP[eta[3]] -> 0,
 "\\(P(\\eta_3)\\) lies in the trivial group \\(\\pi_2S^1\\)."
]

AddRelation[
 WhiteheadP[eta[9]] -> o[Sigma[nuprime],eta[7]],
 "Notes by Strickland"
]

AddRelation[ 
 WhiteheadP[nu[5]] -> o[eta[2],nuprime],
 "Toda, Lemma 5.7; we have fudged the sign."
]

AddRelation[
 WhiteheadP[o[nu[5],sigma[8]]] -> o[eta[2],epsilonprime],
 "Notes by Strickland, Proposition 2; we have fudged the sign"
]

AddRelation[
 WhiteheadP[sigmaprime] -> 0,
 "Notes by Strickland, Proposition 3"
]

AddRelation[
 WhiteheadP[sigma[9]] ->
  Coset[o[nu[4],sigmaprime] - Sigma[epsilonprime],
        {2(o[nu[4],sigmaprime] - Sigma[epsilonprime])}],
 "Notes by Strickland.  We have fudged a sign."
]

AddRelation[
 WhiteheadP[sigma[11]] ->
  o[nu[5],nubar[8]] + o[nu[5],epsilon[8]],
 "Toda, Equations 7.17"
]


AddRelation[
 WhiteheadP[o[sigma[9],eta[16]]] ->
   o[nu[4],sigmaprime,eta[14]] + o[Sigma[nuprime],epsilon[7]],
 "Toda, Equations 7.16"
]

AddRelation[
 WhiteheadP[o[sigma[9],eta[16],eta[17]]] ->
   o[nu[4],sigmaprime,eta[14],eta[15]] +
   o[Sigma[nuprime],eta[7],epsilon[8]],
 "Toda, Equations 7.16"
]

AddRelation[
 WhiteheadP[nuprime] -> 0,
 "To Do: Find this reference!"
]

AddRelation[
 WhiteheadP[epsilon[3]] -> 0,
 "Takes place in \\(\\pi_9S^1=0\\)."
]

AddRelation[
 WhiteheadP[o[eta[3],epsilon[4]]] -> 0,
 "Takes place in \\(\\pi_{10}S^1=0\\)."
]

AddRelation[
 WhiteheadP[mu[3]] -> 0,
 "Takes place in \\(\\pi_{10}S^1=0\\)."
]

AddRelation[
 WhiteheadP[o[eta[3],mu[4]]] -> 0,
 "Takes place in \\(\\pi_{11}S^1=0\\)."
]

AddRelation[
 WhiteheadP[epsilonprime] -> 0,
 "Takes place in \\(\\pi_{11}S^1=0\\)."
]

AddRelation[
 WhiteheadP[muprime] -> 0,
 "Takes place in \\(\\pi_{12}S^1=0\\)."
]

AddRelation[
 WhiteheadP[o[epsilon[3],nu[11]]] -> 0,
 "Takes place in \\(\\pi_{12}S^1=0\\)."
]

AddRelation[
 WhiteheadP[o[nuprime,epsilon[6]]] -> 0,
 "Takes place in \\(\\pi_{12}S^1=0\\)."
]

AddRelation[
 WhiteheadP[epsilonbar[3]] -> 0,
 "Takes place in \\(\\pi_{16}S^1=0\\)."
]

AddRelation[
 WhiteheadP[o[eta[3],epsilonbar[4]]] -> 0,
 "Takes place in \\(\\pi_{17}S^1=0\\)."
]

AddRelation[
 WhiteheadP[sigmathird] -> 0,
 "Takes place in \\(\\pi_{10}S^2=0\\)."
]

AddRelation[
 WhiteheadP[nubar[7]] -> 0,
 "Notes by Strickland"
]

AddRelation[
 WhiteheadP[rhosecond] -> 0,
 StringJoin[
  "\\(P(\\rho'')\\) lies in the kernel of ",
  "\\(\\Sigma:\\pi_{20}^{3}\\rightarrow\\pi_{21}^{4}\\), which is trivial ",
  "by inspection of Toda's Theorem 12.7"
 ]
]

AddRelation[
 WhiteheadP[zeta[5]] -> Coset[o[eta[2],muprime],{2 o[eta[2],muprime]}],
 "Notes by Strickland, prop-zeta"
]

AddRelation[
 WhiteheadP[epsilonbarprime] -> 0,
 "This takes place in \\(\\pi_{18}^1=0\\)."
]

AddRelation[
 WhiteheadP[mubar[3]] -> 0,
 "This takes place in \\(\\pi_{18}^1=0\\)."
]

AddRelation[
 WhiteheadP[o[eta[3],mubar[4]]] -> 0,
 "This takes place in \\(\\pi_{19}^1=0\\)."
]

AddRelation[
 WhiteheadP[rhofourth] -> 0,
 "\\(P(\\rho^{(4)})=PH(\\mubar_3)=0\\) (using Toda, Lemma 12.2)"
]

AddRelation[
 o[nu[5],eta[8],epsilonbar[9]] -> 0,
 "Toda, Equations 12.15 and 5.10"
]

AddRelation[
 WhiteheadP[Sigma[Sigma[rhoprime]]] -> 0,
 "Toda, Equations 12.15"
]

AddRelation[
 o[nu[5],eta[8],rhoprime] -> 0,
 StringJoin[
  "Toda, Equations 12.15 gives \\(P(\\Sigma^2\\rho')=0\\), but ",
  "\\(P(\\Sigma^2\\rho')=P(\\iota_{11})\\circ\\rho'=",
  "\\nu_5\\circ\\eta_8\\circ\\rho'\\) by Equations 5.10."
 ]
]

AddRelation[
 w[1] -> 0,
 "\\(w_1=P(\\iota_3)=PH(\\eta_2)=0\\)"
]

AddRelation[
 w[2]   -> 2 eta[2],
 "Toda's Proposition 5.1 should say that \\(w_2=P(\\iota_5)=\\pm 2\\eta_2\\).
  In fact it says that \\(w_2=P(\\iota_5)=\\pm 2\\eta_3\\), but this is not
  dimensionally correct and is a typo.  We have fudged the sign ambiguity.
 "
]

AddRelation[
 w[3] -> 0,
 "\\(w_3=P(\\iota_7)=PH(\\nu_4)=0\\)"
]

AddRelation[
 w[4] -> 2 nu[4] - Sigma[nuprime],
 "Toda, Equations 5.8 say that \\(w_4=\\pm(2\\nu_4-\\Sigma\\nu')\\).
  We have fudged the sign.
 "
]

AddRelation[
 w[5] -> o[nu[5],eta[8]],
 "Toda, Equations 5.10"
]

AddRelation[
 w[7] -> 0,
 "Toda, Lemma 5.14 gives \\(w_7=P(\\iota_{15})=PH(\\sigma_8)=0\\)."
]

AddRelation[
 w[8] -> 2 sigma[8] - Sigma[sigmaprime],
 "Toda, Equations 5.16 say that
  \\(w_8=\\pm(2\\sigma_8-\\Sigma\\sigma')\\).
  We have fudged the sign.
 "
]

AddRelation[
 w[9] -> o[sigma[9],eta[16]] + nubar[9] + epsilon[9],
 "Toda, Equations 7.1"
]

AddRelation[
 w[11] -> o[sigma[11],nu[18]],
 "Toda, Equations 7.21"
]

AddRelation[
 w[13] -> Sigma[theta],
 "Toda, Equations 7.30"
]

AddRelation[
 w[15] -> 2 o[sigma[15],sigma[22]],
 "Toda, Equations 10.10"
]


(************************************************************************)
(* SpherePi[k_,n_] = \\pi_k(S^n)/ odd torsion                           *)

SpherePiReference[n_,m_] := "Connectivity" /; n<m
SpherePiReference[n_,1]  := "Covering spaces" /; n>1

HomotopySet[Sphere[k_],Sphere[n_]] := Group[] /; k<n
HomotopySet[Sphere[k_],Sphere[ 0]] := Group[] /; k>0
HomotopySet[Sphere[k_],Sphere[ 1]] := Group[] /; k>1

(************************************************************************)
(* \\pi_n(S^n)                                                          *)

SpherePiReference[n_,m_] := "Hurewicz" /; n === m
HomotopySet[Sphere[n_],Sphere[n_]] := GroupGeneratedBy[iota[n]] /; n>0

(************************************************************************)
(* \\pi_{n+1}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.1, p39"  /; n === m+1  && m>1

HomotopySet[Sphere[3],Sphere[  2]]  = GroupGeneratedBy[eta[2]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[eta[n]] /; k == n+1 && n > 2

(************************************************************************)
(* \\pi_{n+2}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.3, p40"  /; n === m+2  && m>1

HomotopySet[Sphere[k_],Sphere[n_]] :=
 GroupGeneratedBy[o[eta[n],eta[n+1]]] /; k == n+2 && n>1

(************************************************************************)
(* \\pi_{n+3}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.6, p42"  /; n === m+3  && m>1

HomotopySet[Sphere[5],Sphere[  2]]  = 
  GroupGeneratedBy[o[eta[2],eta[3],eta[4]]]
HomotopySet[Sphere[6],Sphere[  3]]  = GroupGeneratedBy[nuprime]
HomotopySet[Sphere[7],Sphere[  4]]  =
  GroupGeneratedBy[nu[4],Sigma[nuprime]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[nu[n]] /; k == n+3 && n>4

(************************************************************************)
(* \\pi_{n+4}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.8, p43"  /; n === m+4  && m>1

HomotopySet[Sphere[6],Sphere[  2]]  =
  GroupGeneratedBy[o[eta[2],nuprime]]
HomotopySet[Sphere[7],Sphere[  3]]  =
  GroupGeneratedBy[o[nuprime,eta[6]]]
HomotopySet[Sphere[8],Sphere[  4]]  =
  GroupGeneratedBy[o[nu[4],eta[7]],o[Sigma[nuprime],eta[7]]]
HomotopySet[Sphere[9],Sphere[  5]]  =
  GroupGeneratedBy[o[nu[5],eta[8]]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  Group[] /; k == n+4 && n>5

(************************************************************************)
(* \\pi_{n+5}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.9, p44"  /; n === m+5  && m>1

HomotopySet[Sphere[7],Sphere[  2]]  =
  GroupGeneratedBy[o[eta[2],nuprime,eta[6]]]
HomotopySet[Sphere[8],Sphere[  3]]  =
  GroupGeneratedBy[o[nuprime,eta[6],eta[7]]]
HomotopySet[Sphere[9],Sphere[  4]]  =
  GroupGeneratedBy[o[nu[4],eta[7],eta[8]],
                   o[Sigma[nuprime],eta[7],eta[8]]]
HomotopySet[Sphere[10],Sphere[ 5]]  =
  GroupGeneratedBy[o[nu[5],eta[8],eta[9]]]
HomotopySet[Sphere[11],Sphere[ 6]]  =
  GroupGeneratedBy[w[6]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  Group[] /; k == n+5 && n>6

(************************************************************************)
(* \\pi_{n+6}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.11, p46" /; n === m+6  && m>1

HomotopySet[Sphere[8],Sphere[  2]]  =
  GroupGeneratedBy[o[eta[2],nuprime,eta[6],eta[7]]]

HomotopySet[Sphere[9],Sphere[  3]]  =
  Group[]
HomotopySet[Sphere[10],Sphere[ 4]]  =
  GroupGeneratedBy[o[nu[4],nu[7]]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[o[nu[n],nu[n+3]]] /; k == n+6 && n>4

(************************************************************************)
(* \\pi_{n+7}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Proposition 5.15, p50" /; n === m+7  && m>1

HomotopySet[Sphere[9],Sphere[  2]]  = Group[]
HomotopySet[Sphere[10],Sphere[ 3]]  = Group[]
HomotopySet[Sphere[11],Sphere[ 4]]  = Group[]
HomotopySet[Sphere[12],Sphere[ 5]]  =
  GroupGeneratedBy[sigmathird]
HomotopySet[Sphere[13],Sphere[ 6]]  =
  GroupGeneratedBy[sigmasecond]
HomotopySet[Sphere[14],Sphere[ 7]]  =
  GroupGeneratedBy[sigmaprime]
HomotopySet[Sphere[15],Sphere[ 8]]  =
  GroupGeneratedBy[sigma[8],Sigma[sigmaprime]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
 Group[{sigma[n],16}] /; k == n+7 && n>8

(************************************************************************)
(* \\pi_{n+8}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem  7.1, p61"      /; n === m+8  && m>1

HomotopySet[Sphere[10],Sphere[ 2]]  = Group[]
HomotopySet[Sphere[11],Sphere[ 3]]  =
  GroupGeneratedBy[epsilon[3]]
HomotopySet[Sphere[12],Sphere[ 4]]  =
  GroupGeneratedBy[epsilon[4]]
HomotopySet[Sphere[13],Sphere[ 5]]  =
  GroupGeneratedBy[epsilon[5]]
HomotopySet[Sphere[14],Sphere[ 6]]  =
  GroupGeneratedBy[epsilon[6],nubar[6]]
HomotopySet[Sphere[15],Sphere[ 7]]  =
  GroupGeneratedBy[epsilon[7],nubar[7],o[sigmaprime,eta[14]]]
HomotopySet[Sphere[16],Sphere[ 8]]  =
  GroupGeneratedBy[epsilon[8],
                   nubar[8],
                   o[Sigma[sigmaprime],eta[15]],
                   o[sigma[8],eta[15]]]
HomotopySet[Sphere[17],Sphere[ 9]]  =
  GroupGeneratedBy[epsilon[9],
                   nubar[9],
                   o[sigma[9],eta[16]]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[epsilon[n],nubar[n]] /; k == n+8 && n>9

(************************************************************************)
(* \\pi_{n+9}(S^n)                                                      *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem  7.2, p61"      /; n === m+9  && m>1

HomotopySet[Sphere[11],Sphere[ 2]]  =
  GroupGeneratedBy[o[eta[ 2],epsilon[ 3]]]
HomotopySet[Sphere[12],Sphere[ 3]]  =
  GroupGeneratedBy[o[eta[ 3],epsilon[ 4]],mu[ 3]]
HomotopySet[Sphere[13],Sphere[ 4]]  =
  GroupGeneratedBy[o[eta[ 4],epsilon[ 5]],
                   mu[ 4],
                   o[nu[ 4],nu[ 7],nu[10]] ]
HomotopySet[Sphere[14],Sphere[ 5]]  =
  GroupGeneratedBy[o[eta[ 5],epsilon[ 6]],
                   mu[ 5],
                   o[nu[ 5],nu[ 8],nu[11]] ]
HomotopySet[Sphere[15],Sphere[ 6]]  =
  GroupGeneratedBy[o[eta[ 6],epsilon[ 7]],
                   mu[ 6],
                   o[nu[ 6],nu[ 9],nu[12]] ]
HomotopySet[Sphere[16],Sphere[ 7]]  =
  GroupGeneratedBy[o[eta[ 7],epsilon[ 8]],
                   mu[ 7],
                   o[nu[ 7],nu[10],nu[13]],
                   o[sigmaprime,eta[14],eta[15]] ]
HomotopySet[Sphere[17],Sphere[ 8]]  =
  GroupGeneratedBy[o[eta[ 8],epsilon[ 9]],
                   mu[ 8],
                   o[nu[ 8],nu[11],nu[14]],
                   o[Sigma[sigmaprime],eta[15],eta[16]],
                   o[sigma[8],eta[15],eta[16]] ]
HomotopySet[Sphere[18],Sphere[ 9]]  =
  GroupGeneratedBy[o[eta[ 9],epsilon[10]],
                   mu[ 9],
                   o[nu[ 9],nu[12],nu[15]],
                   o[sigma[9],eta[16],eta[17]] ]
HomotopySet[Sphere[19],Sphere[10]]  =
  GroupGeneratedBy[o[eta[10],epsilon[11]],
                   mu[10],
                   o[nu[10],nu[13],nu[16]],
                   w[10]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[o[eta[n],epsilon[n+1]],
                   mu[n],
                   o[nu[n],nu[n+3],nu[n+6]]] /; k == n+9 && n>10

(************************************************************************)
(* \\pi_{n+10}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem  7.3, p66 "      /; n === m+10 && m>1

HomotopySet[Sphere[12],Sphere[ 2]]  =
  GroupGeneratedBy[o[eta[ 2],mu[ 3]],
                   o[eta[ 2],eta[ 3],epsilon[4]]]
HomotopySet[Sphere[13],Sphere[ 3]]  =
  GroupGeneratedBy[o[eta[ 3],mu[ 4]],
                   epsilonprime]
HomotopySet[Sphere[14],Sphere[ 4]]  =
  GroupGeneratedBy[o[eta[ 4],mu[ 5]],
                   Sigma[epsilonprime],
                   o[nu[ 4],sigmaprime] ]
HomotopySet[Sphere[15],Sphere[ 5]]  =
  GroupGeneratedBy[o[eta[ 5],mu[ 6]],
                   o[nu[ 5],sigma[ 8]] ]
HomotopySet[Sphere[16],Sphere[ 6]]  =
  GroupGeneratedBy[o[eta[ 6],mu[ 7]],
                   o[nu[ 6],sigma[ 9]]]
HomotopySet[Sphere[17],Sphere[ 7]]  =
  GroupGeneratedBy[o[eta[ 7],mu[ 8]],
                   o[nu[ 7],sigma[10]]]
HomotopySet[Sphere[18],Sphere[ 8]]  =
  GroupGeneratedBy[o[eta[ 8],mu[ 9]],
                         o[nu[ 8],sigma[11]],
                         o[sigma[ 8],nu[15]]]
HomotopySet[Sphere[19],Sphere[ 9]]  =
  GroupGeneratedBy[o[eta[ 9],mu[10]],
                         o[sigma[ 9],nu[16]]]
HomotopySet[Sphere[20],Sphere[10]]  =
  GroupGeneratedBy[o[eta[10],mu[11]],
                         o[sigma[10],nu[17]]]
HomotopySet[Sphere[21],Sphere[11]]  =
  GroupGeneratedBy[o[eta[11],mu[12]],
                         o[sigma[11],nu[18]]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[o[eta[n],mu[n+1]]] /; k == n+10 && n>11

(************************************************************************)
(* \\pi_{n+11}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem  7.4, p66 "      /; n === m+11 && m>1

HomotopySet[Sphere[13],Sphere[ 2]]  =
  GroupGeneratedBy[o[eta[2],epsilonprime],
                         o[eta[2],eta[3],mu[4]]]
HomotopySet[Sphere[14],Sphere[ 3]]  = 
  GroupGeneratedBy[muprime,
                         o[epsilon[3],nu[11]],
                         o[nuprime,epsilon[6]]]
HomotopySet[Sphere[15],Sphere[ 4]]  =
  GroupGeneratedBy[Sigma[muprime],
                   o[epsilon[4],nu[12]],
                   o[Sigma[nuprime],epsilon[7]],
                   o[nu[ 4],sigmaprime,eta[14]],
                   o[nu[ 4],nubar[7]],
                   o[nu[ 4],epsilon[7]]]
HomotopySet[Sphere[16],Sphere[ 5]]  =
  GroupGeneratedBy[o[nu[ 5],nubar[8]],
                   o[nu[ 5],epsilon[8]],
                   zeta[ 5]]
HomotopySet[Sphere[17],Sphere[ 6]]  =
  GroupGeneratedBy[zeta[ 6],
                   o[nubar[ 6],nu[14]]]
HomotopySet[Sphere[18],Sphere[ 7]]  =
  GroupGeneratedBy[zeta[ 7],
                   o[nubar[ 7],nu[15]]]
HomotopySet[Sphere[19],Sphere[ 8]]  =
  GroupGeneratedBy[zeta[ 8],
                   o[nubar[ 8],nu[16]]]
HomotopySet[Sphere[20],Sphere[ 9]]  =
  GroupGeneratedBy[zeta[ 9],
                   o[nubar[ 9],nu[17]]]
HomotopySet[Sphere[21],Sphere[10]]  =
  GroupGeneratedBy[zeta[10]]
HomotopySet[Sphere[22],Sphere[11]]  =
  GroupGeneratedBy[zeta[11]]
HomotopySet[Sphere[23],Sphere[12]]  =
  GroupGeneratedBy[zeta[12],
                   w[12]]
HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[zeta[n]] /; k == n+11 && n>12

(************************************************************************)
(* \\pi_{n+12}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem  7.6, p74 "      /; n === m+12 && m>1

(* Here Toda lists o[eta[2],nuprime,nubar[6]] as a generator, but this  *)
(* is the same as o[eta[2],epsilon[3],nu[11]] by his Equations 7.12,    *)
(* and that is a more convenient expression for comparison with other   *)
(* results.                                                             *)
HomotopySet[Sphere[14],Sphere[ 2]] = 
  GroupGeneratedBy[
   o[eta[2],muprime],
   o[eta[2],epsilon[3],nu[11]],
   o[eta[2],nuprime,epsilon[6]]
  ]

HomotopySet[Sphere[15],Sphere[ 3]] = 
  GroupGeneratedBy[
   o[nuprime,mu[6]],
   o[nuprime,eta[6],epsilon[7]]
  ]

HomotopySet[Sphere[16],Sphere[ 4]] = 
  GroupGeneratedBy[
   o[nu[4],sigmaprime,eta[14],eta[15]],
   o[nu[4],nu[7],nu[10],nu[13]],
   o[nu[4],mu[7]],
   o[nu[4],eta[7],epsilon[8]],
   o[Sigma[nuprime],mu[7]],
   o[Sigma[nuprime],eta[7],epsilon[8]]
  ]

HomotopySet[Sphere[17],Sphere[ 5]] = 
  GroupGeneratedBy[
   o[nu[5],nu[8],nu[11],nu[14]],
   o[nu[5],mu[8]],
   o[nu[5],eta[8],epsilon[9]]
  ]

HomotopySet[Sphere[18],Sphere[ 6]] = GroupGeneratedBy[o[w[6],sigma[11]]]
HomotopySet[Sphere[19],Sphere[ 7]] = Group[]
HomotopySet[Sphere[20],Sphere[ 8]] = Group[]
HomotopySet[Sphere[21],Sphere[ 9]] = Group[]
HomotopySet[Sphere[22],Sphere[10]] = GroupGeneratedBy[o[w[10],nu[19]]]
HomotopySet[Sphere[23],Sphere[11]] = GroupGeneratedBy[thetaprime]
HomotopySet[Sphere[24],Sphere[12]] = GroupGeneratedBy[theta,Sigma[thetaprime]]
HomotopySet[Sphere[25],Sphere[13]] = GroupGeneratedBy[Sigma[theta]]
HomotopySet[Sphere[k_],Sphere[n_]] := Group[] /; k == n+12 && n>13

(************************************************************************)
(* \\pi_{n+13}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem  7.7, p75 "      /; n === m+13 && m>1

HomotopySet[Sphere[15],Sphere[ 2]] =
 GroupGeneratedBy[
  o[eta[2],nuprime,mu[6]],
  o[eta[2],nuprime,eta[6],epsilon[7]]
 ]

HomotopySet[Sphere[16],Sphere[ 3]] =
 GroupGeneratedBy[
  o[nuprime,eta[6],mu[7]]
 ]

HomotopySet[Sphere[17],Sphere[ 4]] =
 GroupGeneratedBy[
  o[nu[4],nu[7],sigma[10]],
  o[nu[4],eta[7],mu[8]],
  o[Sigma[nuprime],eta[7],mu[8]]
 ]

HomotopySet[Sphere[18],Sphere[ 5]] =
 GroupGeneratedBy[
  o[nu[5],sigma[ 8],nu[15]],
  o[nu[5],eta[8],mu[9]]
 ]

HomotopySet[Sphere[19],Sphere[ 6]] =
 GroupGeneratedBy[
  o[nu[6],sigma[ 9],nu[16]]
 ]

HomotopySet[Sphere[20],Sphere[ 7]] =
 GroupGeneratedBy[
  o[nu[7],sigma[10],nu[17]]
 ]

HomotopySet[Sphere[21],Sphere[ 8]] =
  GroupGeneratedBy[
   o[sigma[ 8],nu[15],nu[18]],
   o[nu[8],sigma[11],nu[18]]
  ]

HomotopySet[Sphere[22],Sphere[ 9]] =
  GroupGeneratedBy[
   o[sigma[ 9],nu[16],nu[19]]
  ]

HomotopySet[Sphere[23],Sphere[10]] =
  GroupGeneratedBy[
   o[sigma[10],nu[17],nu[20]]
  ]

HomotopySet[Sphere[24],Sphere[11]] =
  GroupGeneratedBy[
   o[sigma[11],nu[18],nu[21]],
   o[thetaprime,eta[23]]
  ]

HomotopySet[Sphere[25],Sphere[12]] =
  GroupGeneratedBy[
   o[theta,eta[24]],
   o[Sigma[thetaprime],eta[24]]
  ]

HomotopySet[Sphere[26],Sphere[13]] =
  GroupGeneratedBy[
   o[Sigma[theta],eta[25]]
  ]

HomotopySet[Sphere[27],Sphere[14]] =
  GroupGeneratedBy[
   w[14]
  ]

HomotopySet[Sphere[k_],Sphere[n_]] := Group[] /; k == n+13 && n>14


(************************************************************************)
(* \\pi_{n+14}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem 10.3, p97 "      /; n === m+14 && m>1

HomotopySet[Sphere[16],Sphere[ 2]] = 
  GroupGeneratedBy[
   o[eta[2],nuprime,eta[6],mu[7]]
  ]

HomotopySet[Sphere[17],Sphere[ 3]] = 
  GroupGeneratedBy[
   o[epsilon[3],nu[11],nu[14]]
  ]

HomotopySet[Sphere[18],Sphere[ 4]] = 
  GroupGeneratedBy[
   o[epsilon[4],nu[12],nu[15]],
   o[nu[4],zeta[7]],
   o[nu[4],nubar[7],nu[15]]
  ]

HomotopySet[Sphere[19],Sphere[ 5]] = 
  GroupGeneratedBy[
   o[nu[5],zeta[8]],
   o[nu[5],nubar[8],nu[16]]
  ]

HomotopySet[Sphere[20],Sphere[ 6]] = 
  GroupGeneratedBy[
   o[sigmasecond,sigma[13]],
   o[nubar[6],nu[14],nu[17]]
  ]

HomotopySet[Sphere[21],Sphere[ 7]] = 
  GroupGeneratedBy[
   o[sigmaprime,sigma[14]],
   kappa[7]
  ]

HomotopySet[Sphere[22],Sphere[ 8]] = 
  GroupGeneratedBy[
   o[sigma[8],sigma[15]],
   o[Sigma[sigmaprime],sigma[15]],
   kappa[8]
  ]

HomotopySet[Sphere[23],Sphere[ 9]] = 
  GroupGeneratedBy[
   o[sigma[9],sigma[16]],
   kappa[9]
  ]

HomotopySet[Sphere[24],Sphere[10]] = 
  GroupGeneratedBy[
   o[sigma[10],sigma[17]],
   kappa[10]
  ]

HomotopySet[Sphere[25],Sphere[11]] = 
  GroupGeneratedBy[
   o[sigma[11],sigma[18]],
   kappa[11]
  ]

HomotopySet[Sphere[26],Sphere[12]] = 
  GroupGeneratedBy[
   o[sigma[12],sigma[19]],
   kappa[12],
   o[w[12],nu[23]]
  ]

HomotopySet[Sphere[27],Sphere[13]] = 
  GroupGeneratedBy[
   o[sigma[13],sigma[20]],
   kappa[13]
  ]

HomotopySet[Sphere[28],Sphere[14]] = 
  GroupGeneratedBy[
   o[sigma[14],sigma[21]],
   kappa[14]
  ]

HomotopySet[Sphere[29],Sphere[15]] = 
  GroupGeneratedBy[
   o[sigma[15],sigma[22]],
   kappa[15]
  ]

HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[
   o[sigma[n],sigma[n+7]],
   kappa[n]
  ] /; k == n+14 && n>=16

(************************************************************************)
(* \\pi_{n+15}(S^n)                                                     *)


SpherePiReference[n_,m_] :=
  "Toda, Theorem 10.5, p104"      /; n === m+15 && m>1 && m<=12

SpherePiReference[n_,m_] :=
  "Toda, Theorem 10.10, p110"     /; n === m+15 && m>1 && m>12

HomotopySet[Sphere[17],Sphere[ 2]] =
  GroupGeneratedBy[
   o[eta[2],epsilon[3],nu[11],nu[14]]
  ]

HomotopySet[Sphere[18],Sphere[ 3]] =
  GroupGeneratedBy[
   epsilonbar[3]
  ]

HomotopySet[Sphere[19],Sphere[ 4]] =
  GroupGeneratedBy[
   epsilonbar[4]
  ]

HomotopySet[Sphere[20],Sphere[ 5]] =
  GroupGeneratedBy[
   epsilonbar[5],
   rhofourth
  ]

HomotopySet[Sphere[21],Sphere[ 6]] =
  GroupGeneratedBy[
   epsilonbar[6],
   rhothird
  ]

HomotopySet[Sphere[22],Sphere[ 7]] =
  GroupGeneratedBy[
   epsilonbar[7],
   rhosecond,
   o[sigmaprime,nubar[14]],
   o[sigmaprime,epsilon[14]]
  ]

HomotopySet[Sphere[23],Sphere[ 8]] =
  GroupGeneratedBy[
   epsilonbar[8],
   Sigma[rhosecond],
   o[Sigma[sigmaprime],nubar[15]],
   o[Sigma[sigmaprime],epsilon[15]],
   o[sigma[8],nubar[15]],
   o[sigma[8],epsilon[15]]
  ]

HomotopySet[Sphere[24],Sphere[ 9]] =
  GroupGeneratedBy[
   epsilonbar[9],
   rhoprime,
   o[sigma[9],nubar[16]],
   o[sigma[9],epsilon[16]]
  ]

HomotopySet[Sphere[25],Sphere[10]] =
  GroupGeneratedBy[
   epsilonbar[10],
   Sigma[rhoprime],
   o[sigma[10],nubar[17]]
  ]

HomotopySet[Sphere[26],Sphere[11]] =
  GroupGeneratedBy[
   epsilonbar[11],
   Sigma[Sigma[rhoprime]]
  ]

HomotopySet[Sphere[27],Sphere[12]] =
  GroupGeneratedBy[
   epsilonbar[12],
   Sigma[Sigma[Sigma[rhoprime]]]
  ]

HomotopySet[Sphere[n_],Sphere[m_]] :=
  GroupGeneratedBy[
   epsilonbar[m],
   rho[m]
  ] /; n === m+15 && m >= 13 && m =!= 16

HomotopySet[Sphere[31],Sphere[16]] =
  GroupGeneratedBy[
   epsilonbar[16],
   rho[16],
   w[16]
  ]

(************************************************************************)
(* \\pi_{n+16}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.6, p139"      /; n === m+16 && m>1 && m<=9

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.16, p155"     /; n === m+16 && m>1 && m>9

HomotopySet[Sphere[18],Sphere[ 2]] = 
  GroupGeneratedBy[
   o[eta[2],epsilonbar[3]]
  ]

HomotopySet[Sphere[19],Sphere[ 3]] = 
  GroupGeneratedBy[
   o[eta[3],epsilonbar[4]],
   o[mu[3],sigma[12]]
  ]

HomotopySet[Sphere[20],Sphere[ 4]] = 
  GroupGeneratedBy[
   o[eta[4],epsilonbar[5]],
   o[mu[4],sigma[13]],
   o[nu[4],nu[7],sigma[10],nu[17]]
  ]

HomotopySet[Sphere[21],Sphere[ 5]] = 
  GroupGeneratedBy[
   o[eta[5],epsilonbar[6]],
   o[mu[5],sigma[14]]
  ]

HomotopySet[Sphere[22],Sphere[ 6]] = 
  GroupGeneratedBy[
   o[eta[6],epsilonbar[7]],
   o[mu[6],sigma[15]],
   zetaprime
  ]

HomotopySet[Sphere[23],Sphere[ 7]] = 
  GroupGeneratedBy[
   o[eta[7],epsilonbar[8]],
   o[mu[7],sigma[16]],
   Sigma[zetaprime],
   o[sigmaprime,mu[14]]
  ]

HomotopySet[Sphere[24],Sphere[ 8]] = 
  GroupGeneratedBy[
   o[eta[8],epsilonbar[9]],
   o[mu[8],sigma[17]],
   Sigma[Sigma[zetaprime]],
   o[sigma[8],nu[15],nu[18],nu[21]],
   o[sigma[8],mu[15]],
   o[sigma[8],eta[15],epsilon[16]],
   o[Sigma[sigmaprime],mu[15]]
  ]

HomotopySet[Sphere[25],Sphere[ 9]] = 
  GroupGeneratedBy[
   o[mu[9],sigma[18]],
   o[sigma[9],nu[16],nu[19],nu[22]],
   o[sigma[9],mu[16]],
   o[sigma[9],eta[16],epsilon[17]]
  ]

HomotopySet[Sphere[26],Sphere[10]] = 
  GroupGeneratedBy[
   o[sigma[10],mu[17]],
   o[w[10],sigma[19]]
  ]

HomotopySet[Sphere[27],Sphere[11]] = 
  GroupGeneratedBy[ 
   o[sigma[11],mu[18]]
  ]

HomotopySet[Sphere[28],Sphere[12]] = 
  GroupGeneratedBy[
   o[sigma[12],mu[19]]
  ]

HomotopySet[Sphere[29],Sphere[13]] = 
  GroupGeneratedBy[
   o[sigma[13],mu[20]]
  ]

HomotopySet[Sphere[30],Sphere[14]] = 
  GroupGeneratedBy[
   o[sigma[14],mu[21]],
   omega[14]
  ]

HomotopySet[Sphere[31],Sphere[15]] = 
  GroupGeneratedBy[
   o[sigma[15],mu[22]],
   omega[15],
   etastarprime
  ]

HomotopySet[Sphere[32],Sphere[16]] = 
  GroupGeneratedBy[
   o[sigma[16],mu[23]],
   omega[16],
   Sigma[etastarprime],
   etastar[16]
  ]

HomotopySet[Sphere[33],Sphere[17]] = 
  GroupGeneratedBy[
   o[sigma[17],mu[24]],
   omega[17],
   etastar[17]
  ]

HomotopySet[Sphere[k_],Sphere[n_]] :=
  GroupGeneratedBy[
   o[sigma[n],mu[n+7]],
   omega[n]
  ] /; k == n+16 && n>=18

(************************************************************************)
(* \\pi_{n+17}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.7, p139"      /; n === m+17 && m>1 && m<=9

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.17, p155"     /; n === m+17 && m>1 && m>9

HomotopySet[Sphere[19],Sphere[ 2]] = 
 GroupGeneratedBy[
  o[eta[2],mu[3],sigma[12]],
  o[eta[2],eta[3],epsilonbar[4]]
 ]

HomotopySet[Sphere[20],Sphere[ 3]] = 
 GroupGeneratedBy[
  o[eta[3],mu[4],sigma[13]],
  epsilonbarprime,
  mubar[3]
 ]

HomotopySet[Sphere[21],Sphere[ 4]] = 
 GroupGeneratedBy[
  o[eta[4],mu[5],sigma[14]],
  Sigma[epsilonbarprime],
  mubar[4],
  o[nu[4],sigmaprime,sigma[14]],
  o[nu[4],kappa[7]]
 ]

HomotopySet[Sphere[22],Sphere[ 5]] = 
 GroupGeneratedBy[
  o[eta[5],mu[6],sigma[15]],
  mubar[5],
  o[nu[5],kappa[8]]
 ]

HomotopySet[Sphere[23],Sphere[ 6]] = 
 GroupGeneratedBy[
  o[eta[6],mu[7],sigma[16]],
  mubar[6],
  o[nu[6],kappa[9]],
  WhiteheadP[Sigma[theta]]
 ]

HomotopySet[Sphere[24],Sphere[ 7]] = 
 GroupGeneratedBy[
  o[eta[7],mu[8],sigma[17]],
  mubar[7],
  o[nu[7],kappa[10]],
  o[sigmaprime,eta[14],mu[15]]
 ]

HomotopySet[Sphere[25],Sphere[ 8]] = 
 GroupGeneratedBy[
  o[eta[8],mu[9],sigma[18]],
  mubar[8],
  o[nu[8],kappa[11]],
  o[Sigma[sigmaprime],eta[15],mu[16]],
  o[sigma[8],eta[15],mu[16]]
 ]

HomotopySet[Sphere[26],Sphere[ 9]] = 
 GroupGeneratedBy[
  o[eta[9],mu[10],sigma[19]],
  mubar[9],
  o[nu[9],kappa[12]],
  o[sigma[9],eta[16],mu[17]]
 ]

HomotopySet[Sphere[27],Sphere[10]] = 
 GroupGeneratedBy[
  mubar[10],
  o[nu[10],kappa[13]],
  o[sigma[10],eta[17],mu[18]]
 ]

HomotopySet[Sphere[28],Sphere[11]] = 
 GroupGeneratedBy[
  mubar[11],
  o[nu[11],kappa[14]],
  o[sigma[11],eta[18],mu[19]]
 ]

HomotopySet[Sphere[29],Sphere[12]] = 
 GroupGeneratedBy[
  mubar[12],
  o[nu[12],kappa[15]],
  o[sigma[12],eta[19],mu[20]],
  epsilonstar[12]
 ]

HomotopySet[Sphere[30],Sphere[13]] = 
 GroupGeneratedBy[
  mubar[13],
  o[nu[13],kappa[16]],
  o[sigma[13],eta[20],mu[21]],
  epsilonstar[13]
 ]

HomotopySet[Sphere[31],Sphere[14]] = 
 GroupGeneratedBy[
  mubar[14],
  o[nu[14],kappa[17]],
  o[sigma[14],eta[21],mu[22]],
  epsilonstar[14]
 ]

HomotopySet[Sphere[32],Sphere[15]] = 
 GroupGeneratedBy[
  mubar[15],
  o[nu[15],kappa[18]],
  o[sigma[15],eta[22],mu[23]],
  epsilonstar[15],
  o[etastarprime,eta[31]]
 ]

HomotopySet[Sphere[33],Sphere[16]] = 
 GroupGeneratedBy[
  mubar[16],
  o[nu[16],kappa[19]],
  o[sigma[16],eta[23],mu[24]],
  epsilonstar[16],
  o[Sigma[etastarprime],eta[32]],
  o[etastar[16],eta[32]]
 ]

HomotopySet[Sphere[34],Sphere[17]] = 
 GroupGeneratedBy[
  mubar[17],
  o[nu[17],kappa[20]],
  o[sigma[17],eta[24],mu[25]],
  epsilonstar[17],
  o[etastar[17],eta[33]]
 ]

HomotopySet[Sphere[35],Sphere[18]] = 
 GroupGeneratedBy[
  mubar[18],
  o[nu[18],kappa[21]],
  o[sigma[18],eta[25],mu[26]],
  epsilonstar[18],
  w[18]
 ]

HomotopySet[Sphere[k_],Sphere[n_]] := 
 GroupGeneratedBy[
  mubar[n],
  o[nu[n],kappa[n+3]],
  o[sigma[n],eta[n+7],mu[n+8]],
  epsilonstar[n]
 ] /; k == n+17 && n >= 19


(************************************************************************)
(* \\pi_{n+18}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.8, p139"      /; n === m+18 && m>1 && m<=9

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.22, p162"     /; n === m+18 && m>1 && m>9


HomotopySet[Sphere[20],Sphere[ 2]] = 
 GroupGeneratedBy[
  o[eta[2],mubar[3]],
  o[eta[2],epsilonbarprime],
  o[eta[2],eta[3],mu[4],sigma[13]]
 ]

HomotopySet[Sphere[21],Sphere[ 3]] = 
 GroupGeneratedBy[
  o[eta[3],mubar[4]],
  o[muprime,sigma[14]],
  o[nuprime,epsilonbar[6]]
 ]

HomotopySet[Sphere[22],Sphere[ 4]] = 
 GroupGeneratedBy[
  o[eta[ 4],mubar[ 5]],
  o[Sigma[muprime],sigma[15]],
  o[Sigma[nuprime],epsilonbar[7]],
  o[nu[4],epsilonbar[7]],
  o[nu[4],rhosecond],
  o[nu[4],sigmaprime,nubar[14]],
  o[nu[4],sigmaprime,epsilon[14]]
 ]

HomotopySet[Sphere[23],Sphere[ 5]] = 
 GroupGeneratedBy[
  o[eta[ 5],mubar[ 6]],
  o[nu[5],epsilonbar[8]],
  o[zeta[5],sigma[16]]
 ]

HomotopySet[Sphere[24],Sphere[ 6]] = 
 GroupGeneratedBy[
  o[eta[ 6],mubar[ 7]],
  o[zeta[6],sigma[17]],
  o[WhiteheadP[Sigma[theta]],eta[23]]
 ]

HomotopySet[Sphere[25],Sphere[ 7]] = 
 GroupGeneratedBy[
  o[eta[ 7],mubar[ 8]],
  o[zeta[7],sigma[18]]
 ]

HomotopySet[Sphere[26],Sphere[ 8]] = 
 GroupGeneratedBy[
  o[eta[ 8],mubar[ 9]],
  o[zeta[8],sigma[19]],
  o[sigma[8],zeta[15]]
 ]

HomotopySet[Sphere[27],Sphere[ 9]] = 
 GroupGeneratedBy[
  o[eta[ 9],mubar[10]],
  o[sigma[9],zeta[16]]
 ]

HomotopySet[Sphere[28],Sphere[10]] = 
 GroupGeneratedBy[
  o[eta[10],mubar[11]],
  lambdasecond,
  xisecond
 ]

HomotopySet[Sphere[29],Sphere[11]] = 
 GroupGeneratedBy[
  o[eta[11],mubar[12]],
  lambdaprime,
  xiprime
 ]

HomotopySet[Sphere[30],Sphere[12]] = 
 GroupGeneratedBy[
  o[eta[12],mubar[13]],
  Sigma[lambdaprime],
  Sigma[xiprime],
  xi[12]
 ]

HomotopySet[Sphere[31],Sphere[13]] = 
 GroupGeneratedBy[
  o[eta[13],mubar[14]],
  xi[13],
  lambda
 ]

HomotopySet[Sphere[32],Sphere[14]] = 
 GroupGeneratedBy[
  o[eta[14],mubar[15]],
  xi[14],
  Sigma[lambda]
 ]

HomotopySet[Sphere[33],Sphere[15]] = 
 GroupGeneratedBy[
  o[eta[15],mubar[16]],
  xi[15],
  Sigma[Sigma[lambda]]
 ]

HomotopySet[Sphere[34],Sphere[16]] = 
 GroupGeneratedBy[
  o[eta[16],mubar[17]],
  xi[16],
  Sigma[Sigma[Sigma[lambda]]],
  nustar[16]
 ]

HomotopySet[Sphere[35],Sphere[17]] = 
 GroupGeneratedBy[
  o[eta[17],mubar[18]],
  xi[17],
  nustar[17]
 ]

HomotopySet[Sphere[36],Sphere[18]] = 
 GroupGeneratedBy[
  o[eta[18],mubar[19]],
  xi[18] + nustar[18],
  nustar[18]
 ]

HomotopySet[Sphere[37],Sphere[19]] = 
 GroupGeneratedBy[
  o[eta[19],mubar[20]],
  xi[19] + nustar[19],
  nustar[19]
 ]

HomotopySet[Sphere[k_],Sphere[n_]] := 
 GroupGeneratedBy[
  o[eta[n],mubar[n+1]],
  nustar[n]
 ] /; k == n+18 && n >= 20


(************************************************************************)
(* \\pi_{n+19}(S^n)                                                     *)

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.9, p140"      /; n === m+19 && m>1 && m<=9

SpherePiReference[n_,m_] :=
  "Toda, Theorem 12.23, p162"     /; n === m+19 && m>1 && m<=9

HomotopySet[Sphere[21],Sphere[ 2]] = 
 GroupGeneratedBy[
  o[eta[2],muprime,sigma[14]],
  o[eta[2],nuprime,epsilonbar[6]],
  o[eta[2],eta[3],mubar[4]]
 ]

HomotopySet[Sphere[22],Sphere[ 3]] = 
 GroupGeneratedBy[
  mubarprime,
  o[nuprime,mu[6],sigma[15]]
 ]

HomotopySet[Sphere[23],Sphere[ 4]] = 
 GroupGeneratedBy[
  Sigma[mubarprime],
  o[Sigma[nuprime],mu[7],sigma[16]],
  o[nu[4],mu[7],sigma[16]],
  o[nu[4],sigmaprime,mu[14]],
  o[nu[4],Sigma[zetaprime]],
  o[nu[4],eta[7],epsilonbar[8]]
 ]

HomotopySet[Sphere[24],Sphere[ 5]] = 
 GroupGeneratedBy[
  o[nu[5],mu[8],sigma[17]],
  zetabar[5]
 ]

HomotopySet[Sphere[25],Sphere[ 6]] = 
 GroupGeneratedBy[
  zetabar[6],
  sigmabar[6]
 ]

HomotopySet[Sphere[26],Sphere[ 7]] = 
 GroupGeneratedBy[
  zetabar[7],
  sigmabar[7]
 ]

HomotopySet[Sphere[27],Sphere[ 8]] = 
 GroupGeneratedBy[
  zetabar[8],
  sigmabar[8]
 ]

HomotopySet[Sphere[28],Sphere[ 9]] = 
 GroupGeneratedBy[
  zetabar[9],
  sigmabar[9]
 ]

HomotopySet[Sphere[29],Sphere[10]] = 
 GroupGeneratedBy[
  zetabar[10],
  sigmabar[10]
 ]

HomotopySet[Sphere[30],Sphere[11]] = 
 GroupGeneratedBy[
  zetabar[11],
  sigmabar[11],
  o[lambdaprime,eta[29]],
  o[xiprime,eta[29]]
 ]

HomotopySet[Sphere[31],Sphere[12]] = 
 GroupGeneratedBy[
  zetabar[12],
  sigmabar[12],
  o[Sigma[lambdaprime],eta[30]],
  o[Sigma[xiprime],eta[30]],
  omegaprime,
  o[xi[12],eta[30]]
 ]

HomotopySet[Sphere[32],Sphere[13]] = 
 GroupGeneratedBy[
  zetabar[13],
  sigmabar[13],
  Sigma[omegaprime],
  o[xi[13],eta[31]]
 ]

HomotopySet[Sphere[33],Sphere[14]] = 
 GroupGeneratedBy[
  zetabar[14],
  sigmabar[14],
  o[omega[14],nu[30]]
 ]

HomotopySet[Sphere[34],Sphere[15]] = 
 GroupGeneratedBy[
  zetabar[15],
  sigmabar[15],
  o[omega[15],nu[31]]
 ]

HomotopySet[Sphere[35],Sphere[16]] = 
 GroupGeneratedBy[
  zetabar[16],
  sigmabar[16],
  o[omega[16],nu[32]]
 ]

HomotopySet[Sphere[36],Sphere[17]] = 
 GroupGeneratedBy[
  zetabar[17],
  sigmabar[17],
  o[omega[17],nu[33]]
 ]

HomotopySet[Sphere[37],Sphere[18]] = 
 GroupGeneratedBy[
  zetabar[18],
  sigmabar[18]
 ]

HomotopySet[Sphere[38],Sphere[19]] = 
 GroupGeneratedBy[
  zetabar[19],
  sigmabar[19]
 ]

HomotopySet[Sphere[39],Sphere[20]] = 
 GroupGeneratedBy[
  zetabar[20],
  sigmabar[20],
  w[20]
 ]

HomotopySet[Sphere[k_],Sphere[n_]] := 
 GroupGeneratedBy[
  zetabar[n],
  sigmabar[n]
 ] /; k == n+19 && n >= 21


(************************************************************************)
(* Genealogy data                                                       *)

gpad[stem_,u_] := 
 (u /. x[n_,J_] :> x[n,Join[J,Table[-1,{stem-Length[J]}]]])

gunpad[u_] := (u /. x[n_,J_] :> x[n,Select[J,Positive]])

GenealogySort[stem_,u_] := gunpad[Sort[gpad[stem,u]]]

GenealogyName[x_Plus] := GenealogyName /@ x
TwoPowerQ[n_Integer] := 
 ((First /@ FactorInteger[2n]) === {2})
TwoAdicValuation[n_Integer] := 
 Select[FactorInteger[2n],First[#] == 2 &][[1,2]] - 1

GenealogyName[n_Integer a_] :=
 Module[{m,b,r,u},
  m = n;
  If[Head[AdditiveOrder[x]] == Integer,
   m = Mod[m,AdditiveOrder[x]]
  ];
  b = IntegerDigits[m,2];
  r = Length[b];
  u = 0;
  Do[
   If[b[[r-i]] == 1,u = u+GenealogyName[2^i a]],
   {i,0,r-1}
  ];
  If[m < 0,u = -u];
  u
 ] /; Not[TwoPowerQ[n]]

SetGenealogy[a_,J_List] := 
 Module[{t},
  t = TargetSphere[a];
  TodaName[x[t,J]] = a;
  GenealogyName[a] = x[t,J];
 ]

SetGenealogy[a_,u_x] := 
 Module[{},
  TodaName[u] = a;
  GenealogyName[a] = u;
 ]

SetStableGenealogy[a_Symbol,n_,J_] :=
 Module[{},
  TodaName[x[m_,J]] := a[m] /; m >= n;
  GenealogyName[a[m_]] := x[m,J] /; m >= n
 ]

SetStableGenealogy[d_Integer a_Symbol,n_,J_] :=
 Module[{},
  TodaName[x[m_,J]] := d a[m] /; m >= n;
  GenealogyName[d a[m_]] := x[m,J] /; m >= n
 ]

MaximalDesuspensions[a_] :=
 Module[{tgt,stem,t,A,B},
  tgt = TargetSphere[a];
  stem = Stem[a];
  t = tgt+1;
  B = {a};
  While[B =!= {},
   t = t-1;
   A = B;
   G = TorsionSubgroup[SpherePi[t+stem-1,t-1]];
   B = Select[Elements[G],
	      MemberQ[A,Zap[Sigma[#]]] &];
  ];
  A 
 ]

FindGenealogy[a_] :=
 Module[{n},
  n = TargetSphere[a];
  GenealogySort[Stem[a],
   Union[GenealogyName /@ Zap[Hopf /@ MaximalDesuspensions[a]]] /.
       x[i_,{j___}] :> x[n,{(i-1)/2,j}]
  ]
 ]

ShowGenealogy[a_] := 
 Module[{X,u}, 
  If[Head[GenealogyName[a]] =!= GenealogyName,
   Return[""]
  ];
  X = FindGenealogy[a];
  s = StringJoin["SetGenealogy[", 
	         ToString[InputForm[a]], ",",
	         ToString[InputForm[First[X]]], "]\n"];
  If[Length[X] > 1,
   s = StringJoin[s,"Other possibilities:\n",
        ToString[InputForm[X]],"\n\n"]];
  s
 ]

ShowGenealogy[stem_, tgt_] :=
 StringJoin @@ 
  (ShowGenealogy /@ pBasis[TorsionSubgroup[SpherePi[stem+tgt,tgt]]])

(**********************************************************************)

GenealogyName[w[d_?EvenQ]] := x[d,{d-1,0}] /; d == 6 || d > 8
GenealogyName[n_Integer w[d_?EvenQ]] := 
 Module[{b,r,u},
  b = IntegerDigits[n,2];
  r = Length[b];
  u = 0;
  Do[
   If[b[[r-i]] == 1,
     u = u+x[d,Join[{d-1},Table[0,{i+1}]]]
   ],
   {i,0,r-1}
  ];
  If[n < 0,u = -u];
  u
 ] /; d == 6 || d > 8

TodaName[x[n_?EvenQ,{m_,0,i___}]] := 2^Length[{i}] w[n] /;
 m == n-1 && n > 8 && Equal[0,i]

(* 0-stem *)

TodaName[x[n_,{i__}]] := 2^Length[{i}] iota[n] /; Equal[0,i]
GenealogyName[iota[d_]] := x[d,{}]
GenealogyName[n_Integer iota[d_]] := 
 Module[{b,r,u},
  b = IntegerDigits[n,2];
  r = Length[b];
  u = 0;
  Do[
   If[b[[r-i]] == 1,
     u = u+x[d,Table[0,{i}]]
   ],
   {i,0,r-1}
  ];
  If[n < 0,u = -u];
  u
 ]

(* 1-stem *)

SetStableGenealogy[eta,2,{1}]

TodaName[x[2,{1,i__}]] := 2^Length[{i}] eta[2] /; Equal[0,i]
GenealogyName[(n_Integer:1) eta[2]] := 
 Module[{b,r,u},
  b = IntegerDigits[n,2];
  r = Length[b];
  u = 0;
  Do[
   If[b[[r-i]] == 1,
     u = u+x[2,Join[{1},Table[0,{i}]]]
   ],
   {i,0,r-1}
  ];
  If[n < 0,u = -u];
  u
 ]

(* 2-stem *)

TodaName[x[n_,{1,1}]] := 
 o[eta[n],eta[n+1]] /; n >= 2

GenealogyName[o[eta[n_],eta[m_]]] :=
 x[n,{1,1}] /; m == n+1 && n >= 2

(* 3-stem *)

SetGenealogy[o[eta[2],eta[3],eta[4]],x[2,{1,1,1}]]
SetGenealogy[2 nuprime,x[3,{1,1,1}]]
SetGenealogy[nuprime,x[3,{2,1}]]
SetGenealogy[2 Sigma[nuprime],x[4,{1,1,1}]]
SetGenealogy[Sigma[nuprime],x[4,{2,1}]]

SetStableGenealogy[nu,4,{3}]
TodaName[x[4,{3,i__}]] := 2^Length[{i}] nu[4] /; Equal[0,i]
GenealogyName[(n_Integer:1) nu[4]] := 
 Module[{b,r,u},
  b = IntegerDigits[n,2];
  r = Length[b];
  u = 0;
  Do[
   If[b[[r-i]] == 1,
     u = u+x[4,Join[{3},Table[0,{i}]]]
   ],
   {i,0,r-1}
  ];
  If[n < 0,u = -u];
  u
 ]

TodaName[x[n_,{1,1,1}]] := 
 4 nu[n] /; n >= 5

GenealogyName[4 nu[n_]] := 
 x[n,{1,1,1}] /; n >= 5
 
TodaName[x[n_,{2,1}]] := 
 2 nu[n] /; n >= 5

GenealogyName[2 nu[n_]] :=
 x[n,{2,1}] /; n >= 5

(* 4-stem *)

TodaName[x[2,{1,1,1,1}]] =
 - o[eta[2],nuprime]

GenealogyName[o[eta[2],nuprime]] = 
 - x[2,{1,1,1,1}]

SetGenealogy[2 o[eta[2],nuprime],x[2,{1,2,1}]]

SetGenealogy[o[nuprime,eta[6]],x[3,{2,1,1}]]
SetGenealogy[o[nu[4],eta[7]],x[4,{3,1}]]
SetGenealogy[o[nu[5],eta[8]],x[5,{3,1}]]

(* 5-stem *)

SetGenealogy[o[eta[2],nuprime,eta[6]],x[2,{1,2,1,1}]]
SetGenealogy[o[nuprime,eta[6],eta[7]],x[3,{2,1,1,1}]]
SetGenealogy[o[nu[4], eta[7], eta[8]],x[4, {3, 1, 1}]]
SetGenealogy[o[Sigma[nuprime], eta[7], eta[8]],x[4, {2, 1, 1, 1}]]
SetGenealogy[o[nu[5], eta[8], eta[9]],x[5, {3, 1, 1}]]
SetGenealogy[w[6],x[6,{5,0}]]

(* 6-stem *)

SetGenealogy[o[eta[2], nuprime, eta[6], eta[7]],x[2, {1, 2, 1, 1, 1}]]
SetGenealogy[o[nu[4], nu[7]],x[4, {3, 3}]]
SetGenealogy[2*o[nu[4], nu[7]],x[4, {3, 2, 1}]]
SetGenealogy[4*o[nu[4], nu[7]],x[4, {3, 1, 1, 1}]]

GenealogyName[o[nu[n_], nu[m_]]] := x[n, {3, 3}] /; m == n+3 && n>=5
TodaName[x[n_,{3,3}]] := o[nu[n],nu[n+3]] /; n>=5

(* 7-stem *)

SetStableGenealogy[sigma,8,{7}]
TodaName[x[8,{7,i__}]] := 2^Length[{i}] sigma[8] /; Equal[0,i]
GenealogyName[(n_Integer:1) sigma[8]] := 
 Module[{b,r,u},
  b = IntegerDigits[n,2];
  r = Length[b];
  u = 0;
  Do[
   If[b[[r-i]] == 1,
     u = u+x[8,Join[{7},Table[0,{i}]]]
   ],
   {i,0,r-1}
  ];
  If[n < 0,u = -u];
  u
 ]

SetGenealogy[sigmathird,x[5, {4, 1, 1, 1}]]
SetGenealogy[sigmasecond,x[6, {5, 1, 1}]]
SetGenealogy[2*sigmasecond,x[6, {4, 1, 1, 1}]]
SetGenealogy[sigmaprime,x[7, {6, 1}]]
SetGenealogy[2*sigmaprime,x[7, {5, 1, 1}]]
SetGenealogy[4*sigmaprime,x[7, {4, 1, 1, 1}]]
SetStableGenealogy[sigma,8,{7}]
SetGenealogy[Sigma[sigmaprime],x[8, {6, 1}]]
SetGenealogy[2*Sigma[sigmaprime],x[8, {5, 1, 1}]]
SetGenealogy[4*Sigma[sigmaprime],x[8, {4, 1, 1, 1}]]

SetStableGenealogy[2 sigma,9,{6,1}]
SetStableGenealogy[4 sigma,9,{5,1,1}]
SetStableGenealogy[8 sigma,9,{4,1,1,1}]

(* 8-stem *)

SetStableGenealogy[epsilon,3,{2,3,3}]
SetStableGenealogy[nubar,6, {5, 3}]
SetGenealogy[2*nubar[6],x[6, {5, 2, 1}]]
SetGenealogy[4*nubar[6],x[6, {5, 1, 1, 1}]]
SetGenealogy[o[sigmaprime, eta[14]],x[7, {6, 1, 1}]]
SetGenealogy[o[Sigma[sigmaprime], eta[15]],x[8, {6, 1, 1}]]
SetGenealogy[o[sigma[8], eta[15]],x[8, {7, 1}]]
SetGenealogy[o[sigma[9], eta[16]],x[9, {7, 1}]]

(* 9-stem *)

SetStableGenealogy[mu,3,{2,4,1,1,1}]
GenealogyName[o[eta[n_],epsilon[m_]]] := 
 x[n,{1,2,3,3}] /; m == n+1 && n >= 2
TodaName[x[n_,{1,2,3,3}]] := o[eta[n],epsilon[n+1]]

SetGenealogy[o[nu[4], nu[7], nu[10]],x[4, {3, 3, 3}]]
GenealogyName[o[nu[n_],nu[m_],nu[p_]]] := 
 x[n,{3,3,3}] /; m == n+3 && p == m+3 && n >= 4
TodaName[x[n_,{3,3,3}]] :=
 o[nu[n],nu[n+3],nu[n+6]] /; n >= 4

SetGenealogy[o[sigmaprime, eta[14], eta[15]],x[7, {6, 1, 1, 1}]]
SetGenealogy[o[Sigma[sigmaprime], eta[15], eta[16]],x[8, {6, 1, 1, 1}]]
SetGenealogy[o[sigma[8], eta[15], eta[16]],x[8, {7, 1, 1}]]
SetGenealogy[o[sigma[9], eta[16], eta[17]],x[9, {7, 1, 1}]]

(* 10-stem *)

GenealogyName[o[eta[n_],mu[m_]]] := 
 x[n,{1,2,4,1,1,1}] /; m == n+1 && n >= 2
TodaName[x[n_,{1,2,4,1,1,1}]] := o[eta[n],mu[n+1]]

SetGenealogy[o[eta[2], eta[3], epsilon[4]],x[2, {1, 1, 2, 3, 3}]]
SetGenealogy[epsilonprime,x[3, {2, 2, 3, 3}]]
SetGenealogy[2*epsilonprime,x[3, {1, 1, 2, 3, 3}]]
SetGenealogy[Sigma[epsilonprime],x[4, {2, 2, 3, 3}]]
SetGenealogy[2*Sigma[epsilonprime],x[4, {1, 1, 2, 3, 3}]]
SetGenealogy[o[nu[4], sigmaprime],x[4, {3, 6, 1}]]
SetGenealogy[2*o[nu[4], sigmaprime],x[4, {3, 5, 1, 1}]]
SetGenealogy[4*o[nu[4], sigmaprime],x[4, {3, 4, 1, 1, 1}]]
SetGenealogy[o[nu[5], sigma[8]],x[5, {4, 3, 3}]]
SetGenealogy[2*o[nu[5], sigma[8]],x[5, {2, 2, 3, 3}]]
SetGenealogy[4*o[nu[5], sigma[8]],x[5, {1, 1, 2, 3, 3}]]
SetGenealogy[o[nu[6], sigma[9]],x[6, {4, 3, 3}]]
SetGenealogy[2*o[nu[6], sigma[9]],x[6, {2, 2, 3, 3}]]
SetGenealogy[4*o[nu[6], sigma[9]],x[6, {1, 1, 2, 3, 3}]]
SetGenealogy[o[nu[7], sigma[10]],x[7, {4, 3, 3}]]
SetGenealogy[2*o[nu[7], sigma[10]],x[7, {2, 2, 3, 3}]]
SetGenealogy[4*o[nu[7], sigma[10]],x[7, {1, 1, 2, 3, 3}]]
SetGenealogy[o[nu[8], sigma[11]],x[8, {4, 3, 3}]]
SetGenealogy[2*o[nu[8], sigma[11]],x[8, {2, 2, 3, 3}]]
SetGenealogy[4*o[nu[8], sigma[11]],x[8, {1, 1, 2, 3, 3}]]
SetGenealogy[o[sigma[8], nu[15]],x[8, {7, 3}]]
SetGenealogy[2*o[sigma[8], nu[15]],x[8, {7, 2, 1}]]
SetGenealogy[4*o[sigma[8], nu[15]],x[8, {7, 1, 1, 1}]]
SetGenealogy[o[sigma[9], nu[16]],x[9, {7, 3}]]
SetGenealogy[2*o[sigma[9], nu[16]],x[9, {7, 2, 1}]]
SetGenealogy[4*o[sigma[9], nu[16]],x[9, {7, 1, 1, 1}]]
SetGenealogy[o[sigma[10], nu[17]],x[10, {7, 3}]]
SetGenealogy[2*o[sigma[10], nu[17]],x[10, {7, 2, 1}]]
SetGenealogy[o[sigma[11], nu[18]],x[11, {7, 3}]]

(* 11-stem *)

GenealogyName[o[eta[2], epsilonprime]] =
 x[2, {1, 2, 2, 3, 3}] + x[2, {1, 1, 1, 2, 3, 3}]
TodaName[x[2,{1,2,2,3,3}]] = 3 o[eta[2],epsilonprime]

SetGenealogy[2*o[eta[2], epsilonprime],x[2, {1, 1, 1, 2, 3, 3}]]
SetGenealogy[o[eta[2], eta[3], mu[4]],x[2, {1, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[muprime,x[3, {2, 2, 4, 1, 1, 1}]]
SetGenealogy[2*muprime,x[3, {1, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[epsilon[3], nu[11]],x[3, {2, 3, 3, 3}]]
SetGenealogy[o[nuprime, epsilon[6]],x[3, {2, 1, 2, 3, 3}]]
SetGenealogy[Sigma[muprime],x[4, {2, 2, 4, 1, 1, 1}]]
SetGenealogy[2*Sigma[muprime],x[4, {1, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[epsilon[4], nu[12]],x[4, {2, 3, 3, 3}]]
SetGenealogy[o[Sigma[nuprime], epsilon[7]],x[4, {2, 1, 2, 3, 3}]]
SetGenealogy[o[nu[4], sigmaprime, eta[14]],x[4, {3, 6, 1, 1}]]
SetGenealogy[o[nu[4], nubar[7]],x[4, {3, 5, 3}]]
SetGenealogy[o[nu[4], epsilon[7]],x[4, {3, 2, 3, 3}]]
SetGenealogy[o[nu[5], nubar[8]],x[5, {3, 5, 3}]]
SetGenealogy[o[nu[5], epsilon[8]],x[5, {3, 2, 3, 3}]]
SetGenealogy[o[nubar[6], nu[14]],x[6, {5, 3, 3}]]
SetGenealogy[2*o[nubar[6], nu[14]],x[6, {3, 2, 3, 3}]]
SetGenealogy[o[nubar[7], nu[15]],x[7, {5, 3, 3}]]
SetGenealogy[o[nubar[8], nu[16]],x[8, {5, 3, 3}]]
SetGenealogy[o[nubar[9], nu[17]],x[9, {5, 3, 3}]]

SetStableGenealogy[zeta,5,{4, 4, 1, 1, 1}]
SetStableGenealogy[2 zeta,5, {2, 2, 4, 1, 1, 1}]
SetStableGenealogy[4 zeta,5, {1, 1, 2, 4, 1, 1, 1}]

(* 12-stem *)

GenealogyName[o[eta[2],muprime]] = 
 x[2, {1, 2, 2, 4, 1, 1, 1}] + x[2, {1, 1, 1, 2, 4, 1, 1, 1}]
TodaName[x[2,{1,2,2,4,1,1,1}]] = 3 o[eta[2],muprime]

SetGenealogy[2*o[eta[2],muprime],x[2,{1,1,1,2,4,1,1,1}]]
SetGenealogy[o[eta[2],epsilon[3],nu[11]],x[2,{1,2,3,3,3}]]
SetGenealogy[o[eta[2],nuprime,epsilon[6]],x[2,{1,2,1,2,3,3}]]
SetGenealogy[o[nuprime,mu[6]],x[3,{2,1,2,4,1,1,1}]]
SetGenealogy[o[nuprime,eta[6],epsilon[7]],x[3,{2,1,1,2,3,3}]]
SetGenealogy[o[nu[4],sigmaprime,eta[14],eta[15]],x[4,{3,6,1,1,1}]]
SetGenealogy[o[nu[4],nu[7],nu[10],nu[13]],x[4,{3,3,3,3}]]
SetGenealogy[o[nu[4],mu[7]],x[4,{3,2,4,1,1,1}]]
SetGenealogy[o[nu[4],eta[7],epsilon[8]],x[4,{3,1,2,3,3}]]
SetGenealogy[o[Sigma[nuprime],mu[7]],x[4,{2,1,2,4,1,1,1}]]
SetGenealogy[o[Sigma[nuprime],eta[7],epsilon[8]],x[4,{2,1,1,2,3,3}]]
SetGenealogy[o[nu[5],nu[8],nu[11],nu[14]],x[5,{3,3,3,3}]]
SetGenealogy[o[nu[5],mu[8]],x[5,{3,2,4,1,1,1}]]
SetGenealogy[o[nu[5],eta[8],epsilon[9]],x[5,{3,1,2,3,3}]]
SetGenealogy[o[w[6],sigma[11]],x[6,{5,6,1}]]
SetGenealogy[2*o[w[6],sigma[11]],x[6,{5,5,1,1}]]
SetGenealogy[4*o[w[6],sigma[11]],x[6,{5,4,1,1,1}]]
SetGenealogies[8*o[w[6],sigma[11]],x[6,{3,2,4,1,1,1}]]
SetGenealogy[8*o[w[6], sigma[11]],x[6, {3, 2, 4, 1, 1, 1}]]
SetGenealogy[o[w[10], nu[19]],x[10, {9, 2, 1}]]
SetGenealogy[2*o[w[10], nu[19]],x[10, {9, 1, 1, 1}]]
SetGenealogy[thetaprime,x[11, {10, 1, 1}]]
SetGenealogy[theta,x[12, {11, 1}]]
SetGenealogy[Sigma[thetaprime],x[12, {10, 1, 1}]]
SetGenealogy[Sigma[theta],x[13, {11, 1}]]

(* 13-stem *)
SetGenealogy[o[eta[2], nuprime, mu[6]],x[2, {1, 2, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[eta[2], nuprime, eta[6], epsilon[7]],x[2, {1, 2, 1, 1, 2, 3, 3}]]
SetGenealogy[o[nuprime, eta[6], mu[7]],x[3, {2, 1, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[nu[4], nu[7], sigma[10]],x[4, {3, 4, 3, 3}]]
SetGenealogy[2*o[nu[4], nu[7], sigma[10]],x[4, {3, 2, 2, 3, 3}]]
SetGenealogy[4*o[nu[4], nu[7], sigma[10]],x[4, {3, 1, 1, 2, 3, 3}]]
SetGenealogy[o[nu[4], eta[7], mu[8]],x[4, {3, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[Sigma[nuprime], eta[7], mu[8]],x[4, {2, 1, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[nu[5], sigma[8], nu[15]],x[5, {4, 3, 3, 3}]]
SetGenealogy[o[nu[5], eta[8], mu[9]],x[5, {3, 1, 2, 4, 1, 1, 1}]]
SetGenealogy[o[nu[6], sigma[9], nu[16]],x[6, {4, 3, 3, 3}]]
SetGenealogy[o[nu[7], sigma[10], nu[17]],x[7, {4, 3, 3, 3}]]
SetGenealogy[o[sigma[8], nu[15], nu[18]],x[8, {7, 3, 3}]]
SetGenealogy[o[nu[8], sigma[11], nu[18]],x[8, {4, 3, 3, 3}]]
SetGenealogy[o[sigma[9], nu[16], nu[19]],x[9, {7, 3, 3}]]
SetGenealogy[o[sigma[10], nu[17], nu[20]],x[10, {7, 3, 3}]]
SetGenealogy[o[sigma[11], nu[18], nu[21]],x[11, {7, 3, 3}]]
SetGenealogy[o[thetaprime, eta[23]],x[11, {10, 1, 1, 1}]]
SetGenealogy[o[theta, eta[24]],x[12, {11, 1, 1}]]
SetGenealogy[o[Sigma[thetaprime], eta[24]],x[12, {10, 1, 1, 1}]]
SetGenealogy[o[Sigma[theta], eta[25]],x[13, {11, 1, 1}]]

(**********************************************************************)

RawShowMap[F_,k_Integer,n_Integer] := 
 Module[{l,m,src,tgt,gens,act},
  l = SourceShift[F][k];
  m = TargetShift[F][n];
  src = SpherePi[k,n];
  If[Head[src] =!= Group,
   Return[
    SequenceForm[
     "The source group ",
     SubsuperscriptBox["\[Pi]",k,n],
     " is not known."]]];
  tgt = SpherePi[l,m];
  If[Head[tgt] =!= Group,
   Return[
    SequenceForm[
     "The target group ",
     SubsuperscriptBox["\[Pi]",l,m],
     " is not known."]]];
  gens = Generators[src];
  act = {Format[#],"\[RightTeeArrow]",Format[Zap[F[#]]]} & /@ gens;
  GridBox[
   Join[
   {{SubsuperscriptBox["\[Pi]", k, n], 
     OverscriptBox["\[RightArrow]", Format[F]], 
     SubsuperscriptBox["\[Pi]", l, m]},
    {SpherePi[k,n],"",SpherePi[l,m]}},
   act
   ]]
 ]

ShowMap[F_,s_Integer,t_Integer] := 
 DisplayForm[RawShowMap[F,s,t]]

ShowMap[F_,a_] := 
 Module[{s,t,A},
  s = SourceSphere[a];
  t = TargetSphere[a];
  A = First[RawShowMap[F,s,t]];
  If[Not[MemberQ[Generators[SpherePi[s,t]],a]],
   A = Join[A,{{Format[x],"\[RightTeeArrow]",Zap[F[x]]}}]
  ];
  DisplayForm[GridBox[A]]
 ] /;  SphereQ[Source[a]] && SphereQ[Target[a]];

ShowMap[F_,From[x__]] := ShowMap[F,x]

ShowMap[F_,To[l_Integer,m_Integer]] := 
 Module[{k,n,kk,nn},
  k = kk /. First[Solve[SourceShift[F][kk] == l,kk]];
  n = nn /. First[Solve[TargetShift[F][nn] == m,nn]];
  ShowMap[F,k,n]
 ]

ShowMap[F_,To[a_]] := 
 ShowMap[F,To[SourceSphere[a],TargetSphere[a]]] /;
  SphereQ[Source[a]] && SphereQ[Target[a]];
 


(**********************************************************************)

(*
ExplainRaw[x_] := 
 Module[{y,z,i,r,report,fixed,changed},
  y = x;
  report = {};
  fixed = False;
  While[Not[fixed],
   changed = False;
   i = 1;
   While[ i <= Length[AllRelations] && Not[changed],
    r = AllRelations[[i]];
    z = y /. r;
    If[ z =!= y,
     y = z;
     changed = True;
     report = Join[report,{{y,i}}],
     (* Else *)
     i = i+1
    ]
   ];
   If[ i > Length[AllRelations], fixed = True]
  ];
  report
 ]
 
Explain[x_] := 
 DisplayForm[
  GridBox[
   Join[{{Format[x],"",""}},
   {Format[First[#]],
    Format[AllRelationsStatements[[ Last[#] ]]],
    Format[AllRelationsReasons[[ Last[#] ]]]} & /@
     ExplainRaw[x]
   ],
   ColumnAlignments -> Left
  ]
 ]
*)

EZop[x_] := 
 Module[{y},
  y = Expand[x] //. ExplainedRelations;
  If[ Length[y] > 0,
   y = (# //. ExplainedRelations) & /@ y;];
  y
 ]

EZap[x_] := FixedPoint[EZop,x]

ExplainRaw[x_] :=
 Module[{r,y,l},
  r = Reap[EZap[x]];
  r
 ]

Explain[x_] := 
 Module[{r},
  r = ExplainRaw[x];
  ex = r[[2,1]];
  ex = ({#[[1]],"=",#[[2]],#[[3]],Format[#[[4]]]} & /@ ex);
  ex = Join[{{x,"=",r[[1]],"",""}},ex];
  Print[DisplayForm[GridBox[ex]]];
  r[[1]]
 ]

Null
