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
  s1 is jordan_holder & s2 is jordan_holder implies s1 is_equivalent_with s2
proof
  assume
A1: s1 is jordan_holder;
  assume
A2: s2 is jordan_holder;
  per cases;
  suppose
A3: s1 is empty;
    now
      now
        set x={};
        take x;
        thus x c= dom s2;
        thus s1 = s2 * Sgm x by A3,FINSEQ_3:43;
      end;
      then
A4:   s2 is_finer_than s1;
      assume
A5:   s2 is not empty;
      s2 is strictly_decreasing by A2;
      hence contradiction by A1,A3,A5,A4;
    end;
    hence thesis by A3;
  end;
  suppose
A6: s1 is not empty;
    defpred P[Nat] means for s19,s29 st s19 is not empty & s29 is not empty &
len s19=len s1+$1 & s19 is_finer_than s1 & s29 is_finer_than s2 & ex p being
Permutation of dom the_series_of_quotients_of s19 st the_series_of_quotients_of
s19,the_series_of_quotients_of s29 are_equivalent_under p,O holds ex p being
Permutation of dom the_series_of_quotients_of s1 st the_series_of_quotients_of
    s1,the_series_of_quotients_of s2 are_equivalent_under p,O;
A7: now
      assume
A8:   s2 is empty;
      now
        set x={};
        take x;
        thus x c= dom s1;
        thus s2 = s1 * Sgm x by A8,FINSEQ_3:43;
      end;
      then
A9:   s1 is_finer_than s2;
      s1 is strictly_decreasing by A1;
      hence contradiction by A2,A6,A8,A9;
    end;
A10: for n st P[n] holds P[n+1]
    proof
      let n;
      assume
A11:  P[n];
      now
        let s19,s29;
        assume that
        s19 is not empty and
        s29 is not empty;
        assume
A12:    len s19 = len s1 + n+1;
        set f1=the_series_of_quotients_of s19;
        assume
A13:    s19 is_finer_than s1;
        n+1+len s1>0+len s1 by XREAL_1:6;
        then consider i such that
A14:    i in dom f1 and
A15:    for H st H=f1.i holds H is trivial by A1,A12,A13,Th109;
        reconsider s199=Del(s19,i) as FinSequence of the_stable_subgroups_of G
        by FINSEQ_3:105;
A16:    i in dom s19 by A14,A15,Th103;
A17:    i+1 in dom s19 & s19.i=s19.(i+1) by A14,A15,Th103;
        then reconsider s199 as CompositionSeries of G by A16,Th94;
A18:    the_series_of_quotients_of s199= Del(f1,i) by A16,A17,Th104;
        set f2=the_series_of_quotients_of s29;
        assume
A19:    s29 is_finer_than s2;
        given p be Permutation of dom f1 such that
A20:    f1,f2 are_equivalent_under p,O;
        set H1=f1.i;
A21:    f1.i in rng f1 by A14,FUNCT_1:3;
        set j = p".i;
        reconsider j as Nat;
        set H2=f2.j;
        reconsider s299=Del(s29,j) as FinSequence of the_stable_subgroups_of G
        by FINSEQ_3:105;
        rng(p") c= dom f1;
        then
A22:    rng(p") c= Seg len f1 by FINSEQ_1:def 3;
A23:    len f1 = len f2 by A20;
        (p").i in rng(p") by A14,FUNCT_2:4;
        then (p").i in Seg len f1 by A22;
        then
A24:    j in dom f2 by A23,FINSEQ_1:def 3;
        then f2.j in rng f2 by FUNCT_1:3;
        then reconsider H1,H2 as strict GroupWithOperators of O by A21,Th102;
A25:    H1 is trivial by A15;
        H1,H2 are_isomorphic by A20,A14;
        then
A26:    for H st H=f2.j holds H is trivial by A25,Th58;
        then
A27:    j in dom s29 & j+1 in dom s29 by A24,Th103;
A28:    s29.j=s29.(j+1) by A24,A26,Th103;
        then reconsider s299 as CompositionSeries of G by A27,Th94;
A29:    s299 is_finer_than s2 & s299 is not empty by A2,A7,A19,A27,A28,Th97
,Th99;
A30:    len s199 = len s1 + n by A12,A16,FINSEQ_3:109;
        the_series_of_quotients_of s299= Del(f2,j) by A27,A28,Th104;
        then
A31:    ex p be Permutation of dom the_series_of_quotients_of s199 st
        the_series_of_quotients_of s199,the_series_of_quotients_of s299
        are_equivalent_under p,O by A20,A14,A18,Th106;
        s199 is_finer_than s1 & s199 is not empty by A1,A6,A13,A16,A17,Th97
,Th99;
        hence thesis by A11,A30,A29,A31;
      end;
      hence thesis;
    end;
A32: P[0]
    proof
      let s19,s29;
      assume
A33:  s19 is not empty & s29 is not empty;
      assume
A34:  len s19 = len s1+0 & s19 is_finer_than s1;
      assume
A35:  s29 is_finer_than s2;
      given p be Permutation of dom the_series_of_quotients_of s19 such that
A36:  the_series_of_quotients_of s19,the_series_of_quotients_of s29
      are_equivalent_under p,O;
A37:  s19 is_equivalent_with s29 by A33,A36,Th108;
      s19=s1 by A34,Th96;
      then s29 is jordan_holder by A1,A37,Th115;
      then s29=s2 by A2,A35;
      then s1 is_equivalent_with s2 by A34,A37,Th96;
      hence thesis by A6,A7,Th108;
    end;
A38: for n holds P[n] from NAT_1:sch 2(A32,A10);
    consider s19,s29 such that
A39: s19 is_finer_than s1 and
A40: s29 is_finer_than s2 and
A41: s19 is_equivalent_with s29 by Th118;
A42: s19 is not empty by A6,A39;
A43: ex n st len s19 = len s1 + n by A39,Th95;
A44: s29 is not empty by A7,A40;
    then ex p9 being Permutation of dom the_series_of_quotients_of s19 st
    the_series_of_quotients_of s19,the_series_of_quotients_of s29
    are_equivalent_under p9,O by A41,A42,Th108;
    then ex p being Permutation of dom the_series_of_quotients_of s1 st
    the_series_of_quotients_of s1,the_series_of_quotients_of s2
    are_equivalent_under p,O by A39,A40,A42,A44,A38,A43;
    hence thesis by A6,A7,Th108;
  end;
end;
