As high precision milling machines are difficult to create, has it been attempted to correct for errors in rail alignment and even machine flex digitally?

For instance if the table top was poured in self-leveling epoxy-granite or similar, then relative measurements could be taken between the cutting head in the gantry and the table surface. Any flaws in the machine could be error corrected digitally, thus making perfect alignments and highly machined parts unnecessary. I wonder if even flex in the machine could be partially cancelled out digitally.

By digital error correction I mean altering the co-ordinates of the cuts to take into account the relative table dimensions and expected cutting flaws. Software could be designed that would alter the shape of the piece, and then that sent to the regular g-code processing software. Alternately post-processing software specific to the table could process all commands.

Should I get myself to the patent office, or has this been done?