
theorem
   for R being Ring holds
   R is almost_trivial iff (R is degenerated or R,Z/2 are_isomorphic)
   proof
     let R be Ring;
A1:   Z/2 =
      doubleLoopStr(#Segm(2),addint(2),multint(2),In(1,Segm(2)),In(0,Segm(2))#)
      by INT_3:def 12;
A2:   now assume R is degenerated or R,Z/2 are_isomorphic; then
       per cases;
         suppose R is degenerated;
           hence R is almost_trivial;
         end;
         suppose R,Z/2 are_isomorphic; then
           consider f being Function of R,(Z/2) such that
A4:        f is isomorphism by QUOFIELD:def 23;
           f is monomorphism onto by A4,MOD_4:def 12; then
A5:        f is linear one-to-one by MOD_4:def 8;
           now let a be Element of R;
A6:          dom f = [#]R by FUNCT_2:def 1;
A7:          [#]INT.Ring(2) = 2 by A1,ORDINAL1:def 17;
             per cases by A7,CARD_1:50,TARSKI:def 2;
               suppose f.a = 0; then
                 f.a = 0.(Z/2) by A1 .= f.(0.R) by A5,RING_2:6;
                 hence a = 1.R or a = 0.R by A5,A6;
               end;
               suppose f.a = 1; then
                 f.a = 1_(Z/2) by INT_3:14
                 .= f.(1_R) by A5,GROUP_1:def 13 .= f.(1.R);
                 hence a = 1.R or a = 0.R by A5,A6;
               end;
             end;
             hence R is almost_trivial;
           end;
         end;
      set A = the carrier of R, B = the carrier of (Z/2);
      now assume that
A8:     R is almost_trivial and
A9:     R is non degenerated;
        set f = {[0.R,0.(Z/2)],[1.R,1.(Z/2)]};
        now let o be object;
          assume o in f; then
          per cases by TARSKI:def 2;
            suppose o = [0.R,0.(Z/2)];
              hence o in [:A,B:] by ZFMISC_1:def 2;
            end;
            suppose o = [1.R,1.(Z/2)];
              hence o in [:A,B:] by ZFMISC_1:def 2;
            end;
          end; then
          reconsider f as Subset of [:A,B:] by TARSKI:def 3;
          reconsider f as Relation of A,B;
          now let x,y1,y2 be object;
            assume
A11:        [x,y1] in f & [x,y2] in f; then
            per cases by TARSKI:def 2;
              suppose
A12:            [x,y1] = [0.R,0.(Z/2)];
A13:            y1 = [0.R,0.(Z/2)]`2 by A12.= 0.(Z/2);
A14:            x = [0.R,0.(Z/2)]`1 by A12 .= 0.R;
                per cases by A11,TARSKI:def 2;
                  suppose [x,y2] = [0.R,0.(Z/2)]; then
                    y2 = [0.R,0.(Z/2)]`2 .= 0.(Z/2);
                    hence y1 = y2 by A13;
                  end;
                  suppose [x,y2] = [1.R,1.(Z/2)]; then
                    x = [1.R,1.(Z/2)]`1 .= 1.R;
                    hence y1 = y2 by A14,A9;
                  end;
                end;
                suppose
A15:              [x,y1] = [1.R,1.(Z/2)]; then
A16:              y1 = [1.R,1.(Z/2)]`2 .= 1.(Z/2);
A17:              x = [1.R,1.(Z/2)]`1 by A15 .= 1.R;
                  per cases by A11,TARSKI:def 2;
                    suppose [x,y2] = [0.R,0.(Z/2)]; then
                      x = [0.R,0.(Z/2)]`1 .= 0.R;
                      hence y1 = y2 by A17,A9;
                    end;
                    suppose [x,y2] = [1.R,1.(Z/2)]; then
                      y2 = [1.R,1.(Z/2)]`2 .= 1.(Z/2);
                      hence y1 = y2 by A16;
                    end;
                  end;
                end; then
                reconsider f as PartFunc of A,B by FUNCT_1:def 1;
A18:            dom f c= A;
                now let o be object;
                  assume o in A; then
                  reconsider a = o as Element of R;
                  per cases by A8;
                    suppose a = 0.R; then
                      [a,0.(Z/2)] in f by TARSKI:def 2;
                      hence o in dom f by FUNCT_1:1;
                    end;
                    suppose a = 1.R; then
                      [a,1.(Z/2)] in f by TARSKI:def 2;
                      hence o in dom f by FUNCT_1:1;
                    end;
                  end; then
A19:              dom f = A by A18,TARSKI:2;
                  reconsider f as Function of A,B by A19,FUNCT_2:def 1;
A20:              f.(0.R) = 0.(Z/2) & f.(1.R) = 1.(Z/2)
                  proof
                    [0.R,0.(Z/2)] in f by TARSKI:def 2;
                    hence f.(0.R) = 0.(Z/2) by A19,FUNCT_1:def 2;
                    [1.R,1.(Z/2)] in f by TARSKI:def 2;
                    hence f.(1.R) = 1.(Z/2) by A19,FUNCT_1:def 2;
                  end;
A21:              now let a,b be Element of R;
                    per cases by A8;
                      suppose a = 0.R;
                        hence f.(a+b) = f.a + f.b by A20;
                      end;
                      suppose
A22:                    a = 1.R;
                        per cases by A8;
                          suppose b = 0.R;
                            hence f.(a+b) = f.a + f.b by A20;
                          end;
                          suppose
A23:                        b = 1.R;
                            now assume
A24:                         a + b = 1.R;
                             consider y being Element of R such that
A25:                         a + y = 0.R by ALGSTR_0:def 11;
                             per cases by A8;
                               suppose y = 0.R;
                                 hence contradiction by A20,A22,A25;
                               end;
                               suppose y = 1.R;
                                 hence contradiction by A24,A25,A23,A20;
                               end;
                             end;
                             hence f.(a+b) = f.a + f.b by A8,A20,Th5,A23,A22;
                           end;
                         end;
                       end;
                       now let a,b be Element of R;
                         per cases by A8;
                           suppose a = 0.R;
                             hence f.(a*b) = f.a * f.b by A20;
                           end;
                           suppose a = 1.R;
                             hence f.(a*b) = f.a * f.b by A20;
                           end;
                         end; then
A28:                       f is additive multiplicative unity-preserving
                           by A20,A21,GROUP_6:def 6;
                           now let x,y be object;
                             assume
A29:                         x in A & y in A & f.x = f.y; then
                             reconsider a = x, b = y as Element of R;
                             per cases by A8;
                               suppose a = 0.R;
                                 hence x = y by A8,A20,A29;
                               end;
                               suppose a = 1.R;
                                 hence x = y by A8,A20,A29;
                               end;
                             end; then
                             f is one-to-one by FUNCT_2:19; then
A30:                         f is monomorphism by A28,MOD_4:def 8;
A31:                         now let o be object;
                               assume o in rng f; then
                               consider x being object such that
A32:                           x in dom f & o = f.x by FUNCT_1:def 3;
                               reconsider a = x as Element of R by A32;
                               per cases by A8;
                                 suppose a = 0.R;
                                   hence o in B by A20,A32;
                                 end;
                                 suppose a = 1.R;
                                   hence o in B by A20,A32;
                                 end;
                               end;
                               now let o be object;
                                 assume o in B; then
A33:                             o in 2 by A1,ORDINAL1:def 17;
                                 per cases by A33,CARD_1:50,TARSKI:def 2;
                                   suppose o = 0; then
                                     o=f.(0.R)
                                     by A1,A20,NAT_1:44,SUBSET_1:def 8;
                                     hence o in rng f by A19,FUNCT_1:def 3;
                                   end;
                                   suppose o = 1; then
                                     o=f.(1.R)
                                     by A20,A1,NAT_1:44,SUBSET_1:def 8;
                                     hence o in rng f by A19,FUNCT_1:def 3;
                                   end;
                                 end; then
                                 f is onto by A31,TARSKI:2;
                                 hence R,Z/2 are_isomorphic
                                 by A30,MOD_4:def 12,QUOFIELD:def 23;
                               end;
                               hence thesis by A2;
                             end;
