reserve x for set,
  C for Ordinal,
  L0 for Sequence;
reserve O1,O2 for Ordinal;

theorem Th35:
  for L be lower-bounded modular LATTICE holds L
  has_a_representation_of_type<= 2
proof
  let L be lower-bounded modular LATTICE;
  set A = the carrier of L, D = BasicDF(L);
  set S = the ExtensionSeq2 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 Def11;
  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 Th32;
  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 e2 being Equivalence_Relation of FS such that
A4: e2 = f.b and
A5: for x,y being Element of FS holds [x,y] in e2 iff FD.(x,y) <= b
    by LATTICE5:def 8;
    consider e1 being Equivalence_Relation of FS such that
A6: e1 = f.a and
A7: for x,y being Element of FS holds [x,y] in e1 iff FD.(x,y) <= a
    by LATTICE5:def 8;
    consider e3 being Equivalence_Relation of FS such that
A8: e3 = f.(a "\/" b) and
A9: for x,y being Element of FS holds [x,y] in e3 iff FD.(x,y) <= a
    "\/"b by LATTICE5:def 8;
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 A5,A12;
      then FD.(x9,y9) <= b "\/" a by A11,ORDERS_2:3;
      hence [x,y] in e3 by A9;
    end;
    then
A13: e2 c= e3;
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:  Seg 4 = { n where n is Nat: 1 <= n & n <= 4 } by FINSEQ_1:def 1;
      then
A16:  3 in Seg 4;
      assume
A17:  [u,v] in e3;
      then reconsider x = u, y = v as Element of FS by A14,RELAT_1:15;
A18:  FD.(x,y) <= a"\/"b by A9,A17;
      then consider z1,z2 being Element of FS such that
A19:  FD.(x,z1) = a and
A20:  FD.(z1,z2) = (FD.(x,y)"\/"a)"/\"b and
A21:  FD.(z2,y) = a by Th33;
A22:  u in FS by A14,A17,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 = y);
A23:  for m being Nat st m in Seg 4 ex w being object st P[m,w]
      proof
        let m be Nat;
        assume
A24:    m in Seg 4;
        per cases by A24,Lm3;
        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 y;
          thus thesis by A28;
        end;
      end;
      ex p being FinSequence st dom p = Seg 4 & for k being Nat st k in
      Seg 4 holds P[k,p.k] from FINSEQ_1:sch 1(A23);
      then consider h being FinSequence such that
A29:  dom h = Seg 4 and
A30:  for m being Nat st m in Seg 4 holds (m = 1 implies h.m = x) & (
m = 2 implies h.m = z1) & (m = 3 implies h.m = z2) & (m = 4 implies h.m = y);
A31:  len h = 4 by A29,FINSEQ_1:def 3;
A32:  4 in Seg 4 by A15;
A33:  1 in Seg 4 by A15;
      then
A34:  u = h.1 by A30;
A35:  2 in Seg 4 by A15;
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
A37:    1 <= j & j < len h;
        per cases by A31,A37,Lm4;
        suppose
A38:      j = 1;
          [x,z1] in e1 by A7,A19;
          then [h.1,z1] in e1 by A30,A33;
          then [h.1,h.2] in e1 by A30,A35;
          hence thesis by A38,XBOOLE_0:def 3;
        end;
        suppose
A39:      j = 2;
          FD.(x,y)"\/"a <= a"\/"b"\/"a by A18,WAYBEL_1:2;
          then FD.(x,y)"\/"a <= b"\/"(a"\/"a) by LATTICE3:14;
          then FD.(x,y)"\/"a <= b"\/"a by YELLOW_5:1;
          then (FD.(x,y)"\/"a)"/\"b <= b"/\"(b"\/"a) by WAYBEL_1:1;
          then (FD.(x,y)"\/"a)"/\"b <= b by LATTICE3:18;
          then [z1,z2] in e2 by A5,A20;
          then [h.2,z2] in e2 by A30,A35;
          then [h.2,h.3] in e2 by A30,A16;
          hence thesis by A39,XBOOLE_0:def 3;
        end;
        suppose
A40:      j = 3;
          [z2,y] in e1 by A7,A21;
          then [h.3,y] in e1 by A30,A16;
          then [h.3,h.4] in e1 by A30,A32;
          hence thesis by A40,XBOOLE_0:def 3;
        end;
      end;
      v = h.4 by A30,A32
        .= h.(len h) by A29,FINSEQ_1:def 3;
      hence thesis by A22,A31,A34,A36,EQREL_1:28;
    end;
    then
A41: e3 c= e1 "\/" e2;
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 A7,A44;
      then FD.(x9,y9) <= a "\/" b by A43,ORDERS_2:3;
      hence [x,y] in e3 by A9;
    end;
    then e1 c= e3;
    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 A6,A4,LATTICE5:10
      .= f.(a "\/" b) by A8,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 LATTICE5:14
;
A46: dom f = the carrier of L by FUNCT_2:def 1;
A47: ex e being Equivalence_Relation of FS st e in the carrier of Image f &
  e <> id FS
  proof
A48: {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
A49: Aq9, dq9 is_extension2_of A9,d9 and
A50: S.0 = [A9,d9] and
A51: S.(0+1) = [Aq9,dq9] by Def11;
    A9 = A & d9 = D by A2,A50,XTUPLE_0:1;
    then consider q being QuadrSeq of D such that
A52: Aq9 = NextSet2(D) and
A53: dq9 = NextDelta2(q) by A49;
    ConsecutiveSet2(A,{}) = A by Th14;
    then reconsider Q = Quadr2(q,{}) as Element of [:A,A,the carrier of L,the
    carrier of L:];
A54: (S.1)`2 in the set of all  (S.i)`2 where i is Element of NAT;
    succ {} c= DistEsti(D) by Th1;
    then {} in DistEsti(D) by ORDINAL1:21;
    then
A55: {} in dom q by LATTICE5:25;
    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
LATTICE5:def 13;
    then consider u,v be Element of A, a,b be Element of L such that
A56: q.{} = [u,v,a,b] and
    D.(u,v) <= a"\/"b;
    consider e being Equivalence_Relation of FS such that
A57: e = f.b and
A58: for x,y being Element of FS holds [x,y] in e iff FD.(x,y) <= b
    by LATTICE5:def 8;
    Quadr2(q,{}) = [u,v,a,b] by A55,A56,Def6;
    then
A59: b = Q`4_4;
    [Aq9,dq9]`2 = NextDelta2(q) by A53;
    then
A60: NextDelta2(q) c= FD by A54,A51,ZFMISC_1:74;
A61: {{A}} in {{A}, {{A}} } by TARSKI:def 2;
    then
A62: {{A}} in A \/ {{A}, {{A}} } by XBOOLE_0:def 3;
    take e;
    e in rng f by A46,A57,FUNCT_1:def 3;
    hence e in the carrier of Image f by YELLOW_0:def 15;
A63: (S.1)`1 in the set of all  (S.i)`1 where i is Element of NAT;
    [Aq9,dq9]`1 = NextSet2(D) by A52;
    then
A64: NextSet2(D) c= FS by A63,A51,ZFMISC_1:74;
    new_set2 A = new_set2 ConsecutiveSet2(A,{}) by Th14
      .= ConsecutiveSet2(A,succ {}) by Th15;
    then new_set2 A c= NextSet2(D) by Th1,Th21;
    then
A65: new_set2 A c= FS by A64;
A66: {{A}} in new_set2 A by A61,XBOOLE_0:def 3;
A67: {A} in {{A}, {{A}} } by TARSKI:def 2;
    then {A} in A \/ {{A}, {{A}} } by XBOOLE_0:def 3;
    then reconsider W = {A}, V = {{A}} as Element of FS by A65,A66;
A68: ConsecutiveSet2(A,{}) = A & ConsecutiveDelta2(q,{}) = D by Th14,Th18;
    ConsecutiveDelta2(q,succ {}) = new_bi_fun2(BiFun(ConsecutiveDelta2(q
    ,{}), ConsecutiveSet2(A,{}),L),Quadr2(q,{})) by Th19
      .= new_bi_fun2(D,Q) by A68,LATTICE5:def 15;
    then new_bi_fun2(D,Q) c= NextDelta2(q) by Th1,Th24;
    then
A69: new_bi_fun2(D,Q) c= FD by A60;
    dom new_bi_fun2(D,Q) = [:new_set2 A,new_set2 A:] & {A} in new_set2 A
    by A67,FUNCT_2:def 1,XBOOLE_0:def 3;
    then [{A},{{A}}] in dom new_bi_fun2(D,Q) by A62,ZFMISC_1:87;
    then FD.(W,V) = new_bi_fun2(D,Q).({A},{{A}}) by A69,GRFUNC_1:2
      .= (D.(Q`1_4,Q`2_4)"\/"(Q`3_4))"/\"(Q`4_4) by Def4;
    then FD.(W,V) <= b by A59,YELLOW_0:23;
    then [{A},{{A}}] in e by A58;
    hence thesis by A48,RELAT_1:def 10;
  end;
A70: now
    consider e being Equivalence_Relation of FS such that
    e in the carrier of Image f and
A71: e <> id FS by A47;
    assume FS is trivial;
    then consider x being object such that
A72: FS = {x} by ZFMISC_1:131;
A73: [:{x},{x}:] = {[x,x]} & id({x}) = {[x,x]} by SYSREL:13,ZFMISC_1:29;
    field e = {x} by A72,EQREL_1:9;
    then id FS c= e by A72,RELAT_2:1;
    hence contradiction by A72,A71,A73;
  end;
  D is onto by LATTICE5:40;
  then
A74: 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;
A75: (S.0)`1 in the set of all  (S.i)`1 where i is Element of NAT;
A76: (S.0)`2 in the set of all  (S.i)`2 where i is Element of NAT;
A77: S.0 = [A,D] by Def11;
A78: D c= FD by A76,A77,ZFMISC_1:74;
    assume w in A;
    then consider z being object such that
A79: z in [:A,A:] and
A80: D.z = w by A74,FUNCT_2:11;
    take z;
    A c= FS by A75,A77,ZFMISC_1:74;
    then [:A,A:] c= [:FS,FS:] by ZFMISC_1:96;
    hence z in [:FS,FS:] by A79;
    z in dom D by A79,FUNCT_2:def 1;
    hence thesis by A80,A78,GRFUNC_1:2;
  end;
  then rng FD = A by FUNCT_2:10;
  then
A81: FD is onto by FUNCT_2:def 3;
  reconsider FS as non trivial set by A70;
  take FS;
  reconsider f as Homomorphism of L,EqRelLATT FS;
  take f;
  thus f is one-to-one by A81,LATTICE5:15;
  reconsider FD as distance_function of FS,L;
  thus Image f is finitely_typed
  proof
    take FS;
    thus for e being object st e in the carrier of Image f holds e is
    Equivalence_Relation of FS
    proof
      let e be object;
      assume e in the carrier of Image f;
      then e in rng f by YELLOW_0:def 15;
      then consider x being object such that
A82:  x in dom f and
A83:  e = f.x by FUNCT_1:def 3;
      reconsider x as Element of L by A82;
      ex E being Equivalence_Relation of FS st E = f.x & for u,v being
      Element of FS holds [u,v] in E iff FD.(u,v) <= x by LATTICE5:def 8;
      hence thesis by A83;
    end;
    take 2+2;
    thus thesis by Th34;
  end;
  thus ex e being Equivalence_Relation of FS st e in the carrier of Image f &
  e <> id FS
  proof
A84: {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
A85: Aq9, dq9 is_extension2_of A9,d9 and
A86: S.0 = [A9,d9] and
A87: S.(0+1) = [Aq9,dq9] by Def11;
    A9 = A & d9 = D by A2,A86,XTUPLE_0:1;
    then consider q being QuadrSeq of D such that
A88: Aq9 = NextSet2(D) and
A89: dq9 = NextDelta2(q) by A85;
    ConsecutiveSet2(A,{}) = A by Th14;
    then reconsider Q = Quadr2(q,{}) as Element of [:A,A,the carrier of L,the
    carrier of L:];
A90: (S.1)`2 in the set of all  (S.i)`2 where i is Element of NAT;
    succ {} c= DistEsti(D) by Th1;
    then {} in DistEsti(D) by ORDINAL1:21;
    then
A91: {} in dom q by LATTICE5:25;
    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
LATTICE5:def 13;
    then consider u,v be Element of A, a,b be Element of L such that
A92: q.{} = [u,v,a,b] and
    D.(u,v) <= a"\/"b;
    consider e being Equivalence_Relation of FS such that
A93: e = f.b and
A94: for x,y being Element of FS holds [x,y] in e iff FD.(x,y) <= b
    by LATTICE5:def 8;
    Quadr2(q,{}) = [u,v,a,b] by A91,A92,Def6;
    then
A95: b = Q`4_4;
    [Aq9,dq9]`2 = NextDelta2(q) by A89;
    then
A96: NextDelta2(q) c= FD by A90,A87,ZFMISC_1:74;
A97: {{A}} in {{A}, {{A}} } by TARSKI:def 2;
    then
A98: {{A}} in A \/ {{A}, {{A}} } by XBOOLE_0:def 3;
    take e;
    e in rng f by A46,A93,FUNCT_1:def 3;
    hence e in the carrier of Image f by YELLOW_0:def 15;
A99: (S.1)`1 in the set of all  (S.i)`1 where i is Element of NAT;
    [Aq9,dq9]`1 = NextSet2(D) by A88;
    then
A100: NextSet2(D) c= FS by A99,A87,ZFMISC_1:74;
    new_set2 A = new_set2 ConsecutiveSet2(A,{}) by Th14
      .= ConsecutiveSet2(A,succ {}) by Th15;
    then new_set2 A c= NextSet2(D) by Th1,Th21;
    then
A101: new_set2 A c= FS by A100;
A102: {{A}} in new_set2 A by A97,XBOOLE_0:def 3;
A103: {A} in {{A}, {{A}} } by TARSKI:def 2;
    then {A} in A \/ {{A}, {{A}} } by XBOOLE_0:def 3;
    then reconsider W = {A}, V = {{A}} as Element of FS by A101,A102;
A104: ConsecutiveSet2(A,{}) = A & ConsecutiveDelta2(q,{}) = D by Th14,Th18;
    ConsecutiveDelta2(q,succ {}) = new_bi_fun2(BiFun(ConsecutiveDelta2(q
    ,{}), ConsecutiveSet2(A,{}),L),Quadr2(q,{})) by Th19
      .= new_bi_fun2(D,Q) by A104,LATTICE5:def 15;
    then new_bi_fun2(D,Q) c= NextDelta2(q) by Th1,Th24;
    then
A105: new_bi_fun2(D,Q) c= FD by A96;
    dom new_bi_fun2(D,Q) = [:new_set2 A,new_set2 A:] & {A} in new_set2 A
    by A103,FUNCT_2:def 1,XBOOLE_0:def 3;
    then [{A},{{A}}] in dom new_bi_fun2(D,Q) by A98,ZFMISC_1:87;
    then FD.(W,V) = new_bi_fun2(D,Q).({A},{{A}}) by A105,GRFUNC_1:2
      .= (D.(Q`1_4,Q`2_4)"\/"(Q`3_4))"/\"(Q`4_4) by Def4;
    then FD.(W,V) <= b by A95,YELLOW_0:23;
    then [{A},{{A}}] in e by A94;
    hence thesis by A84,RELAT_1:def 10;
  end;
  for e1,e2 being Equivalence_Relation of FS
for 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 = 2+2 & x,y are_joint_by F,e1,e2
  by Th34;
  hence thesis by A47,LATTICE5:13;
end;
