reserve X for non empty set;
reserve e,e1,e2,e19,e29 for Equivalence_Relation of X,
  x,y,x9,y9 for set;
reserve A for non empty set,
  L for lower-bounded LATTICE;
reserve T,L1 for Sequence,
  O,O1,O2,O3,C for Ordinal;

theorem
  ex A being non empty set, f being Homomorphism of L,EqRelLATT A st f
  is one-to-one & type_of Image f <= 3
proof
  set A = the carrier of L, D = BasicDF(L);
  set S = the ExtensionSeq of A,D;
  set FS = union the set of all  (S.i)`1 where i is Element of NAT;
A1: (S.0)`1 in the set of all  (S.i)`1 where i is Element of NAT;
A2: S.0 = [A,D] by Def20;
  A c= FS by A1,A2,ZFMISC_1:74;
  then reconsider FS as non empty set;
  reconsider FD
   = union the set of all  (S.i)`2 where i is Element of NAT
 as distance_function of FS,L by Th41;
  alpha FD is join-preserving
  proof
    set f = alpha FD;
    let a,b be Element of L;
A3: ex_sup_of f.:{a,b},EqRelLATT FS by YELLOW_0:17;
    consider e3 being Equivalence_Relation of FS such that
A4: e3 = f.(a "\/" b) and
A5: for x,y being Element of FS holds [x,y] in e3 iff FD.(x,y) <= a
    "\/"b by Def8;
    consider e2 being Equivalence_Relation of FS such that
A6: e2 = f.b and
A7: for x,y being Element of FS holds [x,y] in e2 iff FD.(x,y) <= b by Def8;
    consider e1 being Equivalence_Relation of FS such that
A8: e1 = f.a and
A9: for x,y being Element of FS holds [x,y] in e1 iff FD.(x,y) <= a by Def8;
A10: field e2 = FS by ORDERS_1:12;
    now
      let x,y be object;
A11:  b <= b "\/" a by YELLOW_0:22;
      assume
A12:  [x,y] in e2;
      then reconsider x9 = x, y9 = y as Element of FS by A10,RELAT_1:15;
      FD.(x9,y9) <= b by A7,A12;
      then FD.(x9,y9) <= b "\/" a by A11,ORDERS_2:3;
      hence [x,y] in e3 by A5;
    end;
    then
A13: e2 c= e3 by RELAT_1:def 3;
A14: field e3 = FS by ORDERS_1:12;
    for u,v being object holds [u,v] in e3 implies [u,v] in e1 "\/" e2
    proof
      let u,v be object;
A15:  3 in Seg 5;
      assume
A16:  [u,v] in e3;
      then reconsider x = u, y = v as Element of FS by A14,RELAT_1:15;
      FD.(x,y) <= a"\/"b by A5,A16;
      then consider z1,z2,z3 being Element of FS such that
A17:  FD.(x,z1) = a and
A18:  FD.(z2,z3) = a and
A19:  FD.(z1,z2) = b and
A20:  FD.(z3,y) = b by Th42;
A21:  u in FS by A14,A16,RELAT_1:15;
      defpred P[set,object] means
($1 = 1 implies $2 = x) & ($1 = 2 implies $2 =
z1) & ($1 = 3 implies $2 = z2) & ($1 = 4 implies $2 = z3) & ($1 = 5 implies $2
      = y);
A22:  for m being Nat st m in Seg 5 ex w being object st P[m,w]
      proof
        let m be Nat;
        assume m in Seg 5;
        then m = 1 or ... or m = 5 by Lm3;
        then per cases;
        suppose
A23:      m = 1;
          take x;
          thus thesis by A23;
        end;
        suppose
A24:      m = 2;
          take z1;
          thus thesis by A24;
        end;
        suppose
A25:      m = 3;
          take z2;
          thus thesis by A25;
        end;
        suppose
A26:      m = 4;
          take z3;
          thus thesis by A26;
        end;
        suppose
A27:      m = 5;
          take y;
          thus thesis by A27;
        end;
      end;
      ex p being FinSequence st dom p = Seg 5 & for k being Nat st k in
      Seg 5 holds P[k,p.k] from FINSEQ_1:sch 1(A22);
      then consider h being FinSequence such that
A28:  dom h = Seg 5 and
A29:  for m being Nat st m in Seg 5 holds (m = 1 implies h.m = x) & (
m = 2 implies h.m = z1) & (m = 3 implies h.m = z2) & (m = 4 implies h.m = z3) &
      (m = 5 implies h.m = y);
A30:  len h = 5 by A28,FINSEQ_1:def 3;
A31:  5 in Seg 5;
A32:  4 in Seg 5;
A33:  1 in Seg 5;
      then
A34:  u = h.1 by A29;
A35:  2 in Seg 5;
A36:  for j being Nat st 1 <= j & j < len h holds [h.j,h.(j+1)
      ] in e1 \/ e2
      proof
        let j be Nat;
        assume 1 <= j & j < len h;
        then j = 1 or ... or j = 4 by A30,Lm2;
        then per cases;
        suppose
A37:      j = 1;
          [x,z1] in e1 by A9,A17;
          then [h.1,z1] in e1 by A29,A33;
          then [h.1,h.2] in e1 by A29,A35;
          hence thesis by A37,XBOOLE_0:def 3;
        end;
        suppose
A38:      j = 3;
          [z2,z3] in e1 by A9,A18;
          then [h.3,z3] in e1 by A29,A15;
          then [h.3,h.4] in e1 by A29,A32;
          hence thesis by A38,XBOOLE_0:def 3;
        end;
        suppose
A39:      j = 2;
          [z1,z2] in e2 by A7,A19;
          then [h.2,z2] in e2 by A29,A35;
          then [h.2,h.3] in e2 by A29,A15;
          hence thesis by A39,XBOOLE_0:def 3;
        end;
        suppose
A40:      j = 4;
          [z3,y] in e2 by A7,A20;
          then [h.4,y] in e2 by A29,A32;
          then [h.4,h.5] in e2 by A29,A31;
          hence thesis by A40,XBOOLE_0:def 3;
        end;
      end;
      v = h.5 by A29,A31
        .= h.(len h) by A28,FINSEQ_1:def 3;
      hence thesis by A21,A30,A34,A36,EQREL_1:28;
    end;
    then
A41: e3 c= e1 "\/" e2 by RELAT_1:def 3;
A42: field e1 = FS by ORDERS_1:12;
    now
      let x,y be object;
A43:  a <= a "\/" b by YELLOW_0:22;
      assume
A44:  [x,y] in e1;
      then reconsider x9 = x, y9 = y as Element of FS by A42,RELAT_1:15;
      FD.(x9,y9) <= a by A9,A44;
      then FD.(x9,y9) <= a "\/" b by A43,ORDERS_2:3;
      hence [x,y] in e3 by A5;
    end;
    then e1 c= e3 by RELAT_1:def 3;
    then e1 \/ e2 c= e3 by A13,XBOOLE_1:8;
    then
A45: e1 "\/" e2 c= e3 by EQREL_1:def 2;
    dom f = the carrier of L by FUNCT_2:def 1;
    then sup (f.:{a,b}) = sup {f.a,f.b} by FUNCT_1:60
      .= f.a "\/" f.b by YELLOW_0:41
      .= e1 "\/" e2 by A8,A6,Th10
      .= f.(a "\/" b) by A4,A45,A41
      .= f.sup {a,b} by YELLOW_0:41;
    hence thesis by A3;
  end;
  then reconsider f = alpha FD as Homomorphism of L,EqRelLATT FS by Th14;
A46: dom f = the carrier of L by FUNCT_2:def 1;
A47: Image f = subrelstr rng f by YELLOW_2:def 2;
A48: ex e being Equivalence_Relation of FS st e in the carrier of Image f &
  e <> id FS
  proof
A49: {A} <> {{A}}
    proof
      assume {A} = {{A}};
      then {A} in {A} by TARSKI:def 1;
      hence contradiction;
    end;
    consider A9 being non empty set, d9 being distance_function of A9,L, Aq9
    being non empty set, dq9 being distance_function of Aq9,L such that
A50: Aq9, dq9 is_extension_of A9,d9 and
A51: S.0 = [A9,d9] and
A52: S.(0+1) = [Aq9,dq9] by Def20;
    A9 = A & d9 = D by A2,A51,XTUPLE_0:1;
    then consider q being QuadrSeq of D such that
A53: Aq9 = NextSet(D) and
A54: dq9 = NextDelta(q) by A50;
    ConsecutiveSet(A,{}) = A by Th21;
    then reconsider Q = Quadr(q,{}) as Element of [:A,A,the carrier of L,the
    carrier of L:];
A55: (S.1)`2 in the set of all  (S.i)`2 where i is Element of NAT;
    succ {} c= DistEsti(D) by Lm4;
    then {} in DistEsti(D) by ORDINAL1:21;
    then
A56: {} in dom q by Th25;
    then q.{} in rng q by FUNCT_1:def 3;
    then q.{} in {[u,v,a9,b9] where u is Element of A, v is Element of A, a9
    is Element of L, b9 is Element of L: D.(u,v) <= a9"\/"b9} by Def13;
    then consider u,v be Element of A, a,b be Element of L such that
A57: q.{} = [u,v,a,b] and
    D.(u,v) <= a"\/"b;
    consider e being Equivalence_Relation of FS such that
A58: e = f.b and
A59: for x,y being Element of FS holds [x,y] in e iff FD.(x,y) <= b by Def8;
A60: Quadr(q,{}) = [u,v,a,b] by A56,A57,Def14;
    [Aq9,dq9]`2 = NextDelta(q) by A54;
    then
A61: NextDelta(q) c= FD by A55,A52,ZFMISC_1:74;
A62: {{A}} in {{A}, {{A}}, {{{A}}} } by ENUMSET1:def 1;
    then
A63: {{A}} in A \/ {{A}, {{A}}, {{{A}}}} by XBOOLE_0:def 3;
    take e;
    e in rng f by A46,A58,FUNCT_1:def 3;
    hence e in the carrier of Image f by A47,YELLOW_0:def 15;
A64: (S.1)`1 in the set of all  (S.i)`1 where i is Element of NAT;
    [Aq9,dq9]`1 = NextSet(D) by A53;
    then
A65: NextSet(D) c= FS by A64,A52,ZFMISC_1:74;
    new_set A = new_set ConsecutiveSet(A,{}) by Th21
      .= ConsecutiveSet(A,succ {}) by Th22;
    then new_set A c= NextSet(D) by Lm4,Th29;
    then
A66: new_set A c= FS by A65;
A67: {{A}} in new_set A by A62,XBOOLE_0:def 3;
A68: {A} in {{A}, {{A}}, {{{A}}} } by ENUMSET1:def 1;
    then {A} in A \/ {{A}, {{A}}, {{{A}}}} by XBOOLE_0:def 3;
    then reconsider W = {A}, V = {{A}} as Element of FS by A66,A67;
A69: ConsecutiveSet(A,{}) = A & ConsecutiveDelta(q,{}) = D by Th21,Th26;
    ConsecutiveDelta(q,succ {}) = new_bi_fun(BiFun(ConsecutiveDelta(q,{}
    ), ConsecutiveSet(A,{}),L),Quadr(q,{})) by Th27
      .= new_bi_fun(D,Q) by A69,Def15;
    then new_bi_fun(D,Q) c= NextDelta(q) by Lm4,Th32;
    then
A70: new_bi_fun(D,Q) c= FD by A61;
    dom new_bi_fun(D,Q) = [:new_set A,new_set A:] & {A} in new_set A by A68,
FUNCT_2:def 1,XBOOLE_0:def 3;
    then [{A},{{A}}] in dom new_bi_fun(D,Q) by A63,ZFMISC_1:87;
    then FD.(W,V) = new_bi_fun(D,Q).({A},{{A}}) by A70,GRFUNC_1:2
      .= Q`4_4 by Def10
      .= b by A60;
    then [{A},{{A}}] in e by A59;
    hence thesis by A49,RELAT_1:def 10;
  end;
  take FS,f;
  D is onto by Th40;
  then
A71: rng D = A by FUNCT_2:def 3;
  for w being object st w in A
   ex z being object st z in [:FS,FS:] & w = FD.z
  proof
    let w be object;
A72: (S.0)`1 in the set of all  (S.i)`1 where i is Element of NAT;
A73: (S.0)`2 in the set of all  (S.i)`2 where i is Element of NAT;
A74: S.0 = [A,D] by Def20;
A75: D c= FD by A73,A74,ZFMISC_1:74;
    assume w in A;
    then consider z being object such that
A76: z in [:A,A:] and
A77: D.z = w by A71,FUNCT_2:11;
    take z;
    A c= FS by A72,A74,ZFMISC_1:74;
    then [:A,A:] c= [:FS,FS:] by ZFMISC_1:96;
    hence z in [:FS,FS:] by A76;
    z in dom D by A76,FUNCT_2:def 1;
    hence thesis by A77,A75,GRFUNC_1:2;
  end;
  then rng FD = A by FUNCT_2:10;
  then FD is onto by FUNCT_2:def 3;
  hence f is one-to-one by Th15;
  for e1,e2 being Equivalence_Relation of FS,
    x,y being object st e1 in the carrier of
  Image f & e2 in the carrier of Image f & [x,y] in e1 "\/" e2 ex F being non
  empty FinSequence of FS st len F = 3+2 & x,y are_joint_by F,e1,e2 by Th43;
  hence thesis by A48,Th13;
end;
