reserve i,j,n,k,m for Nat,
     a,b,x,y,z for object,
     F,G for FinSequence-yielding FinSequence,
     f,g,p,q for FinSequence,
     X,Y for set,
     D for non empty set;
reserve
  B,A,M for BinOp of D,
  F,G for D* -valued FinSequence,
  f for FinSequence of D,
  d,d1,d2 for Element of D;
reserve
  F,G for non-empty non empty FinSequence of D*,
  f for non empty FinSequence of D;
reserve f,g for FinSequence of D,
        a,b,c for set,
        F,F1,F2 for finite set;

theorem Th128:
  A is commutative associative having_a_unity having_an_inverseOp
implies
  for E1 be Enumeration of F1 st union F1 c= Seg (1+len f)
    for Ee be Enumeration of Ext(F1,1+len f,2+len f),
        Es be Enumeration of swap(F1,1+len f,2+len f) st
        Ee = Ext(E1,1+len f,2+len f) & Es = Swap(E1,1+len f,2+len f)
for CFe be non-empty non empty FinSequence of D*,
    CFs be non-empty non empty FinSequence of D* st
   CFe = SignGenOp(f^<*d1*>^<*d2*>,A, Ext(F1,1+len f,2+len f) ) * Ee &
   CFs = SignGenOp(f^<*(the_inverseOp_wrt A).d1*>^<*d2*>,
     A, swap(F1,1+len f,2+len f) ) * Es
for S1 be Element of Fin dom App CFe,S2 be Element of Fin dom App CFs st
  S1=S2 holds
A$$(S1,M"**"App CFe) = A$$(S2,M"**"App CFs)
proof
  assume
A1: A is commutative associative having_a_unity having_an_inverseOp;
  set I=the_inverseOp_wrt A,fDD=f^<*d1*>^<*d2*>,fID=f^<*I.d1*>^<*d2*>;
  let E1 be Enumeration of F1 such that
A2: union F1 c= Seg (1+len f);
  let Ee be Enumeration of Ext(F1,1+len f,2+len f),
      Es be Enumeration of swap(F1,1+len f,2+len f) such that
A3: Ee = Ext(E1,1+len f,2+len f) & Es = Swap(E1,1+len f,2+len f);
  let CFe be non-empty non empty FinSequence of D*,
      CFs be non-empty non empty FinSequence of D* such that
A4: CFe = SignGenOp(fDD,A, Ext(F1,1+len f,2+len f) ) * Ee &
  CFs = SignGenOp(fID,A, swap(F1,1+len f,2+len f) ) * Es;
  defpred P[Nat] means
  for S1 be Element of Fin dom App CFe,S2 be Element of Fin dom App CFs st
    S1=S2 & card S1=$1 holds A$$(S1,M"**"App CFe) = A$$(S2,M"**"App CFs);
A5: P[0]
  proof
    let S1 be Element of Fin dom App CFe,S2 be Element of Fin dom App CFs;
    assume S1=S2 & card S1=0;
    then
A6:   S1={}.(dom App CFe) & S2={}.(dom App CFs);
    hence A$$(S1,M"**"App CFe) = the_unity_wrt A by A1,SETWISEO:31
      .= A$$(S2,M"**"App CFs) by A1,A6,SETWISEO:31;
  end;
  A7:P[n] implies P[n+1]
  proof
    set n1=n+1;
    assume
A8:   P[n];
    let S1 be Element of Fin dom App CFe,S2 be Element of Fin dom App CFs
      such that
A9:   S1=S2 & card S1=n1;
    consider s1 be object such that
A10:  s1 in S1 by A9,XBOOLE_0:def 1,def 2;
    set S11= S1\{s1},S22=S2\{s1};
A11:  S1 c= dom App CFe & S2 c= dom App CFs by FINSUB_1:def 5;
    then reconsider s1 as Element of dom App CFe by A10;
    reconsider s2=s1 as Element of dom App CFs by A9,A10,A11;
A12:  S11 c= dom App CFe & S22 c= dom App CFs  by A11;
    then reconsider S11 as Element of Fin dom App CFe by FINSUB_1:def 5;
    reconsider S22 as Element of Fin dom App CFs by A12,FINSUB_1:def 5;
A13:  S1 = S11\/{.s1.} & S2 = S22\/{.s2.} by A9,A10,ZFMISC_1:116;
A14:  not s1 in S11 & not s2 in S22  by ZFMISC_1:56;
A15:  card S11 = n by A9,A10,STIRL2_1:55;
A16:  (M"**"App CFe).s1 = M"**"((App CFe).s1) &
    (M"**"App CFs).s2 = M"**"((App CFs).s2) by Def10;
A17:  len ((App CFe).s1) = len s1 = len ((App CFs).s2) by Def9;
    for i st 1<=i<=len s1 holds ((App CFe).s1).i=((App CFs).s2).i
    proof
      let i such that
A18:    1<=i<=len s1;
      len s1 = len CFe = len Ee by A4,Th47,CARD_1:def 7;
      then
A19:    i in dom CFe =dom Ee=dom E1  by A18,A3,FINSEQ_3:25,30,Def5;
      then
A20:    CFe.i = SignGen(fDD,A,Ee.i) by A4,Th80;
      then
A21:    dom (CFe.i) = dom fDD by Def11;
    len s2 = len CFs = len Es by A4,Th47,CARD_1:def 7;
      then
A22:    CFs.i = SignGen(fID,A,Es.i) by A4,Th80,A18,FINSEQ_3:25;
A23:    i in dom s1 by A18,FINSEQ_3:25;
      then A24: ((App CFe).s1).i = CFe.i.(s1.i) &
        ((App CFs).s2).i = CFs.i.(s2.i) by Def9;
A25:    s1.i in dom (CFe.i) & s2.i in dom (CFs.i) by A23,Th47;
      reconsider s1i=s1.i as Nat by Th47;
A26:    dom <*d1,d2*>={1,2} by FINSEQ_1:92;
      then
A27:    1 in dom <*d1,d2*> & 2 in dom <*d1,d2*> by TARSKI:def 2;
A28:    fDD = f^<*d1,d2*> by FINSEQ_1:32;
      then
A29:    fDD.(1+len f) = <*d1,d2*>.1 =d1 &
      fDD.(2+len f) = <*d1,d2*>.2 =d2 by A27,FINSEQ_1:def 7;
      dom <*I.d1,d2*>={1,2} by FINSEQ_1:92;
      then
A30:    1 in dom <*I.d1,d2*> & 2 in dom <*I.d1,d2*> by TARSKI:def 2;
A31:    fID = f^<*I.d1,d2*> by FINSEQ_1:32;
      then
A32:    fID.(1+len f) = <*I.d1,d2*>.1 =I.d1 &
      fID.(2+len f) = <*I.d1,d2*>.2 =d2 by A30,FINSEQ_1:def 7;
      per cases;
      suppose
A33:      1+len f in E1.i;
        then
A34:      Ee.i = (E1.i)\/{2+len f} & Es.i = (E1.i)\{1+len f} \/{2+len f}
          by A19,A3,Def4,Def5;
        per cases by A21,A28,A25,FINSEQ_1:25;
        suppose
A35:        s1.i in dom f;
          then
A36:        fDD.s1i =f.s1i & fID.s1i =f.s1i by A28,A31,FINSEQ_1:def 7;
          s1i <=len f by A35,FINSEQ_3:25;
          then
A37:        s1i <len f+1 by NAT_1:13;
          then
A38:        s1i <len f+1+1 by NAT_1:13;
          per cases;
          suppose
A39:          s1i in Ee.i;
            then
A40:          CFe.i.s1i = I.(fDD.s1i) by A20,A25,Def11;
            s1i in (E1.i)\{1+len f} by A37,ZFMISC_1:56,136,A34,A38,A39;
            then s1i in Es.i by A34,ZFMISC_1:136;
            hence thesis by A24,A36,A40,A25,A22,Def11;
          end;
          suppose
A41:          not s1.i in Ee.i;
            then
A42:          CFe.i.(s1.i) = fDD.(s1.i) by A20,A25,Def11;
            not s1i in (E1.i)\{1+len f} by A34,A41,ZFMISC_1:136;
            then not s1i in Es.i by A34,A38,ZFMISC_1:136;
            hence thesis by A24,A36,A42,A25,A22,Def11;
          end;
        end;
        suppose ex k st k in dom <*d1,d2*> & s1.i = len f+k;
          then consider k such that
A43:        k in dom <*d1,d2*> & s1.i = len f+k;
          per cases by A43,A26,TARSKI:def 2;
          suppose
A44:          k=1;
            then s1i in Ee.i by A33,A43,A34,XBOOLE_0:def 3;
            then
A45:          CFe.i.s1i = I.d1 by A29,A43,A44,A20,A25,Def11;
A46:          s1i <> 2+len f by A43,A44;
            not s1i in (E1.i)\{1+len f} by ZFMISC_1:56,A43,A44;
            then not s1i in Es.i by A46,A34,ZFMISC_1:136;
            hence thesis by A24,A45,A43,A44,A32,A25,A22,Def11;
          end;
          suppose
A47:          k=2;
            then s1i in Ee.i by A43,A34,ZFMISC_1:136;
            then
A48:          CFe.i.s1i = I.d2 by A29,A43,A47,A20,A25,Def11;
            s1i in Es.i by A34,ZFMISC_1:136,A43,A47;
            hence thesis by A24,A48,A43,A47,A32,A25,A22,Def11;
          end;
        end;
      end;
      suppose
A49:      not 1+len f in E1.i;
        then
A50:      Ee.i = E1.i & Es.i = (E1.i)\/{1+len f} by A19,A3,Def4,Def5;
        per cases by A21,A28,A25,FINSEQ_1:25;
        suppose
A51:        s1.i in dom f;
          then
A52:        fDD.s1i =f.s1i & fID.s1i =f.s1i by A28,A31,FINSEQ_1:def 7;
          s1i <=len f by A51,FINSEQ_3:25;
          then
A53:        s1i <len f+1 by NAT_1:13;
          per cases;
          suppose
A54:          s1i in Ee.i;
            then
A55:          CFe.i.s1i = I.(fDD.s1i) by A20,A25,Def11;
            s1i in Es.i by A50,A54,ZFMISC_1:136;
            hence thesis by A24,A52,A55,A25,A22,Def11;
          end;
          suppose
A56:          not s1.i in Ee.i;
            then
A57:          CFe.i.(s1.i) = fDD.(s1.i) by A20,A25,Def11;
            not s1i in Es.i by A50,A56,A53,ZFMISC_1:136;
            hence thesis by A24,A52,A57,A25,A22,Def11;
          end;
        end;
        suppose ex k st k in dom <*d1,d2*> & s1.i = len f+k;
          then consider k such that
A58:        k in dom <*d1,d2*> & s1.i = len f+k;
          per cases by A58,A26,TARSKI:def 2;
          suppose
A59:          k=1;
            then
A60:          CFe.i.s1i = d1 by A29,A49,A58,A50,A20,A25,Def11;
            s1i in Es.i by A50,ZFMISC_1:136,A58,A59;
            then CFs.i.s1i = I.(fID.s1i) by A25,A22,Def11;
            hence thesis by A24,A60,A1,A58,A59,A32,FINSEQOP:62;
          end;
          suppose
A61:          k=2;
            E1.i in rng E1 = F1 by A19,RLAFFIN3:def 1,FUNCT_1:def 3;
            then E1.i c= union F1 by ZFMISC_1:74;
            then
A62:          E1.i c= Seg (1+len f) by A2;
            1+len f < 1+len f+1 by NAT_1:13;
            then
A63:          not s1i in E1.i by A58,A61,A62,FINSEQ_1:1;
            then
A64:          CFe.i.s1i = d2 by A29,A58,A61,A50,A20,A25,Def11;
            s1i <> 1+len f by A58,A61;
            then not s1i in Es.i by A63,A50,ZFMISC_1:136;
            hence thesis by A24,A64,A58,A61,A32,A25,A22,Def11;
          end;
        end;
      end;
    end;
    then
A65: (App CFe).s1 = (App CFs).s2 by A17;
    thus A$$(S1,M"**"App CFe) = A.(A$$(S11,M"**"App CFe),(M"**"App CFe).s1)
      by A1,A13,A14,SETWOP_2:2
      .= A.(A$$(S22,M"**"App CFs),(M"**"App CFs).s2) by A8,A9,A15,A65,A16
      .= A$$(S2,M"**"App CFs) by A1,A13,A14,SETWOP_2:2;
  end;
A66:P[n] from NAT_1:sch 2(A5,A7);
  let S1 be Element of Fin dom App CFe,S2 be Element of Fin dom App CFs;
  P[card S1] by A66;
  hence thesis;
end;
