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 Th136:
    M is commutative associative having_a_unity &
    A is commutative associative having_a_unity having_an_inverseOp &
    M is_distributive_wrt A  implies
for f be FinSequence of D
  for E1 be Enumeration of F1, E2 be Enumeration of F2
    for s1,s2 be FinSequence st
       s1 in doms (SignGenOp(f^<*d1*>,A,F1) * E1) &
       s2 in doms (SignGenOp(f^<*d2*>,A,F2) * E2) &
       card (s1"{1+len f}) = card (s2"{1+len f})
holds
  M.((M "**" App (SignGenOp(f^<*d1*>,A,F1) * E1)).s1,
   (M "**" App (SignGenOp(f^<*d2*>,A,F2) * E2)).s2) =
  M.((M "**" App (SignGenOp(f^<*d2*>,A,F1) * E1)).s1,
   (M "**" App (SignGenOp(f^<*d1*>,A,F2) * E2)).s2)
proof
  set I=the_inverseOp_wrt A;
  assume that
A1:M is commutative associative having_a_unity and
A2: A is commutative associative having_a_unity having_an_inverseOp and
A3: M is_distributive_wrt A;
  let f be FinSequence of D;
  let E1 be Enumeration of F1, E2 be Enumeration of F2;
  set L=1+len f;
  let s1,s2 be FinSequence such that
A4:s1 in doms (SignGenOp(f^<*d1*>,A,F1) * E1) &
  s2 in doms (SignGenOp(f^<*d2*>,A,F2) * E2) & card (s1"{L}) = card (s2"{L});
A5: len (f^<*d1*>)=L =len (f^<*d2*>) by FINSEQ_2:16;
  then
A6: doms (SignGenOp(f^<*d1*>,A,F1) * E1) =
  doms (SignGenOp(f^<*d2*>,A,F1) * E1) &
  doms (SignGenOp(f^<*d2*>,A,F2) * E2) =
  doms (SignGenOp(f^<*d1*>,A,F2) * E2) by Th107;
  set k=card (s1"{L});
A7:len s1=len (SignGenOp(f^<*d1*>,A,F1) * E1) =
  len E1 & len s2=len (SignGenOp(f^<*d2*>,A,F2) * E2) =len E2
  by Th47,A4,CARD_1:def 7;
  then
A8:dom s1 =dom E1 & dom s2 =dom E2 by FINSEQ_3:29;
  set kL=k|->L;
A9: len kL = k;
  consider p1 be Permutation of dom s1,S1 be FinSequence such that
A10: s1*p1 = S1^kL & not L in rng S1 by Th134;
  reconsider E1p=E1*p1 as Enumeration of F1 by A8,Th109;
A11:len E1p = card F1 = len E1 by CARD_1:def 7;
  dom p1 = dom s1 = rng p1 by FUNCT_2:52,def 3;
  then
A12:len S1+k=len (S1^kL) = len s1
  by A10,FINSEQ_3:29,A9,FINSEQ_1:22,RELAT_1:27;
  set e1pS = E1p|len S1;
  consider e1pK be FinSequence such that
A13: E1p = e1pS ^ e1pK by FINSEQ_1:80;
  set F1S = rng e1pS, F1K= rng e1pK;
A14: len e1pS = len S1 by NAT_1:11,A7,A11,A12,FINSEQ_1:59;
A15: len E1p = len e1pS +len  e1pK by A13,FINSEQ_1:22;
A16: e1pS is one-to-one & e1pK is one-to-one & F1S misses F1K
  by A13,FINSEQ_3:91;
  then reconsider E1pS=e1pS as Enumeration of F1S by RLAFFIN3:def 1;
  reconsider E1pK=e1pK as Enumeration of F1K by A16,RLAFFIN3:def 1;
  consider p2 be Permutation of dom s2,S2 be FinSequence such that
A17: s2*p2 = S2^kL & not L in rng S2 by A4,Th134;
  reconsider E2p=E2*p2 as Enumeration of F2 by A8,Th109;
A18:len E2p = card F2 = len E2 by CARD_1:def 7;
  dom p2 = dom s2 = rng p2 by FUNCT_2:52,def 3;
  then
A19: len S2+k=len (S2^kL) = len s2
  by A17,FINSEQ_3:29,A9,FINSEQ_1:22,RELAT_1:27;
  set e2pS = E2p|len S2;
A20:len e2pS = len S2 by NAT_1:11,A7,A18,A19,FINSEQ_1:59;
  consider e2pK be FinSequence such that
A21: E2p = e2pS ^ e2pK by FINSEQ_1:80;
  set F2S = rng e2pS, F2K= rng e2pK;
A22: len E2p = len e2pS +len  e2pK by A21,FINSEQ_1:22;
A23: e2pS is one-to-one & e2pK is one-to-one & F2S misses F2K
  by A21,FINSEQ_3:91;
  then reconsider E2pS=e2pS as Enumeration of F2S by RLAFFIN3:def 1;
  reconsider E2pK=e2pK as Enumeration of F2K by A23,RLAFFIN3:def 1;
A24: F1 = rng E1p = F1S\/F1K & F2 = rng E2p = F2S\/F2K
  by A13,A21,FINSEQ_1:31,RLAFFIN3:def 1;
  then
A25: SignGenOp(f^<*d1*>,A,F1) * E1p =
  (SignGenOp(f^<*d1*>,A,F1S) * E1pS)^(SignGenOp(f^<*d1*>,A,F1K) * E1pK) &
  SignGenOp(f^<*d2*>,A,F2) * E2p =
  (SignGenOp(f^<*d2*>,A,F2S) * E2pS)^(SignGenOp(f^<*d2*>,A,F2K) * E2pK)
  by A13,A21,Th81;
A26: SignGenOp(f^<*d2*>,A,F1) * E1p =
  (SignGenOp(f^<*d2*>,A,F1S) * E1pS)^(SignGenOp(f^<*d2*>,A,F1K) * E1pK) &
  SignGenOp(f^<*d1*>,A,F2) * E2p =
  (SignGenOp(f^<*d1*>,A,F2S) * E2pS)^(SignGenOp(f^<*d1*>,A,F2K) * E2pK)
  by A13,A21,Th81,A24;
A27: s1*p1 in doms (SignGenOp(f^<*d1*>,A,F1) * E1p) &
  s2*p2 in doms (SignGenOp(f^<*d2*>,A,F2) * E2p) by A4,A8,Th110;
  then
A28: s1*p1 in dom (App (SignGenOp(f^<*d1*>,A,F1) * E1p)) &
  s2*p2 in dom (App (SignGenOp(f^<*d2*>,A,F2) * E2p)) by Def9;
A29: s1*p1 in doms (SignGenOp(f^<*d2*>,A,F1) * E1p) &
  s2*p2 in doms (SignGenOp(f^<*d1*>,A,F2) * E2p) by A4,A8,Th110,A6;
  then
A30: s1*p1 in dom (App (SignGenOp(f^<*d2*>,A,F1) * E1p)) &
  s2*p2 in dom (App (SignGenOp(f^<*d1*>,A,F2) * E2p)) by Def9;
  len (SignGenOp(f^<*d1*>,A,F1K) * E1pK) = len kL
  by A15,A7,A11,A14,A12,CARD_1:def 7;
  then
A31: S1 in doms (SignGenOp(f^<*d1*>,A,F1S) * E1pS) &
  kL in doms (SignGenOp(f^<*d1*>,A,F1K) * E1pK)
  by A27,Th50,A10,A25;
  len (SignGenOp(f^<*d2*>,A,F1K) * E1pK) = len kL by A15,A7,A11,A14,A12
  ,CARD_1:def 7; then
A32: S1 in doms (SignGenOp(f^<*d2*>,A,F1S) * E1pS) &
  kL in doms (SignGenOp(f^<*d2*>,A,F1K) * E1pK) by A29,Th50,A10,A26;
  s2*p2 in doms (SignGenOp(f^<*d2*>,A,F2) * E2p) by A4,A8,Th110;
  then
A33: s2*p2 in dom (App (SignGenOp(f^<*d2*>,A,F2) * E2p)) by Def9;
  len (SignGenOp(f^<*d2*>,A,F2K) * E2pK) = len kL
  by A22,A7,A20,A19,A18,CARD_1:def 7;
  then
A34: S2 in doms (SignGenOp(f^<*d2*>,A,F2S) * E2pS) &
  kL in doms (SignGenOp(f^<*d2*>,A,F2K) * E2pK)
  by A27,Th50,A17,A25;
  s2*p2 in doms (SignGenOp(f^<*d1*>,A,F2) * E2p) by A6,A4,A8,Th110;
  then
A35: s2*p2 in dom (App (SignGenOp(f^<*d1*>,A,F2) * E2p)) by Def9;
  len (SignGenOp(f^<*d1*>,A,F2K) * E2pK) = len kL
  by A22,A7,A20,A19,A18,CARD_1:def 7;
  then
A36: S2 in doms (SignGenOp(f^<*d1*>,A,F2S) * E2pS) &
  kL in doms (SignGenOp(f^<*d1*>,A,F2K) * E2pK)
  by A29,Th50,A17,A26;
A37:(M "**" App (SignGenOp(f^<*d1*>,A,F1) * E1)).s1 =
  (M "**" App (SignGenOp(f^<*d1*>,A,F1) * E1p)).(s1*p1) by A1,A4,A8,Th112
  .= M "**" (App (SignGenOp(f^<*d1*>,A,F1) * E1p)).(s1*p1) by A28,Def10
  .= M "**" (((App (SignGenOp(f^<*d1*>,A,F1S) * E1pS)).S1)^
  ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL)) by Th61,A25,A10,A31
  .= M.(M "**" ((App(SignGenOp(f^<*d1*>,A,F1S) * E1pS)).S1),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL)) by A1, FINSOP_1:5;
A38:(M "**" App (SignGenOp(f^<*d2*>,A,F2) * E2)).s2 =
  (M "**" App (SignGenOp(f^<*d2*>,A,F2) * E2p)).(s2*p2) by A1,A4,A8,Th112
  .= M "**" (App (SignGenOp(f^<*d2*>,A,F2) * E2p)).(s2*p2) by A33,Def10
  .= M "**" (((App (SignGenOp(f^<*d2*>,A,F2S) * E2pS)).S2)^
  ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL)) by Th61,A25,A17,A34
  .= M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F2S) * E2pS)).S2),
  M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL)) by A1, FINSOP_1:5;
A39: (App(SignGenOp(f^<*d2*>,A,F2S) * E2pS)).S2 =
  (App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2 by A17,A34,Th133;
A40: (App(SignGenOp(f^<*d1*>,A,F1S) * E1pS)).S1 =
  (App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1 by Th133,A32,A10;
A41: M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL),
  M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL))
  = M.( M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL))
  proof
    defpred P1[object] means L in E1pK.$1;
    consider D1 be set such that
A42: x in D1 iff x in dom E1pK & P1[x] from XBOOLE_0:sch 1;
    D1 c= dom E1pK by A42;
    then reconsider D1 as Subset of dom E1pK;
A43: for i holds i in D1 iff L in E1pK.i
    proof
      let i;
      thus i in D1 implies L in E1pK.i by A42;
      assume
A44:    L in E1pK.i;
      then i in dom E1pK by FUNCT_1:def 2;
      hence thesis by A44,A42;
    end;
    defpred P2[object] means L in E2pK.$1;
    consider D2 be set such that
A45: x in D2 iff x in dom E2pK & P2[x] from XBOOLE_0:sch 1;
    D2 c= dom E2pK by A45;
    then reconsider D2 as Subset of dom E2pK;
A46: for i holds i in D2 iff L in E2pK.i
    proof
      let i;
      thus i in D2 implies L in E2pK.i by A45;
      assume
A47:    L in E2pK.i;
      then i in dom E2pK by FUNCT_1:def 2;
      hence thesis by A47,A45;
    end;
    1<=L by NAT_1:11;
    then
A48: L in dom (f^<*d1*>) & L in dom (f^<*d2*>) by A5,FINSEQ_3:25;
    then
A49:(f^<*d1*>)/.L = (f^<*d1*>).L=d1 & (f^<*d2*>)/.L = (f^<*d2*>).L=d2
    by PARTFUN1:def 6;
    kL in dom App(SignGenOp(f^<*d1*>,A,F1K) * E1pK) &
    kL in dom App(SignGenOp(f^<*d2*>,A,F1K) * E1pK) &
    kL in dom App(SignGenOp(f^<*d1*>,A,F2K) * E2pK) &
    kL in dom App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)
    by Def9, A31,A32,A34,A36; then
A50: M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL) =
    (M "**" (App(SignGenOp(f^<*d1*>,A,F1K) * E1pK))).kL &
    M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL) =
    (M "**" (App(SignGenOp(f^<*d2*>,A,F1K) * E1pK))).kL &
    M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL) =
    (M "**" (App(SignGenOp(f^<*d1*>,A,F2K) * E2pK))).kL &
    M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL) =
    (M "**" (App(SignGenOp(f^<*d2*>,A,F2K) * E2pK))).kL by Def10;
    per cases;
    suppose card D1 is even; then
A51:  (M "**" (App (SignGenOp(f^<*d1*>,A,F1K) * E1pK))).kL =
      M "**" (k |-> d1) &
      (M "**" (App (SignGenOp(f^<*d2*>,A,F1K) * E1pK))).kL =
      M "**" (k |-> d2)
      by A49,A15,A7,A11,A14,A12,Th135,A48,A43,A1,A2,A3;
      per cases;
      suppose  card D2 is even;
        then (M "**" (App (SignGenOp(f^<*d1*>,A,F2K) * E2pK))).kL =
        M "**" (k |-> d1) &
        (M "**" (App (SignGenOp(f^<*d2*>,A,F2K) * E2pK))).kL =
        M "**" (k |-> d2)
        by A49,A22,A7,A20,A19,A18,Th135,A48,A46,A1,A2,A3;
        hence thesis by A51,A50,A1,BINOP_1:def 2;
      end;
      suppose not card D2 is even;
        then
A52:    (M "**" (App (SignGenOp(f^<*d1*>,A,F2K) * E2pK))).kL =
        I.(M "**" (k |-> d1)) &
        (M "**" (App (SignGenOp(f^<*d2*>,A,F2K) * E2pK))).kL =
        I.(M "**" (k |-> d2)) by A49,A22,A7,A20,A19,A18,Th135,A48,A46,A1,A2,A3;
        hence M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL),
        M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL))
        = M. (I.(M "**" (k |-> d2)), M "**" (k |-> d1))
        by A51,A50,A1,BINOP_1:def 2
        .= I.(M. (M "**" (k |-> d2), M "**" (k |-> d1))) by A2,A3,FINSEQOP:67
        .= M.( M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL),
        M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL))
        by A51,A52,A50,A2,A3,FINSEQOP:67;
      end;
    end;
    suppose not card D1 is even; then
A53:  (M "**" (App (SignGenOp(f^<*d1*>,A,F1K) * E1pK))).kL =
      I.(M "**" (k |-> d1)) &
      (M "**" (App (SignGenOp(f^<*d2*>,A,F1K) * E1pK))).kL =
      I.(M "**" (k |-> d2)) by A49,A15,A7,A11,A14,A12,Th135,A48,A43,A1,A2,A3;
      per cases;
      suppose  card D2 is even;
        then
A54:    (M "**" (App (SignGenOp(f^<*d1*>,A,F2K) * E2pK))).kL =
        M "**" (k |-> d1) &
        (M "**" (App (SignGenOp(f^<*d2*>,A,F2K) * E2pK))).kL =
        M "**" (k |-> d2)
        by A49,A22,A7,A20,A19,A18,Th135,A48,A46,A1,A2,A3;
        hence M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL),
        M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL))
        = M. (M "**" (k |-> d2), I.(M "**" (k |-> d1)))
        by A53,A50,A1,BINOP_1:def 2
        .= I.(M. (M "**" (k |-> d2), M "**" (k |-> d1)))
        by A2,A3,FINSEQOP:67
        .= M.( M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL),
        M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL))
        by A53,A54,A50,A2,A3,FINSEQOP:67;
      end;
      suppose  not card D2 is even;
        then (M "**" (App (SignGenOp(f^<*d1*>,A,F2K) * E2pK))).kL =
        I.(M "**" (k |-> d1)) &
        (M "**" (App (SignGenOp(f^<*d2*>,A,F2K) * E2pK))).kL =
        I.(M "**" (k |-> d2)) by A49,A22,A7,A20,A19,A18,Th135,A48,A46,A1,A2,A3;
        hence thesis by A53,A50,A1,BINOP_1:def 2;
      end;
    end;
  end;
A55: (M "**" App (SignGenOp(f^<*d2*>,A,F1) * E1)).s1 =
  (M "**" App (SignGenOp(f^<*d2*>,A,F1) * E1p)).(s1*p1) by A1,A4,A8,Th112,A6
  .= M "**" (App (SignGenOp(f^<*d2*>,A,F1) * E1p)).(s1*p1) by A30,Def10
  .= M "**" (((App (SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1)^
  ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL)) by Th61,A26,A10,A32
  .= M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1),
  M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL)) by A1, FINSOP_1:5;
A56: (M "**" App (SignGenOp(f^<*d1*>,A,F2) * E2)).s2 =
  (M "**" App (SignGenOp(f^<*d1*>,A,F2) * E2p)).(s2*p2) by A1,A4,A8,Th112,A6
  .= M "**" (App (SignGenOp(f^<*d1*>,A,F2) * E2p)).(s2*p2) by A35,Def10
  .= M "**" (((App (SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2)^
  ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL))
  by Th61,A26,A17,A36
  .= M.(M "**" ((App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL)) by A1, FINSOP_1:5;
  M.((M "**" App (SignGenOp(f^<*d1*>,A,F1) * E1)).s1,
  (M "**" App (SignGenOp(f^<*d2*>,A,F2) * E2)).s2)
  = M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1),
  M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL),
  M.(M "**" ((App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2),
  M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL))))
  by A37,A38,A39,A40,A1,BINOP_1:def 3
  .= M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1),
  M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL),
  M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2))))
  by A1,BINOP_1:def 2
  .= M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1),
  M.( M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F1K) * E1pK)).kL),
  M "**" ((App(SignGenOp(f^<*d2*>,A,F2K) * E2pK)).kL)),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2)))
  by A1,BINOP_1:def 3
  .= M.(M "**" ((App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1),
  M.( M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL),
  M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2))))
  by A41,A1,BINOP_1:def 3
  .= M.(M.( M "**" ((App(SignGenOp(f^<*d2*>,A,F1S) * E1pS)).S1),
  M "**" ((App(SignGenOp(f^<*d2*>,A,F1K) * E1pK)).kL)),
  M.( M "**" ((App(SignGenOp(f^<*d1*>,A,F2K) * E2pK)).kL),
  M "**" ((App(SignGenOp(f^<*d1*>,A,F2S) * E2pS)).S2)))
  by A1,BINOP_1:def 3
  .= M.( (M "**" App (SignGenOp(f^<*d2*>,A,F1) * E1)).s1,
  (M "**" App (SignGenOp(f^<*d1*>,A,F2) * E2)).s2) by A55,A56,A1,BINOP_1:def 2;
  hence thesis;
end;
