A green's function theory of surface states