1. A method for inspecting a photomask used to generate integrated circuit patterns on a wafer, the method comprising: a computer performing steps comprising: generating a potentially defective circuit pattern set, having a plurality of potentially defective circuit patterns including a first circuit pattern that is defective and a second circuit pattern that is valid, wherein generating the potentially defective circuit pattern set includes: applying an algorithm to data representative of images of a plurality of circuit patterns to generate data representative of images of valid circuit patterns and comparing the data representative of images of a plurality of circuit patterns to the data representative of images of valid circuit patterns to identify at least one potentially defective circuit pattern; and determining a defective circuit pattern in the potentially defective circuit pattern set using a codebook including codes representative of known valid circuit patterns or codes representative of known invalid circuit patterns.