
theorem Th94:
  for R being add-associative left_zeroed right_zeroed
  right_complementable distributive well-unital Euclidian non empty
  doubleLoopStr holds R is PID
proof
  let R be add-associative left_zeroed right_zeroed right_complementable
  distributive well-unital Euclidian non empty doubleLoopStr;
  let I be Ideal of R;
  per cases;
  suppose
A1: I = {0.R};
    set e = 0.R;
    take e;
    thus thesis by A1,Th44;
  end;
  suppose
    I <> {0.R};
    then consider x being Element of R such that
A2: x <> 0.R & x in I by Th93;
    set I9 = { y where y is Element of I : y <> 0.R };
A3: I9 c= the carrier of R
    proof
      let x be object;
      assume x in I9;
      then ex y being Element of I st x=y & y <> 0.R;
      hence thesis;
    end;
    x in I9 by A2;
    then reconsider I9 as non empty Subset of R by A3;
    consider f being Function of the carrier of R, NAT such that
A4: for a,b being Element of R st b <> 0.R holds ex q,r being Element
of R st a = q*b + r & (r = 0.R or (f.r qua Element of NAT) < (f.b qua Element
    of NAT)) by INT_3:def 8;
    set K = the set of all  f.i where i is Element of I9 ;
    set i = the Element of I9;
A5: f.i in K;
    K c= NAT
    proof
      let x be object;
      assume x in K;
      then ex e being Element of I9 st f.e = x;
      hence thesis;
    end;
    then reconsider K as non empty Subset of NAT by A5;
    set k=min K;
    k in K by XXREAL_2:def 7;
    then consider e being Element of I9 such that
A6: f.e = k;
    e in I9;
    then
A7: ex e9 being Element of I st e9=e & e9 <> 0.R;
    reconsider e as Element of R;
    take e;
    now
      let x be object;
      {e} c= I by A7,ZFMISC_1:31;
      then
A8:   {e}-Ideal c= I by Def14;
      hereby
        assume
A9:     x in I;
        then reconsider x9=x as Element of R;
        consider q,r being Element of R such that
A10:    x9 = q*e + r and
A11:    r = 0.R or (f.r qua Element of NAT) < k by A4,A6,A7;
        now
          q*e in I by A7,Def2;
          then
A12:      -(q*e) in I by Th13;
          assume
A13:      r <> 0.R;
          -(q*e) + x9 = -(q*e) + q*e + r by A10,RLVECT_1:def 3
            .= 0.R + r by RLVECT_1:5
            .= r by ALGSTR_1:def 2;
          then r in I by A9,A12,Def1;
          then r in I9 by A13;
          then f.r in K;
          hence contradiction by A11,A13,XXREAL_2:def 7;
        end;
        then
A14:    x9 = q*e by A10,RLVECT_1:def 4;
        e in {e} & {e} c= {e}-Ideal by Def14,TARSKI:def 1;
        hence x in {e}-Ideal by A14,Def2;
      end;
      assume x in {e}-Ideal;
      hence x in I by A8;
    end;
    hence thesis by TARSKI:2;
  end;
end;
