 reserve L for AD_Lattice;
 reserve x,y,z for Element of L;
 reserve L for GAD_Lattice;
 reserve x,y,z for Element of L;
reserve L for with_zero GAD_Lattice,
        x,y for Element of L;

theorem :: Example 3.2
  ex L being non empty LattStr st
  (for x being Element of L holds x = 1 or x = 2 or x = 3) &
  (for x,y being Element of L holds
    (x "/\" y = 1 iff y = 1 or (y = 2 & (x = 1 or x = 3))) &
    (x "/\" y = 2 iff x = 2 & y = 2) &
    (x "/\" y = 3 iff y = 3)) &
  (for x,y being Element of L holds
    (x "\/" y = 1 iff x = 1 & (y = 1 or y = 3)) &
    (x "\/" y = 2 iff x = 2 or (x = 1 & y = 2)) &
    (x "\/" y = 3 iff x = 3)) &
  L is GAD_Lattice & L is not AD_Lattice
  proof
    set L = LattStr(# {1,2,3}, example32\/, example32/\ #);
    take L;
    thus for x being Element of L holds x = 1 or x = 2 or x = 3
    by ENUMSET1:def 1;
    thus
Z7: for x,y being Element of L holds
    (x "/\" y = 1 iff y = 1 or (y = 2 & (x = 1 or x = 3))) &
    (x "/\" y = 2 iff x = 2 & y = 2) &
    (x "/\" y = 3 iff y = 3)
    proof
      let x,y be Element of L;
      reconsider x1=x, y1=y as Element of {1,2,3};
B1:   x "/\" y = x1 example32"/\" y1 by Defx8;
      thus x "/\" y = 1 iff y = 1 or (y = 2 & (x = 1 or x = 3))
      proof
        hereby
          assume
B3:       x "/\" y = 1;
          assume not (y = 1 or (y = 2 & (x = 1 or x = 3)));
          then (x = 2 & y = 2) or y = 3 by ENUMSET1:def 1;
          hence contradiction by B3,B1,Defx5;
        end;
        assume y = 1 or (y = 2 & (x = 1 or x = 3));
        hence x "/\" y = 1 by B1,Defx5;
      end;
      thus x "/\" y = 2 iff x = 2 & y = 2
      proof
        hereby
          assume
B3:       x "/\" y = 2;
          assume not (x = 2 & y = 2);
          then (y = 1 or (y = 2 & (x = 1 or x = 3))) or y = 3
          by ENUMSET1:def 1;
          hence contradiction by B3,B1,Defx5;
        end;
        assume x = 2 & y = 2;
        hence x "/\" y = 2 by B1,Defx5;
      end;
      thus x "/\" y = 3 iff y = 3
      proof
        hereby
          assume
B3:       x "/\" y = 3;
          assume not y = 3;
          then (y = 1 or (y = 2 & (x = 1 or x = 3))) or (x = 2 & y = 2)
          by ENUMSET1:def 1;
          hence contradiction by B3,B1,Defx5;
        end;
        assume y = 3;
        hence x "/\" y = 3 by B1,Defx5;
      end;
    end;
    thus
Z8: for x,y being Element of L holds
    (x "\/" y = 1 iff x = 1 & (y = 1 or y = 3)) &
    (x "\/" y = 2 iff x = 2 or (x = 1 & y = 2)) &
    (x "\/" y = 3 iff x = 3)
    proof
      let x,y be Element of L;
      reconsider x1=x, y1=y as Element of {1,2,3};
B1:   x "\/" y = x1 example32"\/" y1 by Defx7;
      thus x "\/" y = 1 iff x = 1 & (y = 1 or y = 3)
      proof
        hereby
          assume
B3:       x "\/" y = 1;
          assume not (x = 1 & (y = 1 or y = 3));
          then (x = 2 or (x = 1 & y = 2)) or x = 3 by ENUMSET1:def 1;
          hence contradiction by B3,B1,Defx6;
        end;
        assume x = 1 & (y = 1 or y = 3);
        hence x "\/" y = 1 by B1,Defx6;
      end;
      thus x "\/" y = 2 iff x = 2 or (x = 1 & y = 2)
      proof
        hereby
          assume
B3:       x "\/" y = 2;
          assume not (x = 2 or (x = 1 & y = 2));
          then (x = 1 & (y = 1 or y = 3)) or x = 3 by ENUMSET1:def 1;
          hence contradiction by B3,B1,Defx6;
        end;
        assume x = 2 or (x = 1 & y = 2);
        hence x "\/" y = 2 by B1,Defx6;
      end;
      thus x "\/" y = 3 iff x = 3
      proof
        hereby
          assume
B3:       x "\/" y = 3;
          assume not (x = 3);
          then (x = 1 & (y = 1 or y = 3)) or (x = 2 or (x = 1 & y = 2))
          by ENUMSET1:def 1;
          hence contradiction by B3,B1,Defx6;
        end;
        assume x = 3;
        hence x "\/" y = 3 by B1,Defx6;
      end;
    end;
    for x,y,z being Element of L
    holds x "/\" (y "/\" z) = (x "/\" y) "/\" z
    proof
      let x,y,z be Element of L;
      per cases by ENUMSET1:def 1;
      suppose
B1:     x "/\" (y "/\" z) = 1;
        then y "/\" z = 1 or (y "/\" z = 2 & (x = 1 or x = 3)) by Z7;
        then (z = 1 or (z = 2 & (y = 1 or y = 3))) or
             ((y = 2 & z = 2) & (x = 1 or x = 3)) by Z7;
        then z = 1 or (z = 2 & (x "/\" y = 1 or x "/\" y = 3)) by Z7;
        hence thesis by B1,Z7;
      end;
      suppose
B1:     x "/\" (y "/\" z) = 2;
        then x = 2 & y "/\" z = 2 by Z7;
        then x = 2 & y = 2 & z = 2 by Z7;
        then (x "/\" y) = 2 & z = 2 by Z7;
        hence thesis by B1,Z7;
      end;
      suppose
B1:     x "/\" (y "/\" z) = 3;
        then y "/\" z = 3 by Z7;
        then z = 3 by Z7;
        hence thesis by B1,Z7;
      end;
    end;
    then
C1: L is meet-associative;
    for x,y,z being Element of L
    holds x "/\" (y "\/" z) = (x "/\" y) "\/" (x "/\" z)
    proof
      let x,y,z be Element of L;
      per cases by ENUMSET1:def 1;
      suppose
B1:     x "/\" (y "\/" z) = 1;
        y "\/" z = 1 or (y "\/" z  = 2 & (x = 1 or x = 3)) by B1,Z7;
        then (y = 1 or (y = 2 & (x = 1 or x = 3))) &
        ((z = 1 or (z = 2 & (x = 1 or x = 3))) or z = 3) by Z8,ENUMSET1:def 1;
        then x "/\" y = 1 & (x "/\" z = 1 or z = 3) by Z7;
        hence thesis by B1,Z7,Z8;
      end;
      suppose
B1:     x "/\" (y "\/" z) = 2;
        then x = 2 & y "\/" z = 2 by Z7;
        then x = 2 & (y = 2 or (y = 1 & z = 2)) by Z8;
        then x "/\" y = 2 or (x "/\" y = 1 & x "/\" z = 2) by Z7;
        hence thesis by B1,Z8;
      end;
      suppose
B1:     x "/\" (y "\/" z) = 3;
        then (y "\/" z) = 3 by Z7;
        then x "/\" y = 3 by Z7,Z8;
        hence thesis by B1,Z8;
      end;
    end;
    then
C2: L is distributive;
    for x,y,z being Element of L
    holds x "\/" (y "/\" z) = (x "\/" y) "/\" (x "\/" z)
    proof
      let x,y,z be Element of L;
      per cases by ENUMSET1:def 1;
      suppose
B1:     x "\/" (y "/\" z) = 1;
        then x = 1 & (y "/\" z = 1 or y "/\" z = 3) by Z8;
        then x = 1 & ((z = 1 or (z = 2 & (y = 1 or y = 3))) or z = 3) by Z7;
        then x "\/" z = 1 or (x "\/" z = 2 & (x "\/" y = 1 or x "\/" y = 3))
        by Z8;
        hence thesis by B1,Z7;
      end;
      suppose
B1:     x "\/" (y "/\" z) = 2;
        then x = 2 or (x = 1 & y "/\" z = 2) by Z8;
        then x = 2 or (x = 1 & y = 2 & z = 2) by Z7;
        then x "\/" y = 2 & x "\/" z = 2 by Z8;
        hence thesis by B1,Z7;
      end;
      suppose
B1:     x "\/" (y "/\" z) = 3;
        then x = 3 by Z8;
        then x "\/" z = 3 by Z8;
        hence thesis by B1,Z7;
      end;
    end;
    then
C3: L is left-Distributive;
    for x,y being Element of L holds x "/\" (x "\/" y) = x
    proof
      let x,y  be Element of L;
      per cases by ENUMSET1:def 1;
      suppose
B1:     x "/\" (x "\/" y) = 1;
        then x "\/" y = 1 or (x "\/" y = 2 & (x = 1 or x = 3)) by Z7;
        hence thesis by B1,Z8;
      end;
      suppose x "/\" (x "\/" y) = 2; hence thesis by Z7; end;
      suppose
B1:     x "/\" (x "\/" y) = 3;
        then x "\/" y = 3 by Z7;
        hence thesis by B1,Z8;
      end;
    end;
    then
C4: L is join-absorbing;
    for x, y being Element of L holds (x "\/" y) "/\" x = x
    proof
      let x,y  be Element of L;
      per cases by ENUMSET1:def 1;
      suppose
B1:     (x "\/" y) "/\" x = 1;
        then x = 1 or (x = 2 & (x "\/" y = 1 or x "\/" y = 3)) by Z7;
        hence thesis by B1,Z8;
      end;
      suppose (x "\/" y) "/\" x = 2; hence thesis by Z7; end;
      suppose (x "\/" y) "/\" x = 3; hence thesis by Z7; end;
    end;
    then
C5: L is Meet-Absorbing;
    for x,y being Element of L holds (x "/\" y) "\/" y = y
    proof
      let x,y  be Element of L;
      per cases by ENUMSET1:def 1;
      suppose
B1:     (x "/\" y) "\/" y = 1;
        then x "/\" y = 1 & (y = 1 or y = 3) by Z8;
        hence thesis by B1,Z7;
      end;
      suppose
B1:     (x "/\" y) "\/" y = 2;
        then x "/\" y = 2 or (x "/\" y = 1 & y = 2) by Z8;
        hence thesis by Z7,B1;
      end;
      suppose
B1:     (x "/\" y) "\/" y = 3;
        then x "/\" y = 3 by Z8;
        hence thesis by B1,Z7;
      end;
    end;
    then
C6: L is meet-absorbing;
    L is not Meet-absorbing
    proof
      assume
B1:   L is Meet-absorbing;
      set x=3,y=2;
      reconsider x=3,y=2 as Element of L by ENUMSET1:def 1;
      (x "\/" y) "/\" y = 1 by Z7,Z8;
      hence contradiction by B1;
    end;
    hence thesis by C1,C2,C3,C4,C5,C6;
  end;
