reserve D,D9 for non empty set;
reserve R for Ring;
reserve G,H,S for non empty ModuleStr over R;
reserve UN for Universe;
reserve R for Ring;
reserve G, H for LeftMod of R;
reserve G1, G2, G3 for LeftMod of R;
reserve f for LModMorphismStr over R;
reserve a,b,c for Element of {0,1,2};

theorem Th25:
  for x,y,z,a,b being Element of {0,1,2} st a = 0 & b = 1 holds x+
y = y+x & (x+y)+z = x+(y+z) & x+a = x & x+(-x) = a & x*y = y*x & (x*y)*z = x*(y
*z) & b*x = x & (x<>a implies ex y be Element of {0,1,2} st x*y = b) & a <> b &
  x*(y+z) = x*y+x*z
proof
  let x,y,z,a,b be Element of {0,1,2} such that
A1: a = 0 and
A2: b = 1;
  thus x+y = y+x
  proof
    now
      per cases by ENUMSET1:def 1;
      suppose
A3:     x = 0;
        hence x+y = y by Def13
          .= y+x by A3,Def13;
      end;
      suppose
A4:     y = 0;
        hence x+y = x by Def13
          .= y+x by A4,Def13;
      end;
      suppose
        x = 1 & y = 1;
        hence thesis;
      end;
      suppose
A5:     x = 1 & y = 2;
        hence x+y = 0 by Def13
          .= y+x by A5,Def13;
      end;
      suppose
A6:     x = 2 & y = 1;
        hence x+y = 0 by Def13
          .= y+x by A6,Def13;
      end;
      suppose
        x = 2 & y = 2;
        hence thesis;
      end;
    end;
    hence thesis;
  end;
  thus (x+y)+z = x+(y+z) by A1,Lm7;
  thus x+a = x by A1,Def13;
  thus x+(-x) = a by A1,Lm7;
  thus x*y = y*x
  proof
    now
      per cases by ENUMSET1:def 1;
      suppose
A7:     y = 0;
        hence x*y = 0 by Def14
          .= y*x by A7,Def14;
      end;
      suppose
A8:     x = 0;
        hence x*y = 0 by Def14
          .= y*x by A8,Def14;
      end;
      suppose
A9:     y = 1;
        hence x*y = x by Def14
          .= y*x by A9,Def14;
      end;
      suppose
A10:    x = 1;
        hence x*y = y by Def14
          .= y*x by A10,Def14;
      end;
      suppose
        x = 2 & y = 2;
        hence thesis;
      end;
    end;
    hence thesis;
  end;
  thus (x*y)*z = x*(y*z)
  proof
    now
      per cases by ENUMSET1:def 1;
      suppose
A11:    z = 0;
        then
A12:    y*z = 0 by Def14;
        thus (x*y)*z = 0 by A11,Def14
          .= x*(y*z) by A12,Def14;
      end;
      suppose
A13:    y = 0;
        then
A14:    y*z = 0 by Def14;
        x*y = 0 by A13,Def14;
        hence (x*y)*z = 0 by Def14
          .= x*(y*z) by A14,Def14;
      end;
      suppose
A15:    x = 0;
        then x*y = 0 by Def14;
        hence (x*y)*z = 0 by Def14
          .= x*(y*z) by A15,Def14;
      end;
      suppose
A16:    z = 1;
        then y*z = y by Def14;
        hence thesis by A16,Def14;
      end;
      suppose
A17:    y = 1;
        then x*y = x by Def14;
        hence thesis by A17,Def14;
      end;
      suppose
A18:    x = 1;
        hence (x*y)*z = y*z by Def14
          .= x*(y*z) by A18,Def14;
      end;
      suppose
A19:    x = 2 & y = 2 & z = 2;
        then
A20:    y*z = 1 by Def14;
        x*y = 1 by A19,Def14;
        hence (x*y)*z = x by A19,Def14
          .= x*(y*z) by A20,Def14;
      end;
    end;
    hence thesis;
  end;
  thus b*x = x by A2,Def14;
  thus x<>a implies ex y be Element of {0,1,2} st x*y = b
  proof
    now
      per cases by ENUMSET1:def 1;
      case
        x = 0;
        hence thesis by A1;
      end;
      case
A21:    x = 1;
        reconsider y = 1 as Element of {0,1,2} by ENUMSET1:def 1;
        take y;
        x*y = 1 by A21,Def14;
        hence thesis by A2;
      end;
      case
A22:    x = 2;
        reconsider y = 2 as Element of {0,1,2} by ENUMSET1:def 1;
        take y;
        x*y = 1 by A22,Def14;
        hence thesis by A2;
      end;
    end;
    hence thesis;
  end;
  thus a <> b by A1,A2;
  thus x*(y+z) = x*y+x*z
  proof
    now
      per cases by ENUMSET1:def 1;
      suppose
A23:    x = 0;
        then
A24:    x*y = 0 & x*z = 0 by Def14;
        thus x*(y+z) = 0 by A23,Def14
          .= x*y+x*z by A24,Def13;
      end;
      suppose
        y = 0;
        then y+z = z & x*y = 0 by Def13,Def14;
        hence thesis by Def13;
      end;
      suppose
        z = 0;
        then y+z = y & x*z = 0 by Def13,Def14;
        hence thesis by Def13;
      end;
      suppose
A25:    x = 1 & y = 1 & z = 1;
        then x*y = 1 by Def14;
        hence thesis by A25,Def14;
      end;
      suppose
A26:    x = 1 & y = 1 & z = 2;
        then
A27:    x*y = 1 & x*z = 2 by Def14;
        y+z = 0 by A26,Def13;
        hence x*(y+z) = 0 by Def14
          .= x*y+x*z by A27,Def13;
      end;
      suppose
A28:    x = 1 & y = 2 & z = 1;
        then
A29:    x*y = 2 & x*z = 1 by Def14;
        y+z = 0 by A28,Def13;
        hence x*(y+z) = 0 by Def14
          .= x*y+x*z by A29,Def13;
      end;
      suppose
A30:    x = 1 & y = 2 & z = 2;
        then x*y = 2 by Def14;
        hence thesis by A30,Def14;
      end;
      suppose
A31:    x = 2 & y = 1 & z = 1;
        then
A32:    x*y = 2 by Def14;
        y+z = 2 by A31,Def13;
        hence x*(y+z) = 1 by A31,Def14
          .= x*y+x*z by A31,A32,Def13;
      end;
      suppose
A33:    x = 2 & y = 1 & z = 2;
        then
A34:    x*y = 2 & x*z = 1 by Def14;
        y+z = 0 by A33,Def13;
        hence x*(y+z) = 0 by Def14
          .= x*y+x*z by A34,Def13;
      end;
      suppose
A35:    x = 2 & y = 2 & z = 1;
        then
A36:    x*y = 1 & x*z = 2 by Def14;
        y+z = 0 by A35,Def13;
        hence x*(y+z) = 0 by Def14
          .= x*y+x*z by A36,Def13;
      end;
      suppose
A37:    x = 2 & y = 2 & z = 2;
        then
A38:    x*y = 1 by Def14;
        y+z = 1 by A37,Def13;
        hence x*(y+z) = 2 by A37,Def14
          .= x*y+x*z by A37,A38,Def13;
      end;
    end;
    hence thesis;
  end;
end;
