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 Th43:
  for S being ExtensionSeq of the carrier of L, BasicDF(L) for FS
  being non empty set for FD being distance_function of FS,L for f being
  Homomorphism of L,EqRelLATT FS for x, y being Element of FS for e1,e2 being
  Equivalence_Relation of FS,x,y being object st f = alpha FD &
   FS = union the set of all  (S.i)`1 where i
is Element of NAT &
   FD = union the set of all  (S.i)`2 where i is Element
  of NAT & 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
proof
  let S be ExtensionSeq of the carrier of L, BasicDF(L);
  let FS be non empty set;
  let FD be distance_function of FS,L;
  let f be Homomorphism of L,EqRelLATT FS;
  let x, y be Element of FS;
  let e1,e2 be Equivalence_Relation of FS,x,y be object;
  assume that
A1: f = alpha FD and
A2: FS = union the set of all  (S.i)`1 where i is Element of NAT &
  FD = union the set of all  (S.i)`2 where i is Element of NAT and
A3: e1 in the carrier of Image f and
A4: e2 in the carrier of Image f and
A5: [x,y] in e1 "\/" e2;
A6: 4 in Seg 5;
  field (e1 "\/" e2) = FS by ORDERS_1:12;
  then reconsider u = x, v = y as Element of FS by A5,RELAT_1:15;
A7: 1 in Seg 5;
  Image f = subrelstr rng f by YELLOW_2:def 2;
  then
A8: the carrier of Image f = rng f by YELLOW_0:def 15;
  then consider a being object such that
A9: a in dom f and
A10: e1 = f.a by A3,FUNCT_1:def 3;
  consider b being object such that
A11: b in dom f and
A12: e2 = f.b by A4,A8,FUNCT_1:def 3;
  reconsider a,b as Element of L by A9,A11;
  reconsider a,b as Element of L;
  consider e being Equivalence_Relation of FS such that
A13: e = f.(a"\/"b) and
A14: for u,v being Element of FS holds [u,v] in e iff FD.(u,v) <= a"\/"b
  by A1,Def8;
  consider e19 being Equivalence_Relation of FS such that
A15: e19 = f.a and
A16: for u,v being Element of FS holds [u,v] in e19 iff FD.(u,v) <= a by A1
,Def8;
  consider e29 being Equivalence_Relation of FS such that
A17: e29 = f.b and
A18: for u,v being Element of FS holds [u,v] in e29 iff FD.(u,v) <= b by A1
,Def8;
A19: 3 in Seg 5;
  e = f.a"\/"f.b by A13,WAYBEL_6:2
    .= e1 "\/" e2 by A10,A12,Th10;
  then FD.(u,v) <= a"\/"b by A5,A14;
  then consider z1,z2,z3 being Element of FS such that
A20: FD.(u,z1) = a and
A21: FD.(z2,z3) = a and
A22: FD.(z1,z2) = b and
A23: FD.(z3,v) = b by A2,Th42;
  defpred P[set,object] means
($1 = 1 implies $2 = u) & ($1 = 2 implies $2 = z1)
& ($1 = 3 implies $2 = z2) & ($1 = 4 implies $2 = z3) & ($1 = 5 implies $2 = v)
  ;
A24: 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
A25:  m = 1;
      take x;
      thus thesis by A25;
    end;
    suppose
A26:  m = 2;
      take z1;
      thus thesis by A26;
    end;
    suppose
A27:  m = 3;
      take z2;
      thus thesis by A27;
    end;
    suppose
A28:  m = 4;
      take z3;
      thus thesis by A28;
    end;
    suppose
A29:  m = 5;
      take y;
      thus thesis by A29;
    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(A24);
  then consider h being FinSequence such that
A30: dom h = Seg 5 and
A31: for m being Nat st m in Seg 5 holds (m = 1 implies h.m = u) & (m =
2 implies h.m = z1) & (m = 3 implies h.m = z2) & (m = 4 implies h.m = z3) & (m
  = 5 implies h.m = v);
A32: len h = 5 by A30,FINSEQ_1:def 3;
A33: 5 in Seg 5;
A34: 2 in Seg 5;
  rng h c= FS
  proof
    let w be object;
    assume w in rng h;
    then consider j be object such that
A35: j in dom h and
A36: w = h.j by FUNCT_1:def 3;
    j = 1 or ... or j = 5 by A30,A35,Lm3;
    then per cases;
    suppose
      j = 1;
      then h.j = u by A31,A7;
      hence thesis by A36;
    end;
    suppose
      j = 2;
      then h.j = z1 by A31,A34;
      hence thesis by A36;
    end;
    suppose
      j = 3;
      then h.j = z2 by A31,A19;
      hence thesis by A36;
    end;
    suppose
      j = 4;
      then h.j = z3 by A31,A6;
      hence thesis by A36;
    end;
    suppose
      j = 5;
      then h.j = v by A31,A33;
      hence thesis by A36;
    end;
  end;
  then reconsider h as FinSequence of FS by FINSEQ_1:def 4;
  reconsider h as non empty FinSequence of FS by A30;
A37: h.1 = x by A31,A7;
A38: for j being Element of NAT st 1 <= j & j < len h holds (j is odd
  implies [h.j,h.(j+1)] in e1) & (j is even implies [h.j,h.(j+1)] in e2)
  proof
    let j be Element of NAT;
    assume 1 <= j & j < len h;
    then j = 1 or ... or j = 4 by A32,Lm2;
    then per cases;
    suppose
A39:  j = 1;
      [u,z1] in e19 by A16,A20;
      then [h.1,z1] in e19 by A31,A7;
      hence thesis by A10,A15,A31,A34,A39;
    end;
    suppose
A40:  j = 3;
      [z2,z3] in e19 by A16,A21;
      then
A41:  [h.3,z3] in e19 by A31,A19;
      2*1+1 = j by A40;
      hence thesis by A10,A15,A31,A6,A41;
    end;
    suppose
A42:  j = 2;
      [z1,z2] in e29 by A18,A22;
      then
A43:  [h.2,z2] in e29 by A31,A34;
      2*1 = j by A42;
      hence thesis by A12,A17,A31,A19,A43;
    end;
    suppose
A44:  j = 4;
      [z3,v] in e29 by A18,A23;
      then
A45:  [h.4,v] in e29 by A31,A6;
      2*2 = j by A44;
      hence thesis by A12,A17,A31,A33,A45;
    end;
  end;
  take h;
  thus len h = 3+2 by A30,FINSEQ_1:def 3;
  h.(len h) = h.5 by A30,FINSEQ_1:def 3
    .= y by A31,A33;
  hence thesis by A37,A38;
end;
