Giter VIP home page Giter VIP logo

dnfminimizer's Introduction

DNFMinimizer

FTL Practice ;)

image

What is DNF?

Disjunctive normal form (DNF) - in Boolean logic is a normal form in which a Boolean formula has the form of a disjunction of conjunctions of literals. The formula of Any Boolean can be given in DNF.[1] To do this, you can use the law of double negation, De Morgan's law, and the law of distributivity. wiki

$\neg(A \lor B)=\neg A \land \neg B$ - De Morgan's law

$\neg(\neg A) = A$ - law of double negation

$A \land (B \lor C) = A \land B \lor A \land C$ - law of distributivity

What is DNF minimization?

DNF solves the problem of simplifying logical functions. But a function can have many DNFs. Let us denote the length of the DNF $L(F())$ as the number of variables used.

$F(x, y, z) = x \land \neg y \land z \lor x \land y$

$L(F(x, y, z)) = 5$

The minimum DNF has the shortest length $L(F())$. There may be several such DNFs

Minimization algorithm

A Boolean function can be uniquely specified by its number and number of variables. There are Boolean functions of $n$ variables $2^n$

  1. Convert the function number to double form and pad leading zeros to length $2^n$. This line will be a column of function values.
  2. Construct a table with all conjunctions.
  3. Cross out lines with value 0 in a column F
  4. In each column, cross out all sets that are numerically the same as those already crossed out.
  5. Use the law of absorption on the remaining sets.
  6. let's sort through all the DNFs from the remaining sets

$x \lor x \land y = x \land (1 \lor y) = x$ - law of absorption

image

Installation

  1. Clone the repo

    git clone https://github.com/LKolinko/DNFMinimizer
  2. Use cmake

    cd ./DNFMinimizer
    cmake .
    cmake --build ./
  3. Launch and enjoy :)

    ./dnf_minimizer

zhdun

dnfminimizer's People

Contributors

lkolinko 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.