
theorem LM01:
  for I be set, F, D, R be ManySortedSet of I st
  (for i be object st i in I holds
  ex f be Function st f = F.i & dom f = D.i & rng f = R.i) &
  (for i,j be object, f,g be Function st i in I & j in I &
  i <> j & f = F.i & g = F.j holds dom(f) misses dom(g)) holds
  ex G be Function st G = union rng F &
  dom G = union rng D & rng G = union rng R &
  for i, x be object, f be Function st i in I &
  f = F.i & x in dom f
  holds G.x = f.x
proof
  let I be set, F, D, R be ManySortedSet of I;
  assume
A1: for i be object st i in I holds
  ex f be Function st f = F.i &
  dom f = D.i & rng f = R.i;
  assume
A2: for i, j be object, f, g be Function st i in I &
  j in I & i <> j & f = F.i & g =F.j
  holds dom(f) misses dom(g);
P0: dom F = I by PARTFUN1:def 2;
R0: dom R = I by PARTFUN1:def 2;
Q0: dom D = I by PARTFUN1:def 2;
P1: for z be object st z in union rng F
  holds ex x, y, i be object st z = [x, y] & z in F.i & i in I
  proof
    let z be object;
    assume z in union rng F;
    then consider Z be set such that
P02:  z in Z & Z in (rng F) by TARSKI:def 4;
    consider i be object such that
P03:  i in dom F & Z=F.i by P02, FUNCT_1:def 3;
    consider f be Function such that
P05:  f = F.i & dom f = D.i & rng f = R.i by P03, A1;
    ex x, y be object st z = [x, y] by P02, P03, P05, RELAT_1:def 1;
    hence thesis by P02, P03;
  end;
  for z be object st z in union rng F
  holds ex x, y be object st z = [x, y]
  proof
    let z be object;
    assume z in union rng F; then
    ex x, y, i be object st z = [x, y] & z in F.i & i in I by P1;
    hence thesis;
  end;
  then
  reconsider G = union rng F as Relation by RELAT_1:def 1;
  G is Function
  proof
    for x, y1, y2 be object st [x, y1] in G & [x, y2] in G holds y1 = y2
    proof
      let x, y1, y2 be object;
      assume
P01:  [x, y1] in G & [x, y2] in G;
      then
      consider a1, b1, i be object such that
P02:  [x, y1] = [a1, b1] & [x, y1] in F.i & i in I by P1;
      consider a2, b2, j be object such that
P03:  [x, y2] = [a2, b2] & [x, y2] in F.j & j in I by P1, P01;
      consider f be Function such that
P04:  f = F.i & dom f = D.i & rng f = R.i by A1, P02;
      consider g be Function such that
P05:  g = F.j & dom g = D.j & rng g = R.j by A1, P03;
      i = j
      proof
        assume
Q04:    i <> j;
P041:   x in D.i by P02, P04, XTUPLE_0:def 12;
P042:   x in D.j by P03, P05, XTUPLE_0:def 12;
        D.i /\ D.j = {}
        by P02, P03, P04, P05, Q04, A2, XBOOLE_0:def 7;
        hence contradiction by P041, P042, XBOOLE_0:def 4;
      end;
      hence y1 = y2 by P02, P03, P04, FUNCT_1:def 1;
    end;
    hence thesis by FUNCT_1:def 1;
  end;
  then
  reconsider G as Function;
  take G;
  thus G = union rng F;
  for x be object holds x in dom G iff x in union rng D
  proof
    let x be object;
    hereby
      assume x in dom G;
      then
      consider y be object such that
S2:   [x, y] in G by XTUPLE_0:def 12;
      consider a, b, i be object such that
S3:   [x, y] = [a, b] & [x, y] in F.i & i in I by P1, S2;
      consider f be Function such that
S4:   f = F.i & dom f = D.i & rng f = R.i by A1, S3;
S5:   x in D.i by S3, S4, XTUPLE_0:def 12;
      D.i in rng D by Q0, S3, FUNCT_1:3;
      hence x in union rng D by S5, TARSKI:def 4;
    end;
    assume x in union rng D;
    then consider Z be set such that
S6: x in Z & Z in rng D by TARSKI:def 4;
    consider i be object such that
S7: i in dom D & Z=D.i by S6, FUNCT_1:def 3;
    consider f be Function such that
S9: f = F.i & dom f = D.i & rng f = R.i by S7, A1;
    consider y be object such that
S11: [x, y] in f by S6, S7, S9, XTUPLE_0:def 12;
    F.i in rng F by FUNCT_1:3, P0, S7;
    then
    [x, y] in G by S9, S11, TARSKI:def 4;
    hence x in dom G by XTUPLE_0:def 12;
  end;
hence dom G = union rng D by TARSKI:2;
for x be object holds x in rng G iff x in union rng R
  proof
    let x be object;
    hereby
      assume x in rng G;
      then
      consider y be object such that S2: [y, x] in G by XTUPLE_0:def 13;
      consider a, b, i be object such that
S3:   [y, x] = [a, b] & [y, x] in F.i & i in I by P1,S2;
      consider f be Function such that
S4:   f = F.i & dom f = D.i & rng f = R.i by A1, S3;
S5:   x in R.i by S3, S4, XTUPLE_0:def 13;
      R.i in rng R by R0, S3, FUNCT_1:3;
      hence x in union rng R by S5,TARSKI:def 4;
    end;
    assume x in union rng R;
    then consider Z be set such that
S6: x in Z & Z in rng R by TARSKI:def 4;
    consider i be object such that
S7: i in dom R & Z=R.i by S6,FUNCT_1:def 3;
    consider f be Function such that
S9: f = F.i & dom f = D.i & rng f = R.i by S7, A1;
    consider y be object such that
S11: [y, x] in f by S6, S7, S9, XTUPLE_0:def 13;
    F.i in rng F by FUNCT_1:3, P0, S7; then
    [y, x] in G by S9, S11, TARSKI:def 4;
    hence x in rng G by XTUPLE_0:def 13;
  end;
  hence rng G = union rng R by TARSKI:2;
  thus for i, x be object, f be Function st i in I & f = F.i &
  x in dom f holds G.x = f.x
  proof
    let i, x be object, f be Function;
    assume
A1: i in I & f = F.i & x in dom f; then
P2: [x, f.x] in F.i by FUNCT_1:1;
    F.i in rng F by FUNCT_1:3, A1, P0; then
    [x, f.x] in G by P2, TARSKI:def 4;
    hence G.x = f.x by FUNCT_1:1;
  end;
end;
