Skip to content

[Rule] MultivariateQuadratic to ILP #130

@QingyunQian

Description

@QingyunQian

Source: MultivariateQuadratic (over F_2)
Target: ILP (Integer Linear Programming, bool variant)
Motivation: Enables solving Boolean MQ instances using mature ILP solvers. This reduction is practical for small-to-medium instances and gives a strictly linear ILP formulation. It also connects the companion model issue #129 to an existing solver-backed problem in the reduction graph.
Reference:

Reduction Algorithm

Notation:

  • Scope of this rule: the decision problem MultivariateQuadratic over F_2 from issue #129
  • Source: MQ instance with num_variables = n Boolean variables and num_equations = m equations
  • Let num_distinct_cross_terms = P denote the number of distinct quadratic cross terms x_i x_j with i < j that appear anywhere in the system
  • Target: ILP instance over Boolean decision variables, with additional integer slack variables for parity equalities

Variable mapping:

  1. Original variables: For each x_i in F_2, create a Boolean ILP variable x_i in {0, 1}.
  2. Product variables (linearization): For each distinct cross term x_i x_j with i < j, introduce a Boolean ILP variable y_ij representing x_i * x_j.
  3. Square terms: Over F_2, x_i^2 = x_i, so square terms become linear and need no extra variables.
  4. Parity slack variables: For each equation k, introduce an integer slack variable z_k to encode the mod-2 parity condition as a standard linear equality.

Constraint transformation:

For each MQ equation over F_2,

f_k(x) = sum_{i<j} a^k_ij x_i x_j + sum_i b^k_i x_i + c_k = 0 (mod 2),

perform the following steps:

  1. Linearize monomials: Replace each x_i x_j by y_ij and define

    L_k = sum_{i<j} a^k_ij y_ij + sum_i b^k_i x_i + c_k.

  2. Parity to linear equality: Enforce L_k ≡ 0 (mod 2) by the integer equality

    L_k = 2 * z_k,

    where z_k is an integer variable with bounds 0 <= z_k <= floor(T_k / 2), and T_k is the maximum possible value of L_k.

  3. Product consistency: For each y_ij, add the three linear constraints

    y_ij <= x_i
    y_ij <= x_j
    y_ij >= x_i + x_j - 1

    with x_i, x_j, y_ij in {0, 1}. For binary variables these constraints exactly encode y_ij = x_i x_j.

Objective:

  • This is a reduction from a satisfaction problem to a feasibility ILP instance.
  • The target objective can therefore be omitted, or written as a dummy objective such as minimize 0.

Solution extraction:

  • Given any feasible ILP solution, read back the original variables x_i.
  • Discard the auxiliary variables y_ij and z_k.
  • The recovered Boolean vector x is the candidate solution for the source MultivariateQuadratic instance.
  • Correctness condition: x satisfies the source iff the constructed ILP instance is feasible.

Size Overhead

Target metric (code name) Formula
num_vars num_variables + num_distinct_cross_terms + num_equations
num_constraints num_equations + 3 * num_distinct_cross_terms

Where:

  • num_variables is the number of source Boolean variables
  • num_equations is the number of source equations
  • num_distinct_cross_terms counts the distinct quadratic cross terms x_i x_j with i < j appearing in the source system

Detailed breakdown:

  • Original variables: num_variables
  • Product variables: num_distinct_cross_terms
  • Parity slack variables: num_equations
  • Total ILP variables: num_variables + num_distinct_cross_terms + num_equations
  • Total ILP constraints: num_equations + 3 * num_distinct_cross_terms
  • Coarse upper bound using only num_variables and num_equations: O(num_variables^2 + num_equations)

Validation Method

  • Build a closed-loop test on small MQ instances over F_2.
  • Reduce the source MQ instance to an ILP instance.
  • Check ILP feasibility with a brute-force or exact ILP solver.
  • Extract the x_i assignment from the ILP solution and verify that every source equation evaluates to 0 mod 2.
  • Cross-check against exhaustive search on the source problem to confirm that the ILP instance is feasible iff the MQ instance is satisfiable.

Example

Source MQ instance (F_2):

Field: F_2 = {0, 1}
Variables: x_1, x_2
Equations:
  f_1: x_1 * x_2 + x_1 = 0 (mod 2)
  f_2: x_1 * x_2 + x_2 = 0 (mod 2)

The satisfying MQ assignments are (x_1, x_2) = (0, 0) and (1, 1).

Target ILP instance:

Variables:
  x_1, x_2 in {0,1}          (original)
  y_12 in {0,1}              (product for x_1 x_2)
  z_1, z_2 in Z, 0 <= z_1, z_2 <= 1   (parity slack)

Constraints:
  # Equation 1: x_1 x_2 + x_1 = 0 (mod 2)
  y_12 + x_1 = 2 * z_1

  # Equation 2: x_1 x_2 + x_2 = 0 (mod 2)
  y_12 + x_2 = 2 * z_2

  # Product consistency: y_12 = x_1 x_2
  y_12 <= x_1
  y_12 <= x_2
  y_12 >= x_1 + x_2 - 1

Two corresponding feasible ILP points:

  1. From MQ solution (x_1, x_2) = (0, 0):
x_1 = 0, x_2 = 0, y_12 = 0, z_1 = 0, z_2 = 0

Verification:

  • Equation 1: 0 + 0 = 0 = 2 * 0
  • Equation 2: 0 + 0 = 0 = 2 * 0
  1. From MQ solution (x_1, x_2) = (1, 1):
x_1 = 1, x_2 = 1, y_12 = 1, z_1 = 1, z_2 = 1

Verification:

  • Equation 1: 1 + 1 = 2 = 2 * 1
  • Equation 2: 1 + 1 = 2 = 2 * 1

Extraction check:

  • Reading back only (x_1, x_2) from either feasible ILP point recovers a satisfying MQ assignment.
  • The auxiliary values y_12, z_1, and z_2 are discarded after extraction.

Overhead verification for this example:

  • num_variables = 2
  • num_equations = 2
  • num_distinct_cross_terms = 1 (only x_1 x_2 appears)
  • num_vars = 2 + 1 + 2 = 5
  • num_constraints = 2 + 3 * 1 = 5

Complexity notes:

  • ILP solvers are highly optimized and may be faster in practice on structured instances.
  • This issue is specifically for MQ over F_2; extensions to larger finite fields would require a different source model and different linearization choices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoodAn issue passed all checks.ruleA new reduction rule to be added.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions