reserve x,y,y1,y2 for set;
reserve C for non empty set;
reserve c for Element of C;
reserve f,h,g,h1 for Membership_Func of C;

theorem
  (f ++ g) ++ h = f ++ (g ++ h)
proof
A1: C = dom(f ++ (g ++ h)) by FUNCT_2:def 1;
A2: for c being Element of C st c in C holds ((f ++ g) ++ h).c = (f ++ (g ++
  h)).c
  proof
    let c;
    set x = f.c, y = g.c, z = h.c;
A3: (f ++ (g ++ h)).c = x + (g ++ h).c -x*((g ++ h).c) by Def3
      .= x + (y + z -y*z) -x*((g ++ h).c) by Def3
      .= x + (y + z) -y*z -x*(y + z -y*z) by Def3
      .= -y*z -x*y - x*z +x*y*z + (x + y + z);
    ((f ++ g) ++ h).c = (f ++ g).c + h.c - ((f ++ g).c)*(h.c) by Def3
      .= f.c + g.c -(f.c)*(g.c) + h.c - ((f ++ g).c)*(h.c) by Def3
      .= (-x*y + (x + y)) + z - (x + y -x*y)*z by Def3
      .= -x*y - x*z - y*z +x*y*z + (x + y + z);
    hence thesis by A3;
  end;
  C = dom((f ++ g) ++ h) by FUNCT_2:def 1;
  hence thesis by A1,A2,PARTFUN1:5;
end;
