
theorem Th48:
  for S,T being non empty TopSpace, f being Function of S,T
  st f is bijective &
    ex K being prebasis of S, L being prebasis of T st f.:K = L
  holds f is being_homeomorphism
proof
  let S, T be non empty TopSpace, f be Function of S,T;
  assume A1: f is bijective;
  given K being prebasis of S, L being prebasis of T such that
    A2: f.:K = L;
  :: the basic idea is to take the canonical bases from the prebases and
  :: show the condition of the theorem above
  reconsider K0 = FinMeetCl K as Basis of S by YELLOW_9:23;
  reconsider L0 = FinMeetCl L as Basis of T by YELLOW_9:23;
  reconsider g = f" as Function of T, S;
  reconsider f0 = f as one-to-one Function by A1;
  a3:   f0" = g by A1, TOPS_2:def 4;
  for W being Subset of T holds W in L0 iff
    ex V being Subset of S st V in K0 & f.:V = W
  proof
    let W be Subset of T;
    thus W in L0 implies ex V being Subset of S st V in K0 & f.:V = W
    proof
      assume W in L0;
      then consider Y being Subset-Family of T such that
        A4: Y c= L & Y is finite & W = Intersect Y by CANTOR_1:def 3;
      per cases;
      suppose A5: Y <> {};
        then A6: W = meet Y by A4, SETFAM_1:def 9;
        reconsider X = g.:Y as Subset-Family of S;
        reconsider V = meet X as Subset of S;
        take V;
        :: we use V := meet f"Y, then f.:V = f.:meet f"Y = meet f.:f"Y = meet Y
        ex Z being Subset-Family of S st Z c= K & Z is finite & V = Intersect Z
        proof
          take X;
          for x being object st x in X holds x in K
          proof
            let x be object;
            assume x in X;
            then consider B being Subset of T such that
              A7: B in Y & x = g.:B by FUNCT_2:def 10;
            consider A being Subset of S such that
              A8: A in K & B = f.:A by A2, A4, A7, FUNCT_2:def 10;
            A9: dom f = the carrier of S by FUNCT_2:def 1;
            x = f"(f.:A) by a3,FUNCT_1:85, A7, A8
              .= A by A1, A9, FUNCT_1:94;
            hence thesis by A8;
          end;
          hence X c= K & X is finite by A4, TARSKI:def 3;
          consider B being object such that
            A10: B in Y by A5, XBOOLE_0:def 1;
          reconsider B as Subset of T by A10;
          g.:B in X by A10, FUNCT_2:def 10;
          hence thesis by SETFAM_1:def 9;
        end;
        hence V in K0 by CANTOR_1:def 3;
        set Z = { f.:A where A is Subset of S : A in X };
        for x being object holds x in Z iff x in Y
        proof
          let x be object;
          A11: rng f = the carrier of T by A1, FUNCT_2:def 3;
          hereby
            assume x in Z;
            then consider A being Subset of S such that
              A12: f.:A = x & A in X;
            consider B being Subset of T such that
              A13: B in Y & A = g.:B by A12, FUNCT_2:def 10;
            x = f.:(f"B) by a3,FUNCT_1:85, A12, A13
              .= B by A11, FUNCT_1:77;
            hence x in Y by A13;
          end;
          assume A14: x in Y;
          then reconsider B = x as Subset of T;
          A15: g.:B in X by A14, FUNCT_2:def 10;
          f.:(g.:B) = f.:(f"B) by a3,FUNCT_1:85
            .= B by A11, FUNCT_1:77;
          hence thesis by A15;
        end;
        then Z = Y by TARSKI:2;
        hence f.:V = W by A1, A6, Th4;
      end;
      suppose Y = {};
        then A16: W = the carrier of T by A4, SETFAM_1:def 9;
        set V = [#]S;
        take V;
        set Z = the empty Subset-Family of S;
        Intersect Z = the carrier of S by SETFAM_1:def 9;
        then Z c= K & Z is finite & V = Intersect Z
          by XBOOLE_1:2,STRUCT_0:def 3;
        hence V in K0 by CANTOR_1:def 3;
        thus f.:V = f.:the carrier of S by STRUCT_0:def 3
          .= f.:dom f by FUNCT_2:def 1
          .= rng f by RELAT_1:113
          .= W by A16, A1, FUNCT_2:def 3;
      end;
    end;
    given V being Subset of S such that
      A17: V in K0 & f.:V = W;
    consider X being Subset-Family of S such that
      A18: X c= K & X is finite & V = Intersect X by A17, CANTOR_1:def 3;
    per cases;
    suppose A19: X <> {};
      then A20: V = meet X by A18, SETFAM_1:def 9;
      ex Y being Subset-Family of T st Y c= L & Y is finite & W = Intersect Y
      proof
        reconsider Y = f.:X as Subset-Family of T;
        take Y;
        thus Y c= L
        proof
          let x be object;
          assume x in Y;
          then ex A being Subset of S st
            A in X & f.:A = x by FUNCT_2:def 10;
          hence thesis by A2, FUNCT_2:def 10, A18;
        end;
        thus Y is finite by A18;
        set Z = { f.:A where A is Subset of S : A in X };
        for x being object holds x in Y iff x in Z
        proof
          let x be object;
          hereby
            assume x in Y;
            then ex A being Subset of S st
              A in X & f.:A = x by FUNCT_2:def 10;
            hence x in Z;
          end;
          assume x in Z;
          then ex A being Subset of S st f.:A = x & A in X;
          hence thesis by FUNCT_2:def 10;
        end;
        then Y = Z by TARSKI:2;
        then A24: meet Y = W by A1, A17, A20, Th4;
        consider A being object such that
          A25: A in X by A19, XBOOLE_0:def 1;
        reconsider A as Subset of S by A25;
        f.:A in f.:X by A25, FUNCT_2:def 10;
        hence thesis by A24, SETFAM_1:def 9;
      end;
      hence thesis by CANTOR_1:def 3;
    end;
    suppose X = {};
      then A26: V = the carrier of S by A18, SETFAM_1:def 9;
      set Y = the empty Subset-Family of T;
      B1: Y c= L & Y is finite by XBOOLE_1:2;
      W = f.:dom f by A17, A26, FUNCT_2:def 1
          .= rng f by RELAT_1:113
          .= the carrier of T by A1, FUNCT_2:def 3
          .= Intersect Y by SETFAM_1:def 9;
      hence W in L0 by B1,CANTOR_1:def 3;
    end;
  end;
  then f.:K0 = L0 by FUNCT_2:def 10;
  hence thesis by A1, Th47;
end;
