reserve x,O for set,
  o for Element of O,
  G,H,I for GroupWithOperators of O,
  A, B for Subset of G,
  N for normal StableSubgroup of G,
  H1,H2,H3 for StableSubgroup of G,
  g1,g2 for Element of G,
  h1,h2 for Element of H1,
  h for Homomorphism of G,H;
reserve E for set,
  A for Action of O,E,
  C for Subset of G,
  N1 for normal StableSubgroup of H1;
reserve y for set,
  H19,H29 for StableSubgroup of G,
  N19 for normal StableSubgroup of H19,
  s1,s19,s2,s29 for CompositionSeries of G,
  fs for FinSequence of the_stable_subgroups_of G,
  f1,f2 for FinSequence,
  i,j,n for Nat;

theorem Th117:
  len s1>1 & len s2>1 implies the_schreier_series_of(s1,s2)
  is_equivalent_with the_schreier_series_of(s2,s1)
proof
  assume that
A1: len s1>1 and
A2: len s2>1;
  set s21 = the_schreier_series_of(s2,s1);
A3: len s1-1>1-1 & len s2-1>1-1 by A1,A2,XREAL_1:9;
  set s12 = the_schreier_series_of(s1,s2);
A4: len s12 = (len s1-1)*(len s2-1) + 1 by A1,A2,Def35;
A5: len s21 = (len s1-1)*(len s2-1) + 1 by A1,A2,Def35;
  then
A6: s21 is not empty by A3;
  (len s1-1)*(len s2-1)>0*(len s2-1) by A3,XREAL_1:68;
  then
A7: (len s1-1)*(len s2-1)+1>0+1 by XREAL_1:6;
A8: now
    set p = {[(j-1)*(len s1-1)+i,(i-1)*(len s2-1)+j] where i,j is Element of
    NAT: 1<=i & i<=len s1-1 & 1<=j & j<=len s2-1};
    now
      let x be object;
      assume x in p;
      then consider i,j be Element of NAT such that
A9:   [(j-1)*(len s1-1)+i,(i-1)*(len s2-1)+j]=x and
      1<=i and
      i<=len s1-1 and
      1<=j and
      j<=len s2-1;
      set z=(i-1)*(len s2-1)+j;
      set y=(j-1)*(len s1-1)+i;
      reconsider y,z as object;
      take y,z;
      thus x = [y,z] by A9;
    end;
    then reconsider p as Relation by RELAT_1:def 1;
    set X = dom the_series_of_quotients_of s12;
    set f1=the_series_of_quotients_of s12;
    set f2=the_series_of_quotients_of s21;
    now
      let x,y1,y2 be object;
      assume [x,y1] in p;
      then consider i1,j1 be Element of NAT such that
A10:  [(j1-1)*(len s1-1)+i1,(i1-1)*(len s2-1)+j1]=[x,y1] and
A11:  1<=i1 & i1<=len s1-1 & 1<=j1 and
      j1<=len s2-1;
A12:  (j1-1)*(len s1-1)+i1=x by A10,XTUPLE_0:1;
      assume [x,y2] in p;
      then consider i2,j2 be Element of NAT such that
A13:  [(j2-1)*(len s1-1)+i2,(i2-1)*(len s2-1)+j2]=[x,y2] and
A14:  1<=i2 & i2<=len s1-1 & 1<=j2 and
      j2<=len s2-1;
A15:  (j2-1)*(len s1-1)+i2=x by A13,XTUPLE_0:1;
      then j1=j2 by A1,A11,A14,A12,Lm45;
      hence y1=y2 by A10,A13,A12,A15,XTUPLE_0:1;
    end;
    then reconsider p as Function by FUNCT_1:def 1;
A16: len s12>1 by A1,A2,A7,Def35;
    then
A17: len f1 + 1= len s12 by Def33;
A18: len s12 = (len s1-1)*(len s2-1)+1 by A1,A2,Def35;
    now
      set l9=(len s1-1)*(len s2-1);
      reconsider l9 as Element of NAT by A3,INT_1:3;
      let y be object;
      assume
A19:  y in X;
      then reconsider k=y as Element of NAT;
A20:  y in Seg len f1 by A19,FINSEQ_1:def 3;
      then
A21:  1<=k by FINSEQ_1:1;
A22:  k<=(len s1-1)*(len s2-1) by A17,A18,A20,FINSEQ_1:1;
      0+(len s1-1)*(len s2-1)<=1+(len s1-1)*(len s2-1) by XREAL_1:6;
      then k<=l9+1 by A22,XXREAL_0:2;
      then
A23:  k in Seg(l9+1) by A21;
      k <> l9+1 by A22,NAT_1:13;
      then consider i,j be Nat such that
A24:  k=(i-1)*(len s2-1)+j & 1<=i & i<=len s1-1 & 1<=j & j<=len s2-1
      by A1,A2,A23,Lm44;
      reconsider j,i as Element of NAT by INT_1:3;
      set x=(j-1)*(len s1-1)+i;
      reconsider x as set;
      [x,y] in p by A24;
      hence y in rng p by XTUPLE_0:def 13;
    end;
    then
A25: X c= rng p;
A26: X = Seg len f1 by FINSEQ_1:def 3;
    now
      set l9=(len s1-1)*(len s2-1);
      reconsider l9 as Element of NAT by A3,INT_1:3;
      let x be object;
      assume
A27:  x in X;
      then reconsider k=x as Element of NAT;
A28:  k<=(len s1-1)*(len s2-1) by A17,A18,A26,A27,FINSEQ_1:1;
      0+(len s1-1)*(len s2-1)<=1+(len s1-1)*(len s2-1) by XREAL_1:6;
      then
A29:  k<=l9+1 by A28,XXREAL_0:2;
      1<=k by A26,A27,FINSEQ_1:1;
      then
A30:  k in Seg(l9+1) by A29;
      k <> l9+1 by A28,NAT_1:13;
      then consider j,i be Nat such that
A31:  k=(j-1)*(len s1-1)+i & 1<=j & j<=len s2-1 & 1<=i & i<=len s1-1
      by A1,A2,A30,Lm44;
      reconsider j,i as Element of NAT by INT_1:3;
      set y=(i-1)*(len s2-1)+j;
      reconsider y as set;
      [x,y] in p by A31;
      hence x in dom p by XTUPLE_0:def 12;
    end;
    then
A32: X c= dom p;
    now
      let y be object;
      set k=y;
      assume y in rng p;
      then consider x being object such that
A33:  [x,y] in p by XTUPLE_0:def 13;
      consider i,j be Element of NAT such that
A34:  [(j-1)*(len s1-1)+i,(i-1)*(len s2-1)+j]=[x,y] and
A35:  1<=i & i<=len s1-1 & 1<=j & j<=len s2-1 by A33;
A36:  k=(i-1)*(len s2-1)+j by A34,XTUPLE_0:1;
      reconsider k as Integer by A34,XTUPLE_0:1;
      1<=k by A2,A35,A36,Lm46;
      then reconsider k as Element of NAT by INT_1:3;
      1<=k & k<=len f1 by A2,A17,A18,A35,A36,Lm46;
      hence y in X by A26;
    end;
    then rng p c= X;
    then
A37: rng p = X by A25,XBOOLE_0:def 10;
    now
      let x be object;
      set k=x;
      assume x in dom p;
      then consider y being object such that
A38:  [x,y] in p by XTUPLE_0:def 12;
      consider i,j be Element of NAT such that
A39:  [(j-1)*(len s1-1)+i,(i-1)*(len s2-1)+j]=[x,y] and
A40:  1<=i & i<=len s1-1 & 1<=j & j<=len s2-1 by A38;
A41:  k=(j-1)*(len s1-1)+i by A39,XTUPLE_0:1;
      reconsider k as Integer by A39,XTUPLE_0:1;
      1<=k by A1,A40,A41,Lm46;
      then reconsider k as Element of NAT by INT_1:3;
      1<=k & k<=len f1 by A1,A17,A18,A40,A41,Lm46;
      hence x in X by A26;
    end;
    then dom p c= X;
    then
A42: dom p = X by A32,XBOOLE_0:def 10;
    then reconsider p as Function of X,X by A37,FUNCT_2:1;
A43: p is onto by A37;
    now
      let x1,x2 be object;
      assume that
A44:  x1 in X and
A45:  x2 in X;
      assume
A46:  p.x1 = p.x2;
      [x1,p.x1] in p by A32,A44,FUNCT_1:def 2;
      then consider i1,j1 be Element of NAT such that
A47:  [(j1-1)*(len s1-1)+i1,(i1-1)*(len s2-1)+j1]=[x1,p.x1] and
A48:  1<=i1 and
      i1<=len s1-1 and
A49:  1<=j1 & j1<=len s2-1;
      [x2,p.x2] in p by A32,A45,FUNCT_1:def 2;
      then consider i2,j2 be Element of NAT such that
A50:  [(j2-1)*(len s1-1)+i2,(i2-1)*(len s2-1)+j2]=[x2,p.x2] and
A51:  1<=i2 and
      i2<=len s1-1 and
A52:  1<=j2 & j2<=len s2-1;
A53:  (i2-1)*(len s2-1)+j2=p.x2 by A50,XTUPLE_0:1;
A54:  (i1-1)*(len s2-1)+j1=p.x1 by A47,XTUPLE_0:1;
      then i1=i2 by A2,A46,A48,A49,A51,A52,A53,Lm45;
      hence x1 = x2 by A46,A47,A50,A54,A53,XTUPLE_0:1;
    end;
    then p is one-to-one by FUNCT_2:56;
    then reconsider p as Permutation of X by A43;
    take p;
A55: len s21>1 by A1,A2,A7,Def35;
    then
A56: len f2 + 1 = len s21 by Def33;
    now
      len s2+1>1+1 by A2,XREAL_1:6;
      then len s2>=2 by NAT_1:13;
      then
A57:  len s2-1>=2-1 by XREAL_1:9;
      set l=(len s1-1)*(len s2-1)+1;
      let H1,H2 be GroupWithOperators of O;
      let k1,k2 be Nat;
      assume that
A58:  k1 in dom f1 and
A59:  k2=p".k1;
      len s1+1>1+1 by A1,XREAL_1:6;
      then len s1>=2 by NAT_1:13;
      then len s1-1>=2-1 by XREAL_1:9;
      then reconsider l as Element of NAT by A57,INT_1:3;
      assume that
A60:  H1=f1.k1 and
A61:  H2=f2.k2;
A62:  len s12 = (len s1-1)*(len s2-1)+1 by A1,A2,Def35;
      0+(len s1-1)*(len s2-1)<=1+(len s1-1)*(len s2-1) by XREAL_1:6;
      then
A63:  Seg len f1 c= Seg l by A17,A62,FINSEQ_1:5;
A64:  k1 in Seg len f1 by A58,FINSEQ_1:def 3;
      then k1 <= len f1 by FINSEQ_1:1;
      then k1<>(len s1-1)*(len s2-1)+1 by A17,A62,NAT_1:13;
      then consider i,j be Nat such that
A65:  k1=(i-1)*(len s2-1)+j and
A66:  1<=i and
A67:  i<=len s1-1 and
A68:  1<=j and
A69:  j<=len s2-1 by A1,A2,A64,A63,Lm44;
      reconsider H=s1.i,K=s2.j,H9=s1.(i+1),K9=s2.(j+1) as strict
      StableSubgroup of G by A66,A67,A68,A69,Th111;
A70:  p".k1 in rng(p") by A58,FUNCT_2:4;
      p.k2 = k1 by A25,A58,A59,FUNCT_1:35;
      then [k2,k1] in p by A42,A59,A70,FUNCT_1:1;
      then consider i9,j9 be Element of NAT such that
A71:  [k2,k1]=[(j9-1)*(len s1-1)+i9,(i9-1)*(len s2-1)+j9] and
A72:  1<=i9 and
      i9<=len s1-1 and
A73:  1<=j9 & j9<=len s2-1;
      set JK=K9"\/"(K/\H9);
A74:  (i-1)*(len s2-1)+j=(i9-1)*(len s2-1)+j9 by A65,A71,XTUPLE_0:1;
      then
A75:  i=i9 by A2,A66,A68,A69,A72,A73,Lm45;
A76:  now
        per cases;
        suppose
A77:      i=len s1-1;
          per cases;
          suppose
A78:        j<>len s2-1;
            set j9=j+1;
A79:        0+j9<=1+j9 by XREAL_1:6;
            set i9=1;
            set H3 = s1.i9;
            H9 = (1).G by A77,Def28;
            then
A80:        JK = K9"\/"(1).G by Th21
              .= K9 by Th33;
            set H2 = s2.j9;
            set H1 = s2.(j9+1);
            1+1<=j+1 by A68,XREAL_1:6;
            then
A81:        1<=j9 by XXREAL_0:2;
            j<len s2-1 by A69,A78,XXREAL_0:1;
            then
A82:        j+1<=len s2-1 by INT_1:7;
            then
A83:        j9+1<=len s2-1+1 by XREAL_1:6;
            then j9<=len s2 by A79,XXREAL_0:2;
            then j9 in Seg len s2 by A81;
            then
A84:        j9 in dom s2 by FINSEQ_1:def 3;
            len s1-1>1-1 by A1,XREAL_1:9;
            then
A85:        len s1-1>=0+1 by INT_1:7;
            then reconsider
            H1,H2,H3 as strict StableSubgroup of G by A82,A81,Th111;
A86:        H3 = (Omega).G by Def28;
            now
              let x be object;
              H2 is Subgroup of G by Def7;
              then
A87:          the carrier of H2 c= the carrier of G by GROUP_2:def 5;
              assume x in the carrier of H2;
              hence x in the carrier of (Omega).G by A87;
            end;
            then the carrier of H2 c= the carrier of (Omega).G;
            then
A88:        the carrier of H2 = (the carrier of H2) /\ (the carrier of
            (Omega).G) by XBOOLE_1:28;
            k2+1=(j9-1)*(len s1-1)+i9 by A71,A74,A75,A77,XTUPLE_0:1;
            then s21.(k2+1)=H1"\/"(H2/\H3) by A1,A2,A82,A81,A85,Def35;
            then
A89:        s21.(k2+1) = H1"\/"H2 by A86,A88,Th18;
            1<=j9+1 by A81,A79,XXREAL_0:2;
            then j9+1 in Seg len s2 by A83;
            then j9+1 in dom s2 by FINSEQ_1:def 3;
            then H1 is normal StableSubgroup of H2 by A84,Def28;
            hence s21.(k2+1)=JK by A89,A80,Th36;
          end;
          suppose
A90:        j=len s2-1;
            then
A91:        K9 = (1).G by Def28;
            H9 = (1).G by A77,Def28;
            then
A92:        JK = (1).G"\/"(1).G by A91,Th21
              .= (1).G by Th33;
            k2 = (len s1-1)*(len s2-1) by A71,A74,A75,A77,A90,XTUPLE_0:1;
            hence s21.(k2+1)=JK by A1,A2,A92,Def35;
          end;
        end;
        suppose
          i<>len s1-1;
          then i<len s1-1 by A67,XXREAL_0:1;
          then
A93:      i+1<=len s1-1 by INT_1:7;
          set i9=i+1;
          set k29=k2+1;
          1+1<=i+1 by A66,XREAL_1:6;
          then
A94:      1<=i+1 by XXREAL_0:2;
          k2+1=(j-1)*(len s1-1)+i+1 by A71,A74,A75,XTUPLE_0:1;
          then k29=(j-1)*(len s1-1)+i9;
          hence s21.(k2+1)=JK by A1,A2,A68,A69,A93,A94,Def35;
        end;
      end;
      rng(p") c= X;
      then rng(p") c= Seg len f1 by FINSEQ_1:def 3;
      then p".k1 in Seg len f1 by A70;
      then
A95:  k2 in dom f2 by A4,A5,A17,A56,A59,FINSEQ_1:def 3;
A96:  H9 is normal StableSubgroup of H & K9 is normal StableSubgroup of
      K by A66,A67,A68,A69,Th112;
      then reconsider JK as normal StableSubgroup of K9"\/"(K/\H) by Th92;
      k2=(j-1)*(len s1-1)+i by A71,A74,A75,XTUPLE_0:1;
      then s21.k2=K9"\/"(K/\H) by A1,A2,A66,A67,A68,A69,Def35;
      then
A97:  H2 = (K9"\/"(K/\H))./.JK by A55,A61,A95,A76,Def33;
      set JH=H9"\/"(H/\K9);
A98:  now
        per cases;
        suppose
A99:      j=len s2-1;
          per cases;
          suppose
A100:       i<>len s1-1;
            set j9=1;
            set H3 = s2.j9;
            set i9=i+1;
A101:       0+i9<=1+i9 by XREAL_1:6;
            set H2 = s1.i9;
            set H1 = s1.(i9+1);
            1+1<=i+1 by A66,XREAL_1:6;
            then
A102:       1<=i9 by XXREAL_0:2;
            i<len s1-1 by A67,A100,XXREAL_0:1;
            then
A103:       i+1<=len s1-1 by INT_1:7;
            then
A104:       i9+1<=len s1-1+1 by XREAL_1:6;
            then i9<=len s1 by A101,XXREAL_0:2;
            then i9 in Seg len s1 by A102;
            then
A105:       i9 in dom s1 by FINSEQ_1:def 3;
            len s2-1>1-1 by A2,XREAL_1:9;
            then
A106:       len s2-1>=0+1 by INT_1:7;
            then reconsider
            H1,H2,H3 as strict StableSubgroup of G by A103,A102,Th111;
A107:       H3 = (Omega).G by Def28;
            now
              let x be object;
              H2 is Subgroup of G by Def7;
              then
A108:         the carrier of H2 c= the carrier of G by GROUP_2:def 5;
              assume x in the carrier of H2;
              hence x in the carrier of (Omega).G by A108;
            end;
            then the carrier of H2 c= the carrier of (Omega).G;
            then
A109:       the carrier of H2 = (the carrier of H2) /\ (the carrier of
            (Omega).G) by XBOOLE_1:28;
            k1+1=(i9-1)*(len s2-1)+j9 by A65,A99;
            then s12.(k1+1)=H1"\/"(H2/\H3) by A1,A2,A103,A102,A106,Def35;
            then
A110:       s12.(k1+1) = H1"\/"H2 by A107,A109,Th18;
            1<=i9+1 by A102,A101,XXREAL_0:2;
            then i9+1 in Seg len s1 by A104;
            then i9+1 in dom s1 by FINSEQ_1:def 3;
            then
A111:       H1 is normal StableSubgroup of H2 by A105,Def28;
            JH = H9"\/"(H/\(1).G) by A99,Def28
              .= H9"\/"(1).G by Th21
              .= H9 by Th33;
            hence s12.(k1+1)=JH by A110,A111,Th36;
          end;
          suppose
A112:       i=len s1-1;
            then
A113:       k1 = (len s1-1)*(len s2-1) by A65,A99;
A114:       K9 = (1).G by A99,Def28;
            H9 = (1).G by A112,Def28;
            then JH = (1).G"\/"(1).G by A114,Th21
              .= (1).G by Th33;
            hence s12.(k1+1)=JH by A1,A2,A113,Def35;
          end;
        end;
        suppose
          j<>len s2-1;
          then j<len s2-1 by A69,XXREAL_0:1;
          then
A115:     j+1<=len s2-1 by INT_1:7;
          set j9=j+1;
          set k19=k1+1;
          1+1<=j+1 by A68,XREAL_1:6;
          then
A116:     1<=j+1 by XXREAL_0:2;
          k19=(i-1)*(len s2-1)+j9 by A65;
          hence s12.(k1+1)=JH by A1,A2,A66,A67,A115,A116,Def35;
        end;
      end;
      reconsider JH as normal StableSubgroup of H9"\/"(H/\K) by A96,Th92;
      s12.k1=H9"\/"(H/\K) by A1,A2,A65,A66,A67,A68,A69,Def35;
      then H1 = (H9"\/"(H/\K))./.JH by A16,A58,A60,A98,Def33;
      hence H1,H2 are_isomorphic by A96,A97,Th93;
    end;
    hence f1,f2 are_equivalent_under p,O by A4,A5,A17,A56;
  end;
  s12 is not empty by A3,A4;
  hence thesis by A6,A8,Th108;
end;
