  We develop a formalism to extend, simultaneously, the usual definition of
bulk and edge indices from topological insulators to the case of a finite
sample with open boundary conditions, and provide a physical interpretation of
these quantities. We then show that they converge exponentially fast to an
integer value when we increase the system size, and also that bulk and edge
quantities coincide at finite size. The theorem applies to any non-homogeneous
system such as disordered or defect configurations. We focus on one-dimensional
chains with chiral symmetry, such as the Su-Schrieffer-Heeger model, but the
proof actually only requires the Hamiltonian to be short-range and with a
spectral gap in the bulk. The definition of bulk and edge indices relies on a
finite-size version of the switch-function formalism where the Fermi projector
is smoothed in energy using a carefully chosen regularization parameter.
