Code Monkey home page Code Monkey logo

anf_to_2xnf's Introduction

anf_to_2xnf

Tool for conversion of ANF to 2-XOR-OR-AND normal form (2-XNF) implemented in Python 3.

Usage

python3 anf_to_2xnf.py input.anf -xp output.xnf

input.anf is a text file with the following structure:

  • The first line contains all indeterminates (= unicode strings not containing spaces and not being equal to 1 or 0) separated with a comma and AT LEAST ONE SPACE (important for reading in indeterminates of the form x[1,1]),
  • All other lines contain each exactly one polynomial,
  • Polynomials are sums (+) of terms and a term is a product (*) of indeterminates or simply 1,
  • Lines marked with # at the start are treated as comment lines.

For example, the system of ANFs ${x_1x_2x_3+x_1x_2+1, x_2+x_3+1}$ in the indeterminates $x_1,x_2,x_3$ is encoded as

x[1], x[2], x[3]
x[1]*x[2]*x[3] + x[1]*x[2] + 1
x[2] + x[3] + 1

output.xnf is a text file containing a DIMACS-like description of a 2-XNF representation of the system in input.anf:

  • Lines starting with c are ignored as comment lines,
  • The header is of the form p xnf n_vars n_cls,
  • Linerals are represented as sums of literals (e.g. -1+2+-3 for the lineral $(\neg X_1 \oplus X_2 \oplus \neg X_3)$,
  • XNF literals are lists of linerals, separated using spaces and terminated with 0 (e.g. -1+2 3 0 represents $(\neg X_1 \oplus X_2) \lor X_3$).

For example, the XNF $((X_1 \oplus X_2) \lor X_3) \land (X_1 \lor \neg(X_1 \oplus X_3)) \land (X_2 \oplus X_1) \land X_2$ is encoded as

p xnf 3 4
1+2 3 0
1 -1+3 0
2+1 0
2 0

Run python3 anf_to_2xnf.py -h to get detailed informations about all options.

Requirements

Optional:

anf_to_2xnf's People

Contributors

wrazlmumfp avatar

Stargazers

Julian Danner avatar Flo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.