
theorem Th15: :: Theorem 15, p. 64, Gratzer
  for L being distributive Lattice,
      I being Ideal of L,
      F being Filter of L st
    I misses F holds
  ex P being Ideal of L st P is prime & I c= P & P misses F
  proof
    let L be distributive Lattice,
        I be Ideal of L,
        F be Filter of L;
    assume
A1: I misses F;
    set X = { i where i is Ideal of L : I c= i & i misses F };
z1: I in X by A1;
    for Z being set st Z <> {} & Z c= X & Z is c=-linear holds union Z in X
    proof
      let Z be set;
      assume
s1:   Z <> {} & Z c= X & Z is c=-linear;
BB:   for x being object st x in Z holds x is Ideal of L
      proof
        let x be object;
        assume x in Z; then
        x in X by s1; then
        consider i being Ideal of L such that
SO:     i = x & I c= i & i misses F;
        thus thesis by SO;
      end;
      set M = union Z;
      consider f being object such that
K1:   f in Z by s1,XBOOLE_0:def 1;
      reconsider f as set by TARSKI:1;
UU:   M c= the carrier of L
      proof
        let x be object;
        assume x in M; then
        consider g being set such that
U1:     x in g & g in Z by TARSKI:def 4;
        g is Ideal of L by U1, BB;
        hence thesis by U1;
      end;
      f in X by K1,s1; then
      consider j being Ideal of L such that
SF:   f = j & I c= j & j misses F;
      f c= M by K1,ZFMISC_1:74; then
      reconsider M as non empty Subset of L by SF,UU;
H0:   now let a, b be Element of L;
        assume
S1:     a in M & b in M; then
        consider W being set such that
S2:     a in W & W in Z by TARSKI:def 4;
        consider V being set such that
S3:     b in V & V in Z by S1,TARSKI:def 4;
H1:     V is Ideal of L by S3,BB;
h1:     W is Ideal of L by S2,BB;
        W, V are_c=-comparable by s1,S2,S3,ORDINAL1:def 8; then
        per cases;
        suppose W c= V; then
H2:       a "\/" b in V by FILTER_2:21,H1,S2,S3;
          V c= M by ZFMISC_1:74,S3;
          thus then a "\/" b in M by H2;
        end;
        suppose V c= W; then
H2:       a "\/" b in W by FILTER_2:21,h1,S2,S3;
          W c= M by ZFMISC_1:74,S2;
          thus then a "\/" b in M by H2;
        end;
      end;
      for p,q being Element of L st p in M & q [= p holds q in M
      proof
        let p, q be Element of L;
        assume
J0:     p in M & q [= p; then
        consider W being set such that
J1:     p in W & W in Z by TARSKI:def 4;
        W is Ideal of L by J1,BB; then
        q in W by FILTER_2:21,J0,J1;
        hence q in M by TARSKI:def 4,J1;
      end; then
F2:   M is Ideal of L by H0,FILTER_2:21;
F1:   I c= M
      proof
        let t be object;
        assume
J1:     t in I;
        consider J being object such that
SS:     J in Z by s1,XBOOLE_0:def 1;
        J in X by SS,s1; then
        consider j being Ideal of L such that
SF:     j = J & I c= j & j misses F;
        thus thesis by SS,TARSKI:def 4,J1,SF;
      end;
      M misses F
      proof
        assume M meets F; then
        consider x being object such that
F4:     x in M & x in F by XBOOLE_0:3;
        reconsider x as set by TARSKI:1;
        consider y being set such that
F5:     x in y & y in Z by TARSKI:def 4,F4;
        y in X by F5,s1; then
        consider i being Ideal of L such that
F6:     i = y & I c= i & i misses F;
        thus thesis by F6,XBOOLE_0:3,F4,F5;
      end;
      hence thesis by F1,F2;
    end;
    then consider Y being set such that
J0: Y in X & for Z being set st Z in X & Z <> Y holds
    not Y c= Z by ORDERS_1:67,z1;
    consider i being Ideal of L such that
KK: Y = i & I c= i & i misses F by J0;
    take i;
    i is prime
    proof
      assume i is not prime; then
      consider a, b being Element of L such that
G3:   a "/\" b in i & not a in i & not b in i by Lem2;
      set Ia = i "\/" (.a.>;
      i c= Ia by FILTER_2:50; then
J1:   I c= Ia by KK;
      Ia meets F
      proof
        assume Ia misses F; then
        Ia in X by J1; then
UI:     Ia = i by FILTER_2:50,J0,KK;
        (.a.> c= Ia by FILTER_2:50;
        hence thesis by G3,UI,FILTER_2:28;
      end; then
      consider p1 being object such that
HH:   p1 in Ia & p1 in F by XBOOLE_0:3;
      reconsider p1 as Element of L by HH;
      consider p,q being Element of L such that
h1:   p1 = p "\/" q & p in i & q in (.a.> by HH;
      p "\/" q [= p "\/" a by FILTER_0:1,FILTER_2:28,h1; then
      p "\/" a in F by FILTER_0:9,HH,h1; then
      consider p being Element of L such that
G1:   p in i & p "\/" a in F by h1;
      set Ib = i "\/" (.b.>;
      i c= Ib by FILTER_2:50; then
J1:   I c= Ib by KK;
      Ib meets F
      proof
        assume Ib misses F; then
        Ib in X by J1; then
UI:     Ib = i by FILTER_2:50,J0,KK;
        (.b.> c= Ib by FILTER_2:50;
        hence thesis by G3,UI,FILTER_2:28;
      end; then
      consider p1 being object such that
HH:   p1 in Ib & p1 in F by XBOOLE_0:3;
      reconsider p1 as Element of L by HH;
      consider P,Q being Element of L such that
h1:   p1 = P "\/" Q & P in i & Q in (.b.> by HH;
      P "\/" Q [= P "\/" b by FILTER_0:1,FILTER_2:28,h1; then
      P "\/" b in F by FILTER_0:9,HH,h1; then
      consider q being Element of L such that
G2:   q in i & q "\/" b in F by h1;
      set y = (p "\/" a) "/\" (q "\/" b);
Z1:   y in F by G1,G2,FILTER_0:8;
ZZ:   y = ((p "\/" a) "/\" q) "\/" ((p "\/" a) "/\" b) by LATTICES:def 11
       .= ((p "/\" q) "\/" (a "/\" q)) "\/" ((p "\/" a) "/\" b)
          by LATTICES:def 11
       .= ((p "/\" q) "\/" (a "/\" q)) "\/" ((p "/\" b) "\/" (a "/\" b))
          by LATTICES:def 11
       .= ((p "/\" q) "\/" (a "/\" q)) "\/" (p "/\" b) "\/" (a "/\" b)
          by LATTICES:def 5
       .= (p "/\" q) "\/" (p "/\" b) "\/" (a "/\" q) "\/" (a "/\" b)
          by LATTICES:def 5;
      set x = (p "/\" q) "\/" (p "/\" b) "\/" (a "/\" q) "\/" (a "/\" b);
G4:   p "/\" q in i by G2,FILTER_2:22;
G5:   p "/\" b in i by G1,FILTER_2:22;
G6:   a "/\" q in i by G2,FILTER_2:22;
      (p "/\" q) "\/" (p "/\" b) in i by G4,G5,FILTER_2:21; then
      (p "/\" q) "\/" (p "/\" b) "\/" (a "/\" q) in i by G6,FILTER_2:21;
      then x in i by FILTER_2:21,G3;
      hence thesis by KK,XBOOLE_0:3,Z1,ZZ;
    end;
    hence thesis by KK;
  end;
