diff --git a/src/api/verify.js b/src/api/verify.js index 2f174c8..56652ce 100644 --- a/src/api/verify.js +++ b/src/api/verify.js @@ -1,3 +1,11 @@ import _verify from '../core/_verify.js'; +/** + * Verify that satisfiability of the input instance can be derived from the + * input certificate. + * + * @param {ParitiesInstance|SignsInstance|KeysInstance} instance + * @param {number[]} certificate + * @return {boolean} + */ const verify = ({clauses}, certificate) => _verify(clauses, certificate); export default verify; diff --git a/src/core/_verify.js b/src/core/_verify.js index 857fd9f..0d82ad2 100644 --- a/src/core/_verify.js +++ b/src/core/_verify.js @@ -3,9 +3,9 @@ * of clauses. The list of clauses and the assignment vector are in parity * format. * - * @param {Iterable} clauses The clauses in parity format. - * @param {Array} assignment The assignment vector in parity format. - * @returns {Boolean} Whether the assignment satisfies the k-CNF formula + * @param {number[][]} clauses The clauses in parity format. + * @param {number[]} assignment The assignment vector in parity format. + * @returns {boolean} Whether the assignment satisfies the k-CNF formula * represented by the list of clauses. */ export default function _verify(clauses, assignment) { diff --git a/src/core/convert/KeysInstance.js b/src/core/convert/KeysInstance.js index 983976e..d289fea 100644 --- a/src/core/convert/KeysInstance.js +++ b/src/core/convert/KeysInstance.js @@ -1,5 +1,9 @@ import _certificate_to_keys from './_certificate_to_keys.js'; +/** + * Maintains a mapping between variable names and a parity + * representation of the instance. + */ export default class KeysInstance { /** * Constructor. diff --git a/src/core/convert/ParitiesInstance.js b/src/core/convert/ParitiesInstance.js index 4680c56..8909b39 100644 --- a/src/core/convert/ParitiesInstance.js +++ b/src/core/convert/ParitiesInstance.js @@ -1,5 +1,8 @@ import _count from './_count.js'; +/** + * Holds all properties of a k-CNF SAT instance in parity format. + */ export default class ParitiesInstance { /** * Clauses are in parity format. diff --git a/src/core/convert/SignsInstance.js b/src/core/convert/SignsInstance.js index b164833..d6254f2 100644 --- a/src/core/convert/SignsInstance.js +++ b/src/core/convert/SignsInstance.js @@ -1,5 +1,8 @@ import _count from './_count.js'; +/** + * Allows to produce an assignment format that makes sense in sign format. + */ export default class SignsInstance { /** * Clauses are in parity format.