reserve X,Y for set;
reserve R for domRing-like commutative Ring;
reserve c for Element of R;

theorem Th18:
  for a,b being Element of R holds a is_associated_to b iff
  ex c st c is unital & a * c = b
proof
A1: for a,b being Element of R holds a is_associated_to b implies
  ex c being Element of R st c is unital & a * c = b
  proof
    let A,B be Element of R;
    assume
A2: A is_associated_to B;
    then A divides B;
    then consider C being Element of R such that
A3: B = A * C;
    B divides A by A2;
    then consider D being Element of R such that
A4: A = B * D;
    now
      per cases;
      case
A5:     A <> 0.R;
        A = A * (C * D) by A3,A4,GROUP_1:def 3;
        then C * D = 1.R by A5,Th17;
        then C is unital;
        hence thesis by A3;
      end;
      case
A6:     A = 0.R;
        1.R divides 1.R;
        then
A7:     1.R is unital;
        B = 0.R by A3,A6;
        then B = A * 1.R by A6;
        hence thesis by A7;
      end;
    end;
    hence thesis;
  end;
  for a,b being Element of R holds (ex c being Element of R st (c is
  unital & a * c = b)) implies a is_associated_to b
  proof
    let A,B be Element of R;
    (ex c st (c is unital & A * c = B)) implies A is_associated_to B
    proof
      now
        assume ex c st c is unital & A * c = B;
        then consider C being Element of R such that
A8:     C is unital and
A9:     A * C = B;
        C divides 1.R by A8;
        then consider D being Element of R such that
A10:    C * D = 1.R;
        A = A * (C * D) by A10
          .= B * D by A9,GROUP_1:def 3;
        then
A11:    B divides A;
        A divides B by A9;
        hence thesis by A11;
      end;
      hence thesis;
    end;
    hence thesis;
  end;
  hence thesis by A1;
end;
