  We consider the problem of extraction and validation of matching rules,
directly from the phased diffraction data of a quasicrystal, and propose an
algorithmic procedure to produce the rules of the shortest possible range. We
have developed a geometric framework to express such rules together with a
homological mechanism enforcing the long-range quasiperiodic order. This
mechanism tolerates the presence of defects in a robust way.
