Abstract

Manthan (Golia et al., 2020) is a novel framework for Boolean functional synthesis that views the task as a classification problem: it learns candidate functions from data generated via constrained sampling and iteratively repairs them using formal reasoning (MaxSAT and Unsat Cores) to guarantee correctness. It solves 356/609 benchmark instances.

Overview of Manthan

Manthan is a data-driven framework for Boolean Functional Synthesis. The goal is to take a relational specification (where are inputs and are outputs) and synthesize a vector of deterministic functions such that replacing with satisfies the specification.

It uses a hybrid architecture:

  1. Machine Learning: To “guess” candidate functions quickly using data.
  2. Automated Reasoning: To “verify and fix” those guesses using formal proofs.

The workflow is divided into three phases: Preprocess, LearnSkF, and Refine.

Phase 1: Preprocess

Before applying complex algorithms, Manthan simplifies the formula by solving for “easy” variables using logical properties called unate.

  • Concept: A variable is a “positive unate” if changing it from 0 to 1 can turn the formula from False to True, but never from True to False.
  • Mechanism: Manthan performs SAT checks to detect these properties.
    • Positive Unate: If is positive unate, its function is .
    • Negative Unate: If is negative unate, its function is .

Outcome: These variables are effectively “solved” and removed from the learning pile, reducing the dimensionality of the problem for the next phase.

Phase 2: LearnSkF (Learn Skolem Function)

This is the data-driven core where Manthan approximates the remaining functions. It treats synthesis as a classification task.

Step 2.1: Data Generation (GetSamples)

Manthan needs input-output examples (X, Y) to train its models.

  • The Challenge: is a relation, not a function. Uniform random sampling often misses “corner cases” where the output is strictly determined by .
  • The Solution: Weighted Constrained Sampling.
  • AdaBiasGen Strategy:
    1. Generate pilot samples with a strong bias (e.g., P() = 0.9) to explore boundaries.
    2. Analyze the distribution of these pilot samples.
    3. Generate the full training set using biases tuned to “push” the sampler into interesting regions of the Boolean space.

Step 2.2: Dependency-Driven Classification (CandidateSkF)

Manthan learns a separate Decision Tree for each variable .

  • Feature Selection: To predict , it uses and any other output variables that do not depend on . This implicitly builds a dependency graph.
  • Model: ID3 algorithm using Gini Index for impurity.
  • Symbolic Conversion: The trained tree is converted into a Boolean formula.
    • For every leaf node labeled 1, the path from the root is extracted as a conjunction of literals.
    • The function is the disjunction (OR) of all such paths.

Step 2.3: Ordering (FindOrder)

Because functions can depend on each other (e.g., uses ), Manthan computes a TotalOrder (linear execution order) by topologically sorting the dependency graph. This ensures no cyclic dependencies exist.

Phase 3: Refine (Verification and Refinement)

The learned candidates are just approximations. This phase uses formal logic to find bugs and patch them.

Step 3.1: Verification

Manthan constructs an Error Formula to check if the candidate functions are valid:

  • UNSAT: The functions are valid. The process finishes.
  • SAT: The solver returns a counterexample . This is a specific input where the current functions produce an invalid output, even though a valid output exists.

Step 3.2: Fault Localization (MaxSAT)

Identifying which function is wrong is crucial to avoid breaking correct parts of the system.

  • Tool: MaxSAT Solver.

  • Query: “Find an assignment that satisfies the specification (Hard Constraint) while changing as few function outputs as possible (Soft Constraints)”.

  • Result: Variables that violate the soft constraints are flagged as erring functions.

Step 3.3: Proof-Guided Repair

Manthan repairs each erring function using Unsat Cores.

  1. Construct : A temporary formula that asserts the function’s current (incorrect) value alongside the specification and counterexample. This formula is naturally UNSAT (contradictory).

  2. Extract Core: The Unsat Core of is extracted. This subset of clauses explains why the contradiction exists.

  3. Patch (): A repair formula is created from the core.

    • If the function output 1 but should be 0: .
    • If the function output 0 but should be 1: .

Step 3.4: Self-Substitution (The Safety Net)

Some functions (like parity) are hard for decision trees to learn.

  • Heuristic: If a function is repaired more than 10 times, it is marked “hard-to-learn”.

  • Action: Manthan switches to Self-Substitution. It solves for analytically by setting . This is precise but computationally expensive, so it is used sparingly.

Final Step: Substitute

Once the Refine loop ensures the functions are correct (UNSAT error formula), the functions in might still depend on each other (e.g., depends on ).

  • The Substitute routine uses the TotalOrder to recursively replace these dependencies.
  • Result: A clean vector where every function depends only on the inputs .

Overview of Manthan2

Abstract

In Golia et al. (2021) the authors introduce Manthan2, a significantly improved data-driven Boolean functional synthesis engine that achieves state-of-the-art scalability by integrating the following into Manthan:

  1. interpolation-based function extraction,
  2. clustering-based multi-classification, and
  3. dependency-aware repair mechanisms

Manthan2 solves 509 instances, a 153-instance improvement over Manthan, which had only improved on the prior state-of-the-art by 76 instances. It introduces key innovations like retaining determined features and clustering-based multi-classification to enhance scalability and efficiency.

The Solution/Methodology

The authors propose Manthan2, which enhances the original Manthan pipeline through four distinct algorithmic improvements.

  1. Unique Function Extraction (UniDef): Before learning, the system checks if any output variables () are uniquely defined by the remaining variables using Padoa’s Theorem and interpolation. If a definition is found, it is extracted immediately and removed from the learning queue.

  2. Variable Retention (Determined Features): Contrary to standard practice where defined variables are eliminated/removed from the formula (e.g., using substitution () or elimination()), Manthan2 retains these variables. They act as “determined features” (extra inputs) that help the machine learning model learn simpler functions for the remaining difficult variables.

  3. Clustering-based Multi-Classification: Instead of learning one decision tree for every single output variable (which is slow), Manthan2 groups related output variables using a graph-clustering approach. It then trains a multi-output classifier to predict values for a whole cluster at once, significantly speeding up the learning phase.

  4. Lexicographic MaxSAT Repair: When candidate functions fail verification, Manthan2 uses Lexicographic MaxSAT to select which functions to repair. It imposes a strict hierarchy: it prefers fixing variables that appear earlier in the dependency order, preventing wasted effort on downstream variables that might automatically resolve once the upstream dependency is fixed.

Key Results & Contributions

  • State-of-the-Art Performance: Manthan2 solved 509 out of 609 benchmarks, a massive leap over the previous best (Manthan) which solved 356. This increase of 153 instances is double the improvement Manthan originally made over its predecessor.

  • Efficiency: The PAR-2 score (a cumulative runtime metric) dropped from 6374.39 (Manthan) to 2858.61 (Manthan2), indicating it is more than twice as fast/effective on average.

  • Validation of Methods:

    • Clustering: Grouping variables reduced runtime by ~250 seconds.
    • LexMaxSAT: Prioritizing repairs saved ~100 seconds in PAR-2 score.
    • Unique Extraction: Proved vital; for ~40% of benchmarks, Manthan2 could extract exact functions for >95% of the variables without needing learning at all.

Manthan2 Architecture Introduction

These notes follow the execution flow of the Manthan2 algorithm, using the paper’s running example to illustrate each step.

Running Example Setup:

  • Inputs (X):
  • Outputs (Y):
  • Specification (F): .

Phase 1: Unique Function Extraction (UniDef)

The algorithm begins by reducing the problem space. Instead of learning everything, it checks for variables that are mathematically fixed by the specification.

  • Concept: Uses Padoa’s Theorem and Interpolation. If implies , then is the Skolem function.
  • Example: The system analyzes . It identifies that is uniquely defined by .
  • Result: It extracts .
  • Determined Set (Z): is added to the “determined set”.
  • Unlike previous tools, Manthan2 keeps in the formula. It treats as a known feature for future steps rather than deleting via substitution. This keeps the remaining functions simpler.

Phase 2: Clustering & Sampling

Now the system generates data to learn the remaining undefined variables .

  • Sampling: It generates random satisfying assignments (samples) of .

  • Clustering (ClusterY): It builds a primal graph where edges connect variables appearing in the same clause.

    • and share a clause .
    • is isolated from them.
  • Result: The algorithm clusters into groups: .

  • Benefit: This allows using a multi-classifier. Instead of two separate trees for and , one tree predicts the vector .

Phase 3: Learning Candidates (CandidateSkF)

Manthan2 learns decision trees (DT) for the clusters.

  • Cluster :

    • Features: (and potentially determined variables if valid).
    • Labels: The combination pairs observed in samples (e.g., 01, 10, 11).
    • Tree Logic: The tree splits on and .
  • Extraction:

    • For (corresponding to ): It takes the disjunction of paths where the label for is 1.
    • Learned .
    • Learned .
  • Cluster :

    • Learned .
  • Current Candidate Vector: .

Phase 4: Verification

The system checks if the candidates are actually valid Skolem functions.

  • Error Formula: .
  • Check: Is there an input where the candidates fail to satisfy ?
  • Result: The formula is SAT (Satisfiable), meaning the candidates are imperfect. A counterexample is found (e.g., ).

Phase 5: Dependency-Aware Repair (LexMaxSAT)

The candidates need fixing. The key is deciding which one to fix.

  • Dependency Order: The system determines a topological order: depends on , might depend on others, etc. Let’s assume order .

  • The Issue: A standard MaxSAT might suggest fixing . But if depends on , and is wrong, fixing is useless.

  • LexMaxSAT Solution: Manthan2 sets up “soft constraints” (preferences) to keep the current candidate functions, but weights them by their dependency order. It prioritizes fixing the independent variables first. If is independent and wrong, it must be fixed before looking at .

  • In Example: The solver identifies that needs repair (specifically for the counterexample assignment).

  • Repair Execution: It constructs a repair formula which forces to flip its output for the problematic input.

    • Manthan2 updates .
    • New .

Final Outcome

With the repaired , the error formula becomes UNSAT. The system outputs the valid Skolem function vector.

References

Golia, P., Roy, S., & Meel, K. S. (2020). Manthan: A Data-Driven Approach for Boolean Function Synthesis. In S. K. Lahiri & C. Wang (Eds.), Computer Aided Verification (Vol. 12225, pp. 611–633). Springer International Publishing. https://doi.org/10.1007/978-3-030-53291-8_31
Golia, P., Slivovsky, F., Roy, S., & Meel, K. S. (2021). Engineering an Efficient Boolean Functional Synthesis Engine. 2021 IEEE/ACM International Conference On Computer Aided Design (ICCAD), 1–9. https://doi.org/10.1109/ICCAD51958.2021.9643583