1 [![Clippy Linting Result](https://clippy.bashy.io/github/oli-obk/quine-mc_cluskey/master/badge.svg)](https://clippy.bashy.io/github/oli-obk/quine-mc_cluskey/master/log)
2 [![Current Version](http://meritbadge.herokuapp.com/quine-mc_cluskey)](https://crates.io/crates/quine-mc_cluskey)
3 [![Build Status](https://travis-ci.org/oli-obk/quine-mc_cluskey.svg?branch=master)](https://travis-ci.org/oli-obk/quine-mc_cluskey)
5 An algorithm to automatically minimize boolean expressions.
10 extern crate quine_mc_cluskey;
12 use quine_mc_cluskey::*;
13 use quine_mc_cluskey::Bool::{And, Or, Not, True, False};
18 Not(Box::new(False)).simplify(),
24 And(vec![Bool::Term(0),
25 Or(vec![Bool::Term(1), Bool::Term(0)])]).simplify(), vec![Bool::Term(0)]
30 # Obtaining a minimal "and of or" form
32 Sometimes an expression of the form `a && (b || c)` is shorter than the `a && b || a && c` form.
33 We can simply negate the original expression and negate all the resulting simplified expressions to obtain that form.
36 extern crate quine_mc_cluskey;
37 use quine_mc_cluskey::Bool;
40 let a: Bool = Bool::And(vec![Bool::True, Bool::True]);
41 let simplified: Vec<Bool> = Bool::Not(Box::new(a)).simplify()
42 .iter().map(simple_negate).collect();
45 fn simple_negate(b: &Bool) -> Bool {
46 use quine_mc_cluskey::Bool::*;
52 t @ Term(_) => Not(Box::new(t)),
55 *el = simple_negate(el);
61 *el = simple_negate(el);