reserve x,y,z, X,Y,Z for set,
  n for Element of NAT;
reserve A for set,
  D for non empty set,
  a,b,c,l,r for Element of D,
  o,o9 for BinOp of D,
  f,g,h for Function of A,D;

theorem Th4:
  o is associative implies o.:(o.:(f,g),h) = o.:(f,o.:(g,h))
proof
A1: dom (o.:(f,g)) = A by FUNCT_2:def 1;
A2: dom (o.:(g,h)) = A by FUNCT_2:def 1;
A3: dom f = A & dom g = A by FUNCT_2:def 1;
A4: dom (o.:(o.:(f,g),h)) = A by FUNCT_2:def 1;
A5: dom h = A by FUNCT_2:def 1;
A6: dom (o.:(f,o.:(g,h))) = A by FUNCT_2:def 1;
  assume
A7: o.(o.(a,b),c) = o.(a,o.(b,c));
  now
    let x be object;
    assume
A8: x in A;
    then
A9: h.x in rng h by A5,FUNCT_1:def 3;
    f.x in rng f & g.x in rng g by A3,A8,FUNCT_1:def 3;
    then reconsider a = f.x, b = g.x, c = h.x as Element of D by A9;
    thus (o.:(o.:(f,g),h)).x = o.((o.:(f,g)).x,c) by A4,A8,FUNCOP_1:22
      .= o.(o.(a,b),c) by A1,A8,FUNCOP_1:22
      .= o.(a,o.(b,c)) by A7
      .= o.(a,(o.:(g,h)).x) by A2,A8,FUNCOP_1:22
      .= (o.:(f,o.:(g,h))).x by A6,A8,FUNCOP_1:22;
  end;
  hence thesis by A4,A6,FUNCT_1:2;
end;
