Definition of the Kripke--Joyal semantics and its fundamental properties