
theorem Th7:
  for T being non empty TopSpace holds T is connected iff
  not ex f being Function of T, 1TopSp{0,1} st f is continuous onto
proof
  set X = {0}, Y = {1};
  set J = 1TopSp{0,1};
  let T be non empty TopSpace;
A1: the carrier of J = {0,1} by PCOMPS_1:5;
  then reconsider X, Y as non empty open Subset of J by TDLAT_3:15,ZFMISC_1:7;
  thus T is connected implies not ex f being Function of T,J st f is
  continuous onto
  proof
    assume
A2: T is connected;
    given f being Function of T,J such that
A3: f is continuous and
A4: f is onto;
    set A = f"X, B = f"Y;
    rng f = the carrier of J by A4;
    then
A5: A <> {}T & B <> {}T by RELAT_1:139;
A6: the carrier of T = A \/ B & A misses B by A1,Th3,FUNCT_1:71,ZFMISC_1:11;
    [#]J <> {};
    then A is open & B is open by A3,TOPS_2:43;
    hence contradiction by A2,A5,A6,CONNSP_1:11;
  end;
  reconsider j0 = 0, j1 = 1 as Element of J by A1,TARSKI:def 2;
  assume
A7: not ex f being Function of T,J st f is continuous onto;
  deffunc G(object) = j1;
  deffunc F(object) = j0;
  assume not thesis;
  then consider A, B being Subset of T such that
A8: [#]T = A \/ B and
A9: A <> {}T and
A10: B <> {}T and
A11: A is open & B is open and
A12: A misses B by CONNSP_1:11;
  defpred C[object] means $1 in A;
A13: for x being object st x in the carrier of T holds (C[x] implies F(x) in
  the carrier of J) & (not C[x] implies G(x) in the carrier of J);
  consider f being Function of the carrier of T, the carrier of J such that
A14: for x being object st x in the carrier of T holds (C[x] implies f.x =
  F(x)) & (not C[x] implies f.x = G(x)) from FUNCT_2:sch 5(A13);
  reconsider f as Function of T,J;
A15: dom f = the carrier of T by FUNCT_2:def 1;
A16: f"Y = B
  proof
    hereby
      let x be object;
      assume
A17:  x in f"Y;
      then f.x in Y by FUNCT_1:def 7;
      then f.x = 1 by TARSKI:def 1;
      then not C[x] by A14;
      hence x in B by A8,A17,XBOOLE_0:def 3;
    end;
    let x be object;
    assume
A18: x in B;
    then not x in A by A12,XBOOLE_0:3;
    then f.x = 1 by A14,A18;
    then f.x in Y by TARSKI:def 1;
    hence thesis by A15,A18,FUNCT_1:def 7;
  end;
A19: f"X = A
  proof
    hereby
      let x be object;
      assume
A20:  x in f"X;
      then f.x in X by FUNCT_1:def 7;
      then f.x = 0 by TARSKI:def 1;
      hence x in A by A14,A20;
    end;
    let x be object;
    assume
A21: x in A;
    then f.x = 0 by A14;
    then f.x in X by TARSKI:def 1;
    hence thesis by A15,A21,FUNCT_1:def 7;
  end;
A22: rng f = the carrier of J
  proof
    thus rng f c= the carrier of J;
    let y be object;
    assume
A23: y in the carrier of J;
    per cases by A1,A23,TARSKI:def 2;
    suppose
A24:  y = 0;
      consider x being object such that
A25:  x in f"X by A9,A19,XBOOLE_0:def 1;
      f.x in X by A25,FUNCT_1:def 7;
      then
A26:  f.x = 0 by TARSKI:def 1;
      x in dom f by A25,FUNCT_1:def 7;
      hence thesis by A24,A26,FUNCT_1:def 3;
    end;
    suppose
A27:  y = 1;
      consider x being object such that
A28:  x in f"Y by A10,A16,XBOOLE_0:def 1;
      f.x in Y by A28,FUNCT_1:def 7;
      then
A29:  f.x = 1 by TARSKI:def 1;
      x in dom f by A28,FUNCT_1:def 7;
      hence thesis by A27,A29,FUNCT_1:def 3;
    end;
  end;
  then f"{}J = {}T & f"[#]J = [#]T by A15,RELAT_1:134;
  then [#]J <> {} & for P being Subset of J st P is open holds f"P is open by
A1,A11,A19,A16,ZFMISC_1:36;
  then
A30: f is continuous by TOPS_2:43;
  f is onto by A22;
  hence thesis by A7,A30;
end;
