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;

theorem Th68:
  len F = 1 & M is commutative associative &
    A  is commutative associative implies
  M $$ ([#]dom F, A "**" F) = A $$ ([#]dom App F, M "**" App(F))
proof
  set F1 =F.1;
  assume that
A1: len F=1 and
A2: M is commutative associative & A is commutative associative;
A3: F= <*F.1*> by A1,FINSEQ_1:40;
  then dom F={1} by FINSEQ_1:38,2;
  then
A4: [#]dom F = {.1 .} & 1 is Element of dom F by TARSKI:def 1;
  then M $$ ([#]dom F, A "**" F) = (A "**" F).1 by A2,SETWISEO:17;
  then
A5: M $$ ([#]dom F, A "**" F) = A "**" F1 by A4,Def10;
  set f=M "**" App(F), X = dom App F;
A6: X =doms F by Def9;
  consider G be Function of Fin X, D such that
A7: A $$ ([#]X,f) = G.[#]X and
    for e being Element of D st e is_a_unity_wrt A holds G.{} = e and
A8: for x being Element of X holds G.{x} = f.x and
A9: for B9 being Element of Fin X st
      B9 c= [#]X & B9 <> {} for x being Element of X st
        x in [#]X \ B9 holds G.(B9 \/ {x}) = A.(G.B9,f.x) by A2,SETWISEO:def 3;
A10: len F1 >=1+0 by A4,NAT_1:13;
  then consider s be sequence of D  such that
A11: s.1 = F1.1 and
A12: for n being Nat st 0 <> n & n < len F1 holds s.(n + 1) =
    A.(s.n,F1.(n + 1)) and
A13: A "**" F1 = s.(len F1) by FINSOP_1:1;
  deffunc R(Nat) = { <* i *> where i is Element of NAT: i in Seg $1};
  defpred P[Nat] means $1 <= len F1 implies
    for B9 be Element of Fin X st B9 = R($1) holds G.B9 = s.$1;
A14: P[1]
  proof
    assume
A15:  1<= len F1;
    let B9 be Element of Fin X such that
A16:  B9 = R(1);
A17:  1 in dom F1 by A15,FINSEQ_3:25;
    then F1.1 in rng F1 & rng F1 c= D by FUNCT_1:def 3;
    then reconsider F11=F1.1 as Element of D;
A18:  R(1) c= {<*1*>}
    proof
      let y;
      assume y in R(1);
      then consider i be Element of NAT such that
A19:    <* i *>= y & i in Seg 1;
      i = 1 by A19,FINSEQ_1:2,TARSKI:def 1;
      hence thesis by A19,TARSKI:def 1;
    end;
    {<*1*>} c= R(1)
    proof
      let y be object;
      assume y in {<*1*>};
      then y=<*1*> & 1 in Seg 1 by TARSKI:def 1;
      hence thesis;
    end;
    then
A20:  R(1) = { <*1*>} by A18;
A21:  <*1*> in B9 & B9 c= X by A16,A20,TARSKI:def 1,FINSUB_1:def 5;
    then G.B9 = f.<*1*> by A16,A20,A8;
    then G.B9= M "**" ((App(F)). <*1*>) by A21,Def10;
    then G.B9= M "**" <*F11*> by A3,Th60,A17;
    hence thesis by A11,FINSOP_1:11;
  end;
A22: for j st 1 <= j holds P[j] implies P[j+1]
  proof
    let j such that
A23:  1 <= j and
A24:  P[j];
    set j1=j+1;
    assume
A25:  j1 <= len F1;
    j1 in dom F1 by NAT_1:11,A25,FINSEQ_3:25;
    then F1.j1 in rng F1 & rng F1 c= D by FUNCT_1:def 3;
    then reconsider F1j1=F1.j1 as Element of D;
    let B9 be Element of Fin X such that
A26:  B9=R(j1);
A27: j < len F1 by A25,NAT_1:13;
    R(j) c= X
    proof
      let y;
      assume y in R(j);
      then consider i be Element of NAT such that
A28:    <* i *>= y & i in Seg j;
A29:  1<=i & i <= j by A28,FINSEQ_1:1;
      then i<= len F1 by A27,XXREAL_0:2;
      then <* i *>.1 in dom F1 & len <*i*>=1 by FINSEQ_1:40,A29,FINSEQ_3:25;
      hence thesis by A28,A6,A3,Th51;
    end;
    then reconsider Rj=R(j) as Element of Fin X by FINSUB_1:def 5;
A30:  Rj c= B9
    proof
      let y;
      assume y in Rj;
      then consider i be Element of NAT such that
A31:    <* i *>= y & i in Seg j;
A32:    1<=i & i <= j by A31,FINSEQ_1:1;
      then i<= j1 by NAT_1:13;
      then i in Seg j1 by A32;
      hence thesis by A31,A26;
    end;
    j1 in Seg j1 by FINSEQ_1:4;
    then <*j1*> in B9 by A26;
    then
A33:  {<*j1*>} c= B9 by ZFMISC_1:31;
    B9 c= Rj \/ {<*j1*>}
    proof
      let y;
      assume y in B9;
      then consider i be Element of NAT such that
A34:    <* i *>= y & i in Seg j1 by A26;
      i in (Seg j) \/{j1} by A34,FINSEQ_1:9;
      then i in Seg j or i in {j1} by XBOOLE_0:def 3;
      then i in Seg j or i = j1 by TARSKI:def 1;
      then <*i*> in Rj or <*i*> in {<*j1*>} by TARSKI:def 1;
      hence thesis by A34,XBOOLE_0:def 3;
    end;
    then
A35:  B9 = Rj \/ {<*j1*>} by A33,A30, XBOOLE_1:8;
A36:  G.Rj = s.j by A24,A25,NAT_1:13;
A37:  Rj c= [#]X by FINSUB_1:def 5;
    j in Seg j by A23;
    then
A38:  <*j*> in Rj;
A39:  <*j1*>.1 in dom F1 & len <*j1*>=1 & <*j1*>.1 =j1
      by NAT_1:11,A25,FINSEQ_1:40,FINSEQ_3:25;
    then reconsider J=<*j1*> as Element of X by A6,A3,Th51;
    f.J = M "**" ((App(F)). <*j1*>) by Def10;
    then f.J= M "**" <*F1j1*> by A3,A39,Th60;
    then
A40:  f.J = F1j1 by FINSOP_1:11;
    not J in Rj
    proof
      assume J in Rj;
      then consider i be Element of NAT such that
A41:    <* i *>= J & i in Seg j;
      i <= j & j1=i by FINSEQ_1:76,A41,FINSEQ_1:1;
      hence thesis by NAT_1:13;
    end;
    then J in [#]X \ Rj by XBOOLE_0:def 5;
    then G.B9 = A.(s.j,F1j1) by A40,A36,A35,A37,A38,A9;
    hence thesis by A12,A25,NAT_1:13,A23;
  end;
A42: for i st 1 <= i holds P[i] from NAT_1:sch 8(A14,A22);
  R(len F1)=X
  proof
    thus R(len F1) c= X
    proof
      let y;
      assume y in R(len F1);
      then consider i be Element of NAT such that
A43:    <* i *>= y & i in Seg len F1;
      <* i *>.1 in dom F1 & len <*i*>=1 by FINSEQ_1:40,A43,FINSEQ_1:def 3;
      hence thesis by A43,A6,A3,Th51;
    end;
    let y such that
A44:  y in X;
    reconsider f=y as FinSequence by A44;
    len f = 1 & f.1 in dom F1 by Th51,A44,A3;
    then f=<*f.1*> & f.1 in Seg len F1 by FINSEQ_1:40,def 3;
    hence thesis;
  end;
  hence thesis by A5,A13,A7,A42,A10;
end;
