Difference between revisions of "Package sat/SAT.ConvertToCNF"

From ApCoCoAWiki
(Created page with "{{Version|2|ApCoCoA-1:SAT.ConvertToCNF}} <command> <title>SAT.ConvertToCNF</title> <short_description>Converts a given quadratic (cubic) system of polynomial equat...")
 
m (typo)
 
Line 14: Line 14:
 
<item>@param <em>QStrategy</em>: Strategy for quadratic substitution. 0 - Standard; 1 - Linear Partner; 2 - Adv. Lin. Partner;</item>
 
<item>@param <em>QStrategy</em>: Strategy for quadratic substitution. 0 - Standard; 1 - Linear Partner; 2 - Adv. Lin. Partner;</item>
 
<item>@param <em>CStrategy</em>: Strategy for cubic substitution. 0 - Standard; 1 - Quadratic Partner;</item>
 
<item>@param <em>CStrategy</em>: Strategy for cubic substitution. 0 - Standard; 1 - Quadratic Partner;</item>
<item>@return The path of the file where the output was written to.
+
<item>@return The path of the file where the output was written to.</item>
 
</itemize>
 
</itemize>
  

Latest revision as of 08:22, 16 October 2020

This article is about a function from ApCoCoA-2. If you are looking for the ApCoCoA-1 version of it, see ApCoCoA-1:SAT.ConvertToCNF.

SAT.ConvertToCNF

Converts a given quadratic (cubic) system of polynomial equations (SPE) over GF(2) to CNF. Writes the CNF to a temporary file whose path is returned.

Syntax

SAT.ConvertToCNF(SPE:LIST, CuttingNumber:INT, QStrategy:INT, CStrategy:INT):STRING

Description

This function starts the conversion algorithm.

  • @param SPE: A List containing the polynomial equations of the system.

  • @param CuttingNumber: Maximal support-length of the linear polynomials when their corresponding CNF is written to the file. Could be 3 - 6.

  • @param QStrategy: Strategy for quadratic substitution. 0 - Standard; 1 - Linear Partner; 2 - Adv. Lin. Partner;

  • @param CStrategy: Strategy for cubic substitution. 0 - Standard; 1 - Quadratic Partner;

  • @return The path of the file where the output was written to.

Example

-- quadratic system:
Use S ::= ZZ/(2)[x[1..3]];
F1 := x[1]*x[2] + x[1]*x[3] + x[2]*x[3] + x[3];
F2 := x[2] + 1;
F3 := x[1]*x[2] + x[3];
SPE := [F1,F2,F3];
CNFPath := SAT.ConvertToCNF(SPE,4,0,0);
SolPath := SAT.LaunchCryptoMiniSat(CNFPath);
SAT.GetResult(SolPath,S);
--Result: [0,1,0] Test with: Eval(SPE,[0,1,0]);

Example

-- cubic system:
Use S ::= ZZ/(2)[x[1..3]];
F1 := x[1]*x[2]*x[3] + x[1]*x[2] + x[2]*x[3] + x[1] + x[3] +1;
F2 := x[1]*x[2]*x[3] + x[1]*x[2] + x[2]*x[3] + x[1] + x[2];
F3 := x[1]*x[2] + x[2]*x[3] + x[2];
SPE := [F1,F2,F3];
CNFPath := SAT.ConvertToCNF(SPE,4,1,0);
SolPath := SAT.LaunchCryptoMiniSat(CNFPath);
SAT.GetResult(SolPath,S);
--Result: [0,0,1] Test with: Eval(SPE,[0,0,1]);