A method (100, 200, 300), comprising: performing (102, 204, 304) optical character recognition, OCR, on a scanned image of a first document; extracting (104, 206, 306) an identifier from the first document; identifying (106, 206, 306) a complementary document associated with the first document using the identifier; generating (108, 220, 320) a list of hypotheses mapping the first document to the complementary document using: textual information from the first document; textual information from the complementary document; and predefined business rules; wherein generating (108, 220, 320) the list of hypotheses comprises determining an overall cost of validating the first document according to each of the hypotheses; determining (110, 222, 322) a validity of the first document based on the hypotheses, wherein determining the validity of the first document comprises selecting from among the hypotheses a hypothesis associated with a lowest cost, and determining the validity of the first document based on the selected hypothesis; and outputting an indication of the determined validity; wherein the first document is an invoice and the complementary document is a purchase order; and wherein the overall cost of validating the first document according to each of the hypotheses is the sum of: (i) a cost of generating a set of position match candidates from the invoice, wherein each position match candidate comprises a line-item or a combination of line-items extracted from the invoice that is a candidate to match to a position of the purchase order; and (ii) a cost associated with a specific one-to-one mapping of said set of position match candidates to respective positions of the purchase order. performing (102, 204, 304) optical character recognition, OCR, on a scanned image of a first document; extracting (104, 206, 306) an identifier from the first document; identifying (106, 206, 306) a complementary document associated with the first document using the identifier; generating (108, 220, 320) a list of hypotheses mapping the first document to the complementary document using: textual information from the first document; textual information from the complementary document; and predefined business rules; wherein generating (108, 220, 320) the list of hypotheses comprises determining an overall cost of validating the first document according to each of the hypotheses; textual information from the first document; textual information from the complementary document; and predefined business rules; wherein generating (108, 220, 320) the list of hypotheses comprises determining an overall cost of validating the first document according to each of the hypotheses; determining (110, 222, 322) a validity of the first document based on the hypotheses, wherein determining the validity of the first document comprises selecting from among the hypotheses a hypothesis associated with a lowest cost, and determining the validity of the first document based on the selected hypothesis; and outputting an indication of the determined validity; wherein the first document is an invoice and the complementary document is a purchase order; and wherein the overall cost of validating the first document according to each of the hypotheses is the sum of: (i) a cost of generating a set of position match candidates from the invoice, wherein each position match candidate comprises a line-item or a combination of line-items extracted from the invoice that is a candidate to match to a position of the purchase order; and (ii) a cost associated with a specific one-to-one mapping of said set of position match candidates to respective positions of the purchase order. (i) a cost of generating a set of position match candidates from the invoice, wherein each position match candidate comprises a line-item or a combination of line-items extracted from the invoice that is a candidate to match to a position of the purchase order; and (ii) a cost associated with a specific one-to-one mapping of said set of position match candidates to respective positions of the purchase order.