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 Th116:
  A is having_a_unity associative having_an_inverseOp
implies
  for F, Fb be finite set st Fb = UNION(F,bool {len f+1}) & union F c= dom f
    for E1 be Enumeration of Fb
      ex E2 be Enumeration of Fb st
    SignGenOp(f^<* d1 *>,A,Fb)*E1 =
      SignGenOp(f^<*(the_inverseOp_wrt A).d1 *>,A,Fb)*E2
proof
  set I = the_inverseOp_wrt A;
  assume
A1: A is having_a_unity associative having_an_inverseOp;
  let F, Fb be finite set such that
A2: Fb = UNION(F,bool {len f+1}) and
A3: union F c= dom f;
  let E1 be Enumeration of Fb;
  defpred P[object,object] means $2 in dom E1 &
    (1+len f in (E1.$1) implies E1.$2 = (E1.$1)\{1+ len f}) &
    (not 1+len f in E1.$1 implies E1.$2 = (E1.$1)\/{1+ len f});
A4: rng E1 = Fb by RLAFFIN3:def 1;
A5: for x st x in dom E1 ex y st P[x,y]
  proof
    let x;
    assume x in dom E1;
    then E1.x in Fb by A4,FUNCT_1:def 3;
    then consider X,Y such that
A6:   X in F & Y in bool {len f+1} & E1.x = X \/ Y by A2,SETFAM_1:def 4;
    1+len f > len f by NAT_1:13;
    then
A7:   not 1+len f in dom f by FINSEQ_3:25;
A8:   X c= union F by A6,ZFMISC_1:74;
    then
A9:   not 1+len f in X by A7,A3;
    per cases by A6,ZFMISC_1:33;
    suppose
A10:    Y={1+len f};
      {} c= {len f+1};
      then (E1.x)\{1+ len f} = X & {} in bool {len f+1}
        by A6,A10,A9,ZFMISC_1:117;
      then ((E1.x)\{1+ len f})\/{} in Fb by A2,A6,SETFAM_1:def 4;
      then consider y such that
A11:    y in dom E1 & E1.y = (E1.x)\{1+ len f} by A4,FUNCT_1:def 3;
      take y;
      thus thesis by A11,A10,A6, ZFMISC_1:136;
    end;
    suppose
A12:    Y={};
      {len f+1} c= {len f+1};
      then (E1.x)\/ {len f+1} in Fb by A2,A6,A12,SETFAM_1:def 4;
      then consider y such that
A13:    y in dom E1 & E1.y = (E1.x)\/{1+ len f} by A4,FUNCT_1:def 3;
      take y;
      thus thesis by A13,A12,A6,A8,A7,A3;
    end;
  end;
  consider p be Function such that
A14: dom p = dom E1 and
A15: for x st x in dom E1 holds P[x,p.x] from CLASSES1:sch 1(A5);
  rng p c= dom E1
  proof
    let y;
    assume y in rng p;
    then ex x st x in dom p & p.x = y by FUNCT_1:def 3;
    hence thesis by A14,A15;
  end;
  then reconsider p as Function of dom E1,dom E1 by A14,FUNCT_2:2;
  dom E1 c= rng p
  proof
    let x;
    assume
A16:  x in dom E1;
    then E1.x in Fb by A4,FUNCT_1:def 3;
    then consider X,Y such that
A17:  X in F & Y in bool {len f+1} & E1.x = X \/ Y by A2,SETFAM_1:def 4;
    1+len f > len f by NAT_1:13;
    then
A18:  not 1+len f in dom f by FINSEQ_3:25;
A19:  X c= union F by A17,ZFMISC_1:74;
    then
A20:  not 1+len f in X by A18,A3;
    per cases by A17,ZFMISC_1:33;
    suppose
A21:    Y={1+len f};
      then
A22:    1+len f in E1.x by A17, ZFMISC_1:136;
      {} c= {len f+1};
      then (E1.x)\{1+ len f} = X & {} in bool {len f+1}
        by A17,A21,A20,ZFMISC_1:117;
      then ((E1.x)\{1+ len f})\/{} in Fb by A2,A17,SETFAM_1:def 4;
      then consider z be object  such that
A23:    z in dom E1 & E1.z = (E1.x)\{1+ len f} by A4,FUNCT_1:def 3;
      not 1+ len f in E1.z by A23,ZFMISC_1:56;
      then E1.(p.z) = (E1.z)\/ {1+ len f} & p.z in dom E1 by A23,A15;
      then p.z = x by A16,FUNCT_1:def 4,A23,A22,ZFMISC_1:116;
      hence thesis by A14,A23,FUNCT_1:def 3;
    end;
    suppose
A24:    Y={};
      then
A25:    not 1+len f in E1.x by A17,A19,A18,A3;
      {len f+1} c= {len f+1};
      then (E1.x)\/ {len f+1} in Fb by A17,A24,A2,SETFAM_1:def 4;
      then consider z be object such that
A26:    z in dom E1 & E1.z = (E1.x)\/{1+ len f} by A4,FUNCT_1:def 3;
      1+ len f in E1.z by A26,ZFMISC_1:136;
      then
A27:    E1.(p.z) = (E1.z)\ {1+ len f} & p.z in dom E1 by A26,A15;
      then E1.(p.z) = E1.x by A26,A25,ZFMISC_1:117;
      then p.z = x by A27,A16,FUNCT_1:def 4;
      hence thesis by A14,A26,FUNCT_1:def 3;
    end;
  end;
  then dom E1 =rng p;
  then
A28: p is onto & card dom E1 = card dom E1 by FUNCT_2:def 3;
  then p is one-to-one by FINSEQ_4:63;
  then reconsider p as Permutation of dom E1 by A28;
  reconsider E1p=E1*p as Enumeration of Fb by Th109;
  take E1p;
A29: len (SignGenOp(f^<* d1 *>,A,Fb)*E1) = len E1 = card Fb &
    len (SignGenOp(f^<* I.d1 *>,A,Fb)*E1p) = len E1p = card Fb by CARD_1:def 7;
  for i st 1 <= i <= len (SignGenOp(f^<* d1 *>,A,Fb)*E1) holds
    (SignGenOp(f^<* d1 *>,A,Fb)*E1).i = (SignGenOp(f^<* I.d1 *>,A,Fb)*E1p).i
  proof
    let i such that
A30:  1 <= i <= len (SignGenOp(f^<* d1 *>,A,Fb)*E1);
    i in dom (SignGenOp(f^<* d1 *>,A,Fb)*E1) &
    i in dom (SignGenOp(f^<* I.d1 *>,A,Fb)*E1p) by A29,A30,FINSEQ_3:25;
    then
A31:  (SignGenOp(f^<* d1 *>,A,Fb)*E1).i = SignGen(f^<*d1*>,A,E1.i)&
    (SignGenOp(f^<* I.d1 *>,A,Fb)*E1p).i = SignGen(f^<*I.d1*>,A,E1p.i) by Th80;
    i in dom E1p by A30,A29,FINSEQ_3:25;
    then
A32:  i in dom p & E1p.i = E1.(p.i) by FUNCT_1:11,12;
A33:  len (f^<* d1 *>) = 1+ len f = len (f^<*I.d1*>) by FINSEQ_2:16;
A34:  (f^<* d1 *>)|(len f) = f =(f^<* I.d1 *>)|(len f);
A35:  (f^<* d1 *>).(1+len f) = d1 & (f^<* I.d1 *>).(1+len f) =I.d1;
    1+len f > len f by NAT_1:13;
    then not 1+len f in dom f by FINSEQ_3:25;
    then
A36:  {1+len f} misses dom f by ZFMISC_1:50;
    per cases;
    suppose
A37:    1+ len f in (E1.i);
      E1.(p.i) = (E1.i)\{1+len f} by A37,A15,A32;
      then not 1+len f in E1p.i by A32,ZFMISC_1:56;
      then
A38:    SignGen(f^<*I.d1*>,A,E1p.i) = SignGen(f,A,E1p.i)^<*I.d1*>
        by A33,A34,A35,Th74;
      (E1p.i) /\ dom f = ((E1.i)\{1+len f})/\dom f by A37,A15,A32
      .= (dom f /\ (E1.i)) \ (dom f /\ {1+len f}) by XBOOLE_1:50
      .= dom f /\ (E1.i) by A36;
      then SignGen(f,A,E1p.i) = SignGen(f,A,(E1.i) /\dom f) by Th89
      .= SignGen(f,A,E1.i) by Th89;
      hence thesis by A37,A33,A34,A35,Th73,A38,A31;
    end;
    suppose
A39:    not 1+ len f in (E1.i);
      E1.(p.i) = (E1.i)\/{1+len f} by A39,A15,A32;
      then 1+len f in E1p.i by A32,ZFMISC_1:136;
      then
A40:    SignGen(f^<*I.d1*>,A,E1p.i) = SignGen(f,A,E1p.i)^<*I.(I.d1)*>
        by A33,A34,A35,Th73;
A41:    I.(I.d1) = d1 by A1,FINSEQOP:62;
      (E1p.i) /\ dom f = (dom f)/\((E1.i)\/{1+len f}) by A39,A15,A32
      .= (dom f /\ (E1.i)) \/ (dom f /\ {1+len f}) by XBOOLE_1:23
      .= dom f /\ (E1.i) by A36;
      then SignGen(f,A,E1p.i) = SignGen(f,A,(E1.i) /\dom f) by Th89
      .= SignGen(f,A,E1.i) by Th89;
      hence thesis by A39,A33,A34,A35,Th74,A40,A31,A41;
    end;
  end;
  hence thesis by A29;
end;
