reserve x,y,z,X,Y for set;
reserve X,Y for non empty set,
  f for Function of X,Y;

theorem Th13:
  for X, Y being non empty set for F being BinOp of Y for B being
Element of Fin X for f being Function of X,Y st (B <> {} or F is having_a_unity
) & F is idempotent & F is commutative & F is associative for IT being Element
of Y holds IT = F $$ (B,f) iff ex G being Function of Fin X, Y st IT = G.B & (
  for e being Element of Y st e is_a_unity_wrt F holds G.{} = e) & (for x being
Element of X holds G.{x} = f.x) & for B9 being Element of Fin X st B9 c= B & B9
  <> {} for x being Element of X st x in B holds G.(B9 \/ {x}) = F.(G.B9,f.x)
proof
  let X, Y be non empty set;
  let F be BinOp of Y;
  let B be Element of Fin X;
  let f be Function of X,Y;
  assume that
A1: B <> {} or F is having_a_unity and
A2: F is idempotent and
A3: F is commutative and
A4: F is associative;
  let IT be Element of Y;
  thus IT = F $$ (B,f) implies ex G being Function of Fin X, Y st IT = G.B & (
  for e being Element of Y st e is_a_unity_wrt F holds G.{} = e) & (for x being
Element of X holds G.{x} = f.x) & for B9 being Element of Fin X st B9 c= B & B9
  <> {} for x being Element of X st x in B holds G.(B9 \/ {x}) = F.(G.B9,f.x)
  proof
    assume IT = F $$ (B,f);
    then consider G being Function of Fin X, Y such that
A5: IT = G.B & for e being Element of Y st e is_a_unity_wrt F holds G.
    {} = e and
A6: for x being Element of X holds G.{x} = f.x and
A7: for B9 being Element of Fin X st B9 c= B & B9 <> {} for x being
    Element of X st x in B \ B9 holds G.(B9 \/ {x}) = F.(G.B9,f.x) by A1,A3,A4
,Def3;
    for B9 being Element of Fin X st B9 c= B & B9 <> {} for x being
    Element of X st x in B holds G.(B9 \/ {x}) = F.(G.B9,f.x)
    proof
      let B9 be Element of Fin X such that
A8:   B9 c= B and
A9:   B9 <> {};
      let x be Element of X such that
A10:  x in B;
      per cases;
      suppose
        x in B9;
        then
A11:    B9 \/ {x} = B9 by ZFMISC_1:40;
        then
A12:    {x} c= B9 by XBOOLE_1:7;
        not x in B9 \ {x} by ZFMISC_1:56;
        then
A13:    x in B \ (B9 \ {x}) by A10,XBOOLE_0:def 5;
        per cases;
        suppose
A14:      B9 = {x};
          hence G.(B9 \/ {x}) = F.(f.x, f.x) by A2,A6
            .= F.(G.B9,f.x) by A6,A14;
        end;
        suppose
          B9 <> {x};
          then not B9 c= {x} by A12,XBOOLE_0:def 10;
          then B9 \ {x} <> {} by XBOOLE_1:37;
          then
A15:      G.(B9 \ {.x.} \/ {.x.}) = F.(G.(B9 \ {.x.}), f.x) by A7,A8,A13,
XBOOLE_1:1;
          thus G.(B9 \/ {x})
             = F.(G.(B9 \ {x}), F.(f.x,f.x)) by A2,A15,XBOOLE_1:39
            .= F.(F.(G.(B9 \ {.x.}),f.x), f.x) by A4
            .= F.(G.B9,f.x) by A11,A15,XBOOLE_1:39;
        end;
      end;
      suppose
        not x in B9;
        then x in B \ B9 by A10,XBOOLE_0:def 5;
        hence thesis by A7,A8,A9;
      end;
    end;
    hence thesis by A5,A6;
  end;
  given G being Function of Fin X, Y such that
A16: ( IT = G.B & for e being Element of Y st e is_a_unity_wrt F holds G
  .{} = e ) & for x being Element of X holds G.{x} = f.x and
A17: for B9 being Element of Fin X st B9 c= B & B9 <> {} for x being
  Element of X st x in B holds G.(B9 \/ {x}) = F.(G.B9,f.x);
  for B9 being Element of Fin X st B9 c= B & B9 <> {} for x being Element
  of X st x in B \ B9 holds G.(B9 \/ {x}) = F.(G.B9,f.x)
  proof
    let B9 be Element of Fin X such that
A18: B9 c= B & B9 <> {};
    let x be Element of X;
    assume x in B \ B9;
    then x in B by XBOOLE_0:def 5;
    hence thesis by A17,A18;
  end;
  hence thesis by A1,A3,A4,A16,Def3;
end;
