reserve a,x,y for object, A,B for set,
  l,m,n for Nat;

theorem Th9:
  for f,g,h being Function st rng h c= dom f holds f*(g +* h) = (f
  *g) +* (f*h)
proof
  let f,g,h be Function such that
A1: rng h c= dom f;
A2: dom h c= dom(g+*h) by FUNCT_4:10;
A3: dom g c= dom(g+*h) by FUNCT_4:10;
A4: dom(f*(g +* h)) = dom(f*g) \/ dom(f*h)
  proof
    thus dom(f*(g +* h)) c= dom(f*g) \/ dom(f*h)
    proof
      let x be object;
      assume
A5:   x in dom(f*(g +* h));
      then
A6:   (g +* h).x in dom f by FUNCT_1:11;
      x in dom(g +* h) by A5,FUNCT_1:11;
      then
A7:   x in dom g \/ dom h by FUNCT_4:def 1;
      per cases;
      suppose
A8:     x in dom h;
        then h.x in dom f by A6,FUNCT_4:13;
        then x in dom(f*h) by A8,FUNCT_1:11;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose
        not x in dom h;
        then g.x in dom f & x in dom g by A7,A6,FUNCT_4:11,XBOOLE_0:def 3;
        then x in dom(f*g) by FUNCT_1:11;
        hence thesis by XBOOLE_0:def 3;
      end;
    end;
    let x be object;
    assume
A9: x in dom(f*g) \/ dom(f*h);
    per cases;
    suppose
A10:  x in dom(f*h);
      then
A11:  h.x in dom f by FUNCT_1:11;
A12:  x in dom h by A10,FUNCT_1:11;
      then (g +* h).x = h.x by FUNCT_4:13;
      hence thesis by A2,A12,A11,FUNCT_1:11;
    end;
    suppose
A13:  not x in dom(f*h);
      x in dom h implies h.x in dom f
      proof
        assume x in dom h;
        then h.x in rng h by FUNCT_1:3;
        hence thesis by A1;
      end;
      then not x in dom h by A13,FUNCT_1:11;
      then
A14:  (g +* h).x = g.x by FUNCT_4:11;
      x in dom(f*g) by A9,A13,XBOOLE_0:def 3;
      then g.x in dom f & x in dom g by FUNCT_1:11;
      hence thesis by A3,A14,FUNCT_1:11;
    end;
  end;
  now
    let x be object;
    assume
A15: x in dom(f*g) \/ dom(f*h);
    thus x in dom(f*h) implies (f*(g +* h)).x = (f*h).x
    proof
      assume x in dom(f*h);
      then
A16:  x in dom h by FUNCT_1:11;
      hence (f*(g +* h)).x = f.((g +* h).x) by A2,FUNCT_1:13
        .= f.(h.x) by A16,FUNCT_4:13
        .= (f*h).x by A16,FUNCT_1:13;
    end;
    assume
A17: not x in dom(f*h);
    x in dom h implies h.x in dom f
    proof
      assume x in dom h;
      then h.x in rng h by FUNCT_1:3;
      hence thesis by A1;
    end;
    then
A18: not x in dom h by A17,FUNCT_1:11;
    x in dom(f*g) by A15,A17,XBOOLE_0:def 3;
    then
A19: x in dom g by FUNCT_1:11;
    hence (f*(g +* h)).x = f.((g +* h).x) by A3,FUNCT_1:13
      .= f.(g.x) by A18,FUNCT_4:11
      .= (f*g).x by A19,FUNCT_1:13;
  end;
  hence thesis by A4,FUNCT_4:def 1;
end;
