reserve L,L1,L2 for Lattice,
  F1,F2 for Filter of L,
  p,q,r,s for Element of L,
  p1,q1,r1,s1 for Element of L1,
  p2,q2,r2,s2 for Element of L2,
  X,x,x1,x2,y,y1,y2 for set,
  D,D1,D2 for non empty set,
  R for Relation,
  RD for Equivalence_Relation of D,
  a,b,d for Element of D,
  a1,b1,c1 for Element of D1,
  a2,b2,c2 for Element of D2,
  B for B_Lattice,
  FB for Filter of B,
  I for I_Lattice,
  FI for Filter of I ,
  i,i1,i2,j,j1,j2,k for Element of I,
  f1,g1 for BinOp of D1,
  f2,g2 for BinOp of D2;
reserve F,G for BinOp of D,RD;
reserve B for B_Lattice,
  a,b,c,d for Element of B;

theorem
  B, [:B/\/<.a.),latt <.a.):] are_isomorphic
proof
  set F = <.a.);
  set E = equivalence_wrt F;
  deffunc F(object) = Class(E,$1);
  consider g being Function such that
A1: dom g = the carrier of B &
for x being object st x in the carrier of B holds g.x
  = F(x) from FUNCT_1:sch 3;
A2: (b"\/"(b<=>a)) <=> b = b"\/"a
  proof
A3: (b"\/"(b<=>a))` = b`"/\"(b<=>a)` by LATTICES:24;
A4: b`"/\"((b"/\"a`)"\/"(b`"/\"a)) = (b`"/\"(b"/\"a`))"\/"(b`"/\"(b`"/\" a
    )) by LATTICES:def 11;
A5: b"\/"((b"/\"a)"\/"(b`"/\"a`)) = b"\/"(b "/\"a)"\/"(b`"/\"a`) by
LATTICES:def 5;
A6: b<=>a = (b"/\"a)"\/"(b`"/\"a`) by Th50;
A7: b`"/\"b = Bottom B by LATTICES:20;
A8: b`"/\"(a`"/\" b) = b`"/\"a`"/\"b by LATTICES:def 7;
A9: b`"/\"(b`"/\"a) = b` "/\"b`"/\"a by LATTICES:def 7;
A10: (b<=>a)` = (b"/\"a`)"\/"(b`"/\"a) by Th51;
A11: b`"/\"(b"/\"a`) = b`"/\"b"/\"a` by LATTICES:def 7;
A12: (b"\/"(b`"/\"a`))"/\"b = (b"/\"b)"\/"(b`"/\"a`"/\"b) by LATTICES:def 11;
A13: (b"/\"a)"\/"b = b by LATTICES:def 8;
    (b"\/"(b<=>a)) <=> b = ((b"\/"(b<=>a))"/\"b)"\/"((b"\/"(b<=>a))` "/\"
    b` ) by Th50;
    hence (b"\/"(b<=>a)) <=> b = b"\/"((b"/\"a)"\/"(b`"/\" a)) by A3,A10,A4,A11
,A7,A9,A6,A5,A13,A12,A8,LATTICES:def 5
      .= b"\/"((b"\/"b`)"/\"a) by LATTICES:def 11
      .= b"\/"(Top B"/\"a) by LATTICES:21
      .= b"\/"a;
  end;
  set S = LattRel [:B/\/F,latt F:];
A14: field S = the carrier of [:B/\/F,latt F:] by Th32;
  reconsider o1 = join(B), o2 = meet(B) as BinOp of E by Th13,Th14;
A15: LattStr(#Class E,o1/\/E,o2/\/E#) = B/\/F by Def5;
  set R = LattRel B;
  deffunc F(Element of B) = ($1"\/"($1<=>a)) <=> $1;
  consider h being UnOp of the carrier of B such that
A16: h.b = F(b) from FUNCT_2:sch 4;
  take f = <:g,h:>;
A17: field R = the carrier of B by Th32;
A18: dom h = dom g by A1,FUNCT_2:def 1;
  hence
A19: dom f = field R by A1,A17,FUNCT_3:50;
A20: h.b is Element of latt F
  proof
    b"\/"(b<=>a) in Class(E,b) by Th60;
    then [b"\/"(b<=>a),b] in E by EQREL_1:19;
    then
A21: (b"\/"(b<=>a)) <=> b in F by FILTER_0:def 11;
    h.b = (b"\/"(b<=>a)) <=> b by A16;
    hence thesis by A21,FILTER_0:49;
  end;
  thus rng f c= field S
  proof
    let x be object;
    assume x in rng f;
    then consider y being object such that
A22: y in dom f and
A23: x = f.y by FUNCT_1:def 3;
    reconsider y as Element of B by A1,A18,A22,FUNCT_3:50;
    reconsider z2 = h.y as Element of latt F by A20;
    g.y = EqClass(E,y) by A1;
    then reconsider z1 = g.y as Element of B/\/F by A15;
    x = [z1,z2] by A22,A23,FUNCT_3:def 7;
    hence thesis by A14;
  end;
A24: the carrier of latt F = F by FILTER_0:49;
  thus field S c= rng f
  proof
    let x be object;
    assume x in field S;
    then consider y being Element of Class E, z being Element of F such that
A25: x = [y,z] by A14,A24,A15,DOMAIN_1:1;
    consider b such that
A26: y = Class(E,b) by EQREL_1:36;
    set ty = b"\/"(b<=>a);
    ty <=> (ty <=> z) = z by Th53;
    then (ty <=> z) <=> ty = z;
    then
A27: [ty <=> z,ty] in E by FILTER_0:def 11;
    ty in y by A26,Th60;
    then y = Class(E,ty) by A26,EQREL_1:23;
    then
A28: ty <=> z in y by A27,EQREL_1:19;
    then
A29: y = Class(E,ty<=>z) by A26,EQREL_1:23;
    then
A30: ty [= (ty<=>z)"\/"((ty<=>z)<=>a ) by A26,Th60;
    y = Class(E,ty<=>z) by A26,A28,EQREL_1:23;
    then
A31: g.(ty <=> z) = y by A1;
    (ty<=>z)"\/"((ty<=>z)<=>a) [= ty by A26,A29,Th60;
    then
A32: (ty<=>z)"\/"((ty<=>z)<=>a) = ty by A30,LATTICES:8;
    h.(ty<=>z) = ((ty<=>z)"\/"((ty<=>z)<=>a)) <=> (ty<=>z) by A16;
    then h.(ty <=> z) = z by A32,Th53;
    then x = f.(ty <=> z) by A17,A19,A25,A31,FUNCT_3:def 7;
    hence thesis by A17,A19,FUNCT_1:def 3;
  end;
  thus f is one-to-one
  proof
    let x,y be object;
    assume that
A33: x in dom f and
A34: y in dom f;
    reconsider x9 = x, y9 = y as Element of B by A1,A18,A33,A34,FUNCT_3:50;
    assume
A35: f.x = f.y;
A36: g.y9 = Class(E,y9) by A1;
A37: h.y9 = (y9"\/"(y9<=>a)) <=> y9 by A16;
A38: h.x9 = (x9"\/"(x9<=>a)) <=> x9 by A16;
A39: g.x9 = Class(E,x9) by A1;
A40: f.y = [g.y9,h.y9] by A17,A19,FUNCT_3:def 7;
A41: f.x = [g.x9,h.x9] by A17,A19,FUNCT_3:def 7;
    then
A42: g.x = g.y by A40,A35,XTUPLE_0:1;
    then
A43: y9"\/"(y9<=>a) [= x9"\/"(x9<=>a ) by A39,A36,Th60;
    x9"\/"(x9<=>a) [= y9"\/"(y9<=>a) by A39,A36,A42,Th60;
    then
A44: y9"\/"(y9<=>a) = x9"\/"(x9<=>a) by A43,LATTICES:8;
    h.x = h.y by A41,A40,A35,XTUPLE_0:1;
    hence thesis by A38,A37,A44,Th52;
  end;
  let x,y be object;
A45: the carrier of latt F = F by FILTER_0:49;
  thus [x,y] in R implies x in field R & y in field R & [f.x,f.y] in S
  proof
    assume
A46: [x,y] in R;
    then reconsider x9 = x, y9 = y as Element of B by A17,RELAT_1:15;
A47: x9 [= y9 by A46,Th31;
    thus x in field R & y in field R by A46,RELAT_1:15;
A48: Top B in F by FILTER_0:11;
    x9"/\"Top B = x9;
    then Top B [= x9 => y9 by A47,FILTER_0:def 7;
    then x9 => y9 in F by A48;
    then
A49: x9/\/F [= y9/\/F by Th16;
A50: h.x9 = (x9"\/"(x9<=>a)) <=> x9 by A16;
A51: y9"\/" (y9<=>a) in Class(E,y9) by Th60;
A52: (y9"\/"(y9<=>a)) <=> y9 = y9"\/"a by A2;
A53: (x9"\/"(x9<=>a)) <=> x9 = x9"\/"a by A2;
A54: h.y9 = (y9"\/"(y9<=>a)) <=> y9 by A16;
    x9"\/"(x9<=>a) in Class(E,x9) by Th60;
    then reconsider hx = h.x, hy = h.y as Element of latt F by A45,A50,A54,A51
,Lm4;
A55: Class(E,x9) = g.x9 by A1;
    x9"\/"a [= y9"\/"a by A47,FILTER_0:1;
    then hx [= hy by A50,A54,A53,A52,FILTER_0:51;
    then
A56: [x9/\/F,hx] [= [y9/\/F,hy] by A49,Th36;
A57: y9/\/F = Class(E,y9) by Def6;
A58: Class(E,y9) = g.y9 by A1;
A59: f.y9 = [g.y9,h.y9] by A17,A19,FUNCT_3:def 7;
A60: f.x9 = [g.x9,h.x9] by A17,A19,FUNCT_3:def 7;
    x9/\/F = Class(E,x9) by Def6;
    hence thesis by A55,A57,A58,A60,A59,A56;
  end;
  assume that
A61: x in field R and
A62: y in field R;
  reconsider x9 = x, y9 = y as Element of B by A61,A62,Th32;
A63: h.x9 = (x9"\/"(x9<=>a)) <=> x9 by A16;
A64: f.y9 = [g.y9,h.y9] by A17,A19,FUNCT_3:def 7;
A65: y9/\/F = Class(E,y9) by Def6;
A66: Class(E,x9) = g.x9 by A1;
A67: (y9"\/"(y9<=>a)) <=> y9 = y9"\/"a by A2;
A68: (x9"\/"(x9<=>a)) <=> x9 = x9"\/"a by A2;
A69: y9"/\" x9 [= y9 by LATTICES:6;
A70: y9"\/"(y9<=>a) in Class(E,y9) by Th60;
A71: h.y9 = (y9"\/"(y9<=>a)) <=> y9 by A16;
  x9"\/"(x9<=>a) in Class(E,x9) by Th60;
  then reconsider hx = h.x, hy = h.y as Element of latt F by A45,A63,A71,A70
,Lm4;
  assume
A72: [f.x,f.y] in S;
A73: f.x9 = [g.x9,h.x9] by A17,A19,FUNCT_3:def 7;
A74: Class(E,y9) = g.y9 by A1;
  x9/\/F = Class(E,x9) by Def6;
  then
A75: [x9/\/F,hx] [= [y9/\/F,hy] by A65,A66,A74,A73,A64,A72,Th31;
  then x9/\/F [= y9/\/F by Th36;
  then
A76: x9 => y9 in F by Th16;
  x9 => y9 = x9`"\/"y9 by FILTER_0:42;
  then a [= x9`"\/"y9 by A76,FILTER_0:15;
  then
A77: x9"/\"a [= x9"/\"(x9`"\/"y9) by LATTICES:9;
  hx [= hy by A75,Th36;
  then x9"\/"a [= y9"\/"a by A63,A71,A68,A67,FILTER_0:51;
  then
A78: x9"/\"(x9"\/"a) [= x9"/\"(y9"\/"a) by LATTICES:9;
A79: x9"/\"x9` = Bottom B by LATTICES:20;
  x9"/\"(x9`"\/"y9) = x9"/\"x9`"\/"(x9 "/\" y9) by LATTICES:def 11;
  then x9"/\"a [= y9 by A77,A79,A69,LATTICES:7;
  then
A80: (x9"/\"y9)"\/"(x9"/\"a) [= y9 by A69,FILTER_0:6;
  x9 [= x9 "\/"a by LATTICES:5;
  then x9"/\"(x9"\/"a) = x9 by LATTICES:4;
  then x9 [= (x9"/\"y9)"\/"(x9"/\"a) by A78,LATTICES:def 11;
  then x9 [= y9 by A80,LATTICES:7;
  hence thesis;
end;
