reserve i,j,k,n for Nat;
reserve x,x1,x2,x3,y1,y2,y3 for set;

theorem Th9:
  for a,b,c,d being set st a = b iff c = d holds (a,b) --> (c,d)"
  = (c,d) --> (a,b)
proof
  let a,b,c,d being set such that
A1: a = b iff c = d;
  per cases by A1;
  suppose
A2: a = b & c = d;
    (a,a) --> (d,d)" = (a .--> d)" by FUNCT_4:81
      .= (d .--> a) by Th8
      .= (d,d) --> (a,a) by FUNCT_4:81;
    hence thesis by A2;
  end;
  suppose
A3: a <> b & c <> d;
    set f = (a,b) --> (c,d), g = (c,d) --> (a,b);
A4: for y,x be object holds y in rng f & x = g.y iff x in dom f & y = f.x
    proof
      let y,x be object;
A5:   x in dom f & y = f.x implies y in rng f & x = g.y
      proof
        assume that
A6:     x in dom f and
A7:     y = f.x;
A8:     x in {a,b} by A6,FUNCT_4:62;
        per cases by A8,TARSKI:def 2;
        suppose
A9:       x = a;
          then
A10:      y = c by A3,A7,FUNCT_4:63;
          then y in {c,d} by TARSKI:def 2;
          hence thesis by A3,A9,A10,FUNCT_4:63,64;
        end;
        suppose
A11:      x = b;
          then
A12:      y = d by A7,FUNCT_4:63;
          then y in {c,d} by TARSKI:def 2;
          hence thesis by A3,A11,A12,FUNCT_4:63,64;
        end;
      end;
      y in rng f & x = g.y implies x in dom f & y = f.x
      proof
        assume that
A13:    y in rng f and
A14:    x = g.y;
A15:    y in {c,d} by A3,A13,FUNCT_4:64;
        per cases by A15,TARSKI:def 2;
        suppose
A16:      y = c;
          then
A17:      x = a by A3,A14,FUNCT_4:63;
          then x in {a,b} by TARSKI:def 2;
          hence thesis by A3,A16,A17,FUNCT_4:62,63;
        end;
        suppose
A18:      y = d;
          then
A19:      x = b by A14,FUNCT_4:63;
          then x in {a,b} by TARSKI:def 2;
          hence thesis by A18,A19,FUNCT_4:62,63;
        end;
      end;
      hence thesis by A5;
    end;
A20: f is one-to-one
    proof
A21:  dom f = {a,b} by FUNCT_4:62;
      let x1,x2 being object such that
A22:  x1 in dom f & x2 in dom f and
A23:  f.x1 = f.x2;
      per cases by A22,A21,TARSKI:def 2;
      suppose
        x1 = a & x2 = a or x1 = b & x2 = b;
        hence thesis;
      end;
      suppose
A24:    x1 = a & x2 = b;
        then f.x1 = c by A3,FUNCT_4:63;
        hence thesis by A3,A23,A24,FUNCT_4:63;
      end;
      suppose
A25:    x1 = b & x2 = a;
        then f.x1 = d by FUNCT_4:63;
        hence thesis by A3,A23,A25,FUNCT_4:63;
      end;
    end;
    dom g = {c,d} by FUNCT_4:62
      .= rng f by A3,FUNCT_4:64;
    hence thesis by A20,A4,FUNCT_1:32;
  end;
end;
