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 Th91:
  A is having_a_unity associative commutative having_an_inverseOp
implies
  for F be finite non empty set st union F c= dom f
    for F1,F2 be finite set st F1 = UNION(F,bool {len f+1}) &
       F2 = UNION(F,bool {len f+1,len f+2}) holds
    ex E1 be Enumeration of F1,E2 be Enumeration of F2 st
      A "**" (SignGenOp(f^<*d1*>^<*d2*>,A,F2)*E2) = (
         A"**" (SignGenOp(f^<*A.(d1,d2)*>,A,F1)*E1)) ^
        (A"**" (SignGenOp(f^<*A.(d1,(the_inverseOp_wrt A).d2)*>,A,F1)*E1))
proof
  assume
A1: A is having_a_unity associative commutative having_an_inverseOp;
  let F be non empty finite set such that
A2: union F c= dom f;
  let F1,F2 be finite set such that
A3: F1 = UNION(F,bool {len f+1}) &
         F2 = UNION(F,bool {len f+1,len f+2});
  set L=len f;
  set U1= UNION(F,{{L+1}}),U2= UNION(F,{{L+2}}),U12= UNION(F,{{L+1,L+2}});
  set E = the Enumeration of F;
  set I=the_inverseOp_wrt A;
  set f12=f^<*d1*>^<*d2*>,fA = f^<*A.(d1,d2)*>,fAI = f^<*A.(d1,I.d2)*>;
A4: 0+L < 2+L & 1+L < 2+L by XREAL_1:8;
  then
A5: not L+2 in union F by A2,FINSEQ_3:25;
A6: L < L + 1 by NAT_1:13;
  then
A7: not L+1 in union F by A2,FINSEQ_3:25;
  then consider E1 be Enumeration of U1 such that
A8: for i st i in dom E holds E1.i = {L+1}\/E.i by Th88,ZFMISC_1:50;
  L+1 in {L+1} by TARSKI:def 1;
  then
A9: L+1 in {L+1}\/meet F = meet U1 by XBOOLE_0:def 3,SETFAM_1:24;
A10: not L+2 in union U1
  proof
    assume L+2 in union U1;
    then consider XY be set such that
A11:  L+2 in XY in U1 by TARSKI:def 4;
    consider X,Y such that
A12:  X in F & Y in {{L+1}} & XY=X\/Y by A11,SETFAM_1:def 4;
    L+1 <>L+2;
    then not L+2 in {L+1} & {L+1}=Y by A12,TARSKI:def 1;
    then L+2 in X c= union F by A11,A12,XBOOLE_0:def 3,ZFMISC_1:74;
    then L+2 in dom f by A2;
    hence thesis by A4,FINSEQ_3:25;
  end;
  L+2 in {L+2} by TARSKI:def 1;
  then
A13: L+2 in {L+2}\/meet F = meet U2 by XBOOLE_0:def 3,SETFAM_1:24;
A14: not L+1 in union U2
  proof
    assume L+1 in union U2;
    then consider XY be set such that
A15:  L+1 in XY in U2 by TARSKI:def 4;
    consider X,Y such that
A16:  X in F & Y in {{L+2}} & XY=X\/Y by A15,SETFAM_1:def 4;
    L+1 <>L+2;
    then not L+1 in {L+2} & {L+2}=Y by A16,TARSKI:def 1;
    then L+1 in X c= union F by A15,A16,XBOOLE_0:def 3,ZFMISC_1:74;
    then L+1 in dom f by A2;
    hence thesis by A6,FINSEQ_3:25;
  end;
  a in U12 implies L+1 in a & L+2 in a
  proof
    assume a in U12;
    then consider X,Y such that
A17:  X in F & Y in {{L+1,L+2}} & a=X\/Y by SETFAM_1:def 4;
    L+1 in {L+1,L+2} & L+2 in {L+1,L+2} = Y by TARSKI:def 1,def 2,A17;
    hence thesis by A17,XBOOLE_0:def 3;
  end;
  then (a in U12 implies L+1 in a ) &(a in U12 implies L+2 in a);
  then
A18: L+1 in meet U12 & L+2 in meet U12 by SETFAM_1:def 1;
  consider E2 be Enumeration of U2 such that
A19: for i st i in dom E holds E2.i = {L+2}\/E.i by Th88,A5,ZFMISC_1:50;
  consider E12 be Enumeration of U12 such that
A20: for i st i in dom E holds E12.i={L+1,L+2}\/E.i by Th88,A5,A7,ZFMISC_1:51;
  F misses U1
  proof
    assume F meets U1;
    then consider x such that
A21:  x in F & x in U1 by XBOOLE_0:3;
    consider X,Y such that
A22:  X in F & Y in {{L+1}} & x=X\/Y by A21,SETFAM_1:def 4;
    Y = {L+1} by A22,TARSKI:def 1;
    then L+1 in Y by TARSKI:def 1;
    then L+1 in X\/Y by XBOOLE_0:def 3;
    hence thesis by A7,A21,A22,TARSKI:def 4;
  end;
  then reconsider EE1 = E^E1 as Enumeration of F\/U1 by Th79;
  U1 misses U2
  proof
    assume U1 meets U2;
    then consider x such that
A23:  x in U1 & x in U2 by XBOOLE_0:3;
    consider X1,Y1 be set such that
A24:  X1 in F & Y1 in {{L+1}} & x=X1\/Y1 by A23,SETFAM_1:def 4;
    Y1 = {L+1} by A24,TARSKI:def 1;
    then L+1 in Y1 by TARSKI:def 1;
    then L+1 in X1\/Y1 by XBOOLE_0:def 3;
    hence thesis by A14,A23,A24,TARSKI:def 4;
  end;
  then reconsider E2E1 = E2^E1 as Enumeration of U2\/U1 by Th79;
  F misses U12
  proof
    assume F meets U12;
    then consider x such that
A25:  x in F & x in U12 by XBOOLE_0:3;
    consider X,Y such that
A26:  X in F & Y in {{L+1,L+2}} & x=X\/Y by A25,SETFAM_1:def 4;
    Y = {L+1,L+2} by A26,TARSKI:def 1;
    then L+1 in Y by TARSKI:def 2;
    then L+1 in X\/Y by XBOOLE_0:def 3;
    hence thesis by A7,A25,A26,TARSKI:def 4;
  end;
  then reconsider EE12 = E^E12 as Enumeration of F\/U12 by Th79;
A27: card U12 = card F = card U2 by A5,A7,ZFMISC_1:51,Th8,ZFMISC_1:50;
A28: card U12 = card F = card U1 by A5,A7,ZFMISC_1:51,Th8,ZFMISC_1:50;
  len E1 = card U1 & len E12 = card U12 & len E=card F by CARD_1:def 7;
  then
A29: dom E1 = dom E = dom E12 by A28,FINSEQ_3:30;
A30: len fA=L+1 by FINSEQ_2:16;
  then
A31: dom fA = Seg (L+1) by FINSEQ_1:def 3;
  len fAI=L+1 by FINSEQ_2:16;
  then
A32: dom fAI = dom fA by A31,FINSEQ_1:def 3;
  not L+2 in dom fA by A30,A4,FINSEQ_3:25;
  then
A33: {L+2} misses dom fA by ZFMISC_1:50;
A34: for i st i in dom E1 holds dom fA /\ E1.i = dom fA /\ E12.i
  proof
    let i such that
A35:  i in dom E1;
A36:  E12.i = {L+1,L+2}\/E.i by A35,A20,A29;
A37:  E1.i = {L+1}\/E.i by A35,A8,A29;
    {L+1,L+2}={L+1} \/{L+2} by ENUMSET1:1;
    then E12.i = E1.i \/{L+2} by A36,A37,XBOOLE_1:4;
    then dom fA /\ E12.i = (dom fA /\ E1.i)\/(dom fA /\ {L+2}) by XBOOLE_1:23;
    hence thesis by A33;
  end;
A38: for i st i in dom E holds dom fAI /\ E.i = dom fAI /\ E2.i
  proof
    let i such that
A39:  i in dom E;
    E2.i = {L+2}\/E.i by A39,A19;
    then dom fAI /\ E2.i = (dom fAI /\ E.i)\/(dom fAI /\ {L+2}) by XBOOLE_1:23;
    hence thesis by A33,A32;
  end;
  F\/U12 misses U2\/U1
  proof
    assume F\/U12 meets U2\/U1;
    then consider x such that
A40:  x in F\/U12 & x in U2\/U1 by XBOOLE_0:3;
    per cases by A40,XBOOLE_0:def 3;
    suppose
A41:    x in F;
      per cases by A40,XBOOLE_0:def 3;
      suppose x in U2;
        then consider X,Y such that
A42:      X in F & Y in {{L+2}} & x=X\/Y by SETFAM_1:def 4;
        Y = {L+2} by A42,TARSKI:def 1;
        then L+2 in Y by TARSKI:def 1;
        then L+2 in X\/Y by XBOOLE_0:def 3;
        hence thesis by A5,A42,A41,TARSKI:def 4;
      end;
      suppose x in U1;
        then consider X,Y such that
A43:      X in F & Y in {{L+1}} & x=X\/Y by SETFAM_1:def 4;
        Y = {L+1} by A43,TARSKI:def 1;
        then L+1 in Y by TARSKI:def 1;
        then L+1 in X\/Y by XBOOLE_0:def 3;
        hence thesis by A7,A43,A41,TARSKI:def 4;
      end;
    end;
    suppose x in U12;
      then consider X,Y such that
A44:    X in F & Y in {{L+1,L+2}} & x=X\/Y by SETFAM_1:def 4;
A45:    x in U1 or x in U2 by A40,XBOOLE_0:def 3;
      Y = {L+1,L+2} by A44,TARSKI:def 1;
      then L+1 in Y & L+2 in Y by TARSKI:def 2;
      then L+1 in X\/Y & L+2 in X\/Y by XBOOLE_0:def 3;
      hence thesis by A14,A10,A45,A44,TARSKI:def 4;
    end;
  end;
  then reconsider ET = EE12^E2E1 as Enumeration of (F\/U12)\/(U2\/U1) by Th79;
A46: ( {{}}\/{{L+1,L+2}} )\/({{L+1}}\/{{L+2}}) = bool {L+1,L+2}
  proof
    thus ( {{}}\/{{L+1,L+2}} )\/({{L+1}}\/{{L+2}}) c= bool {L+1,L+2}
    proof
      let y be object;
      reconsider a=y as set by TARSKI:1;
      assume y in ( {{}}\/{{L+1,L+2}} )\/({{L+1}}\/{{L+2}});
      then y in {{}}\/{{L+1,L+2}} or y in {{L+1}}\/{{L+2}} by XBOOLE_0:def 3;
      then (y in {{}} or y in {{L+1,L+2}}) or (y in {{L+1}} or y in {{L+2}})
        by XBOOLE_0:def 3;
      then (y = {} or y ={L+1,L+2}) or (y ={L+1} or y = {L+2}) by TARSKI:def 1;
      then a c= {L+1,L+2} by ZFMISC_1:36;
      hence thesis;
    end;
    let y be object such that
A47:  y in bool {L+1,L+2};
    reconsider y as set by TARSKI:1;
    (y = {} or y ={L+1,L+2}) or (y ={L+1} or y = {L+2}) by A47,ZFMISC_1:36;
    then (y in {{}} or y in {{L+1,L+2}}) or (y in {{L+1}} or y in {{L+2}})
      by TARSKI:def 1;
    then y in {{}}\/{{L+1,L+2}} or y in {{L+1}}\/{{L+2}} by XBOOLE_0:def 3;
    hence thesis by XBOOLE_0:def 3;
  end;
A48: F=UNION(F,{{}})
  proof
    thus F c= UNION(F,{{}})
    proof
      let y be object such that
A49:    y in F;
      reconsider y as set by TARSKI:1;
      {} in {{}} by TARSKI:def 1;
      then y\/{} in UNION(F,{{}}) by A49,SETFAM_1:def 4;
      hence thesis;
    end;
    let y such that
A50:  y in UNION(F,{{}});
    consider X,Y such that
A51:  X in F &Y in {{}} & y = X\/Y by A50,SETFAM_1:def 4;
    Y={} by A51;
    hence thesis by A51;
  end;
  then
A52: F\/U12 = UNION(F, {{}}\/{{L+1,L+2}}) &
     U2\/U1 = UNION(F,{{L+1}}\/{{L+2}}) by Th7;
  then reconsider et=ET as Enumeration of F2 by A3,A46,Th7;
A53: F\/U1 = UNION(F, {{}}\/{{L+1}}) by A48,Th7
    .= UNION(F, {{}, {L+1}}) by ENUMSET1:1
    .= F1 by A3,ZFMISC_1:24;
  then reconsider ee1=EE1 as Enumeration of F1;
  take ee1,et;
A54: A "**" (SignGenOp(f12,A,F\/U12)*EE12)
    = A"**"((SignGenOp(f12,A,F)*E) ^ (SignGenOp(f12,A,U12)*E12)) by Th81
   .= (A"**"(SignGenOp(f12,A,F)*E))^(A"**"(SignGenOp(f12,A,U12)*E12)) by Th63
   .= (A "**" (SignGenOp(fA,A,F)*E))^(A"**"(SignGenOp(f12,A,U12)*E12))
     by Th84,A1,A5,A7
   .= (A "**" (SignGenOp(fA,A,F)*E))^(A"**"(SignGenOp(fA,A,U12)*E12))
   by Th87,A1,A18
   .= A "**" ( (SignGenOp(fA,A,F)*E)^(SignGenOp(fA,A,U12)*E12)) by Th63
   .= A "**" ( (SignGenOp(fA,A,F)*E)^(SignGenOp(fA,A,U1)*E1)) by A34,A28,Th90
   .= A "**" (SignGenOp(fA,A,F1)*ee1) by A53,Th81;
A55: A "**" (SignGenOp(f12,A,U2\/U1)*E2E1)
    = A "**" ((SignGenOp(f12,A,U2)*E2)^(SignGenOp(f12,A,U1)*E1)) by Th81
   .= (A "**" (SignGenOp(f12,A,U2)*E2))^(A"**" (SignGenOp(f12,A,U1)*E1))
     by Th63
   .= (A "**" (SignGenOp(f12,A,U2)*E2))^(A "**" (SignGenOp(fAI,A,U1)*E1))
      by Th86,A1,A9,A10
   .= (A "**" (SignGenOp(fAI,A,U2)*E2))^(A "**" (SignGenOp(fAI,A,U1)*E1))
      by Th85,A1,A14,A13
   .= (A "**" (SignGenOp(fAI,A,F)*E))^(A "**" (SignGenOp(fAI,A,U1)*E1))
      by A27,Th90,A38
   .= A "**" ((SignGenOp(fAI,A,F)*E)^(SignGenOp(fAI,A,U1)*E1)) by Th63
   .= A "**" (SignGenOp(fAI,A,F1)*ee1) by A53,Th81;
  SignGenOp(f12,A,F2)*et = SignGenOp(f12,A,(F\/U12)\/(U2\/U1))*ET
    by A3,A46,A52,Th7
    .= (SignGenOp(f12,A,(F\/U12))*EE12)^(SignGenOp(f12,A,(U2\/U1))*E2E1)
     by Th81;
  hence A"**" (SignGenOp(f12,A,F2)*et)
      = (A "**" (SignGenOp(fA,A,F1)*ee1))^ (A "**" (SignGenOp(fAI,A,F1)*ee1))
    by A54,A55,Th63;
end;
