GitXplorerGitXplorer
f

boolform

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
05e1bfcebd7437f7b2a028f9ee6d30b9b94634d3

Theory of uint8 (#4)

ffrrad committed 6 years ago
Verified
ff00959ac753c396c262c8789b9bc71e7cb5409f

update docs (#3)

ffrrad committed 6 years ago
Verified
85e71a11b452fc54e8beaee87e1342e679edf62f

fix off by one (#2)

ffrrad committed 6 years ago
Verified
ff1ae71ef4ab89a2f74a078b00eba3a767c5aa49

SMT (#1)

ffrrad committed 6 years ago
Unverified
6c118e2ffe40a2cb7f40960376236a3de1c93219

fix bug, add Problem type

ffrrad committed 6 years ago
Unverified
2282669a3306ead3085dbcfbf442bd52232bc4f0

docstring

ffrrad committed 6 years ago

README

The README file for this repository.

The package bf (forked from crillab/gophersat/bf) allows for the specification of boolean formula and the translation of specified formulas into CNF.

The package smt lets the user specify constraints in a friendly form. There is also support for some higher-level theories built out of boolean variables.

There are also a helper packages bfgophersat, bfgini, bfgosat to take a formula created by bf and change it into problem instances for these solvers.

As a rule each of these helper packages has a Solve function if you are just interested in a solution, and a Export function that translates a given problem into a formula / solver instance which you can interact with in more interesting ways.

Solving a simple problem with all three solvers:

package bf

import (
	"fmt"

	"github.com/frrad/boolform/bf"
	"github.com/frrad/boolform/bfgini"
	"github.com/frrad/boolform/bfgophersat"
	"github.com/frrad/boolform/bfgosat"
)

func main() {
	x := bf.Var("x")
	y := bf.Var("y")
	z := bf.Var("z")
	f := bf.And(bf.And(x, y), bf.Not(z))

	fmt.Println(bfgophersat.Solve(f))
	fmt.Println(bfgosat.Solve(f))
	fmt.Println(bfgini.Solve(f))
}

Solving a bitvector problem with gosat:

package main

import (
	"fmt"

	solver "github.com/frrad/boolform/bfgosat"
	"github.com/frrad/boolform/smt"
)

func main() {
	prob := smt.NewProb()
	a := prob.NewBitVectConst([]bool{true, false, true, false})
	b := prob.NewBitVectConst([]bool{true, true, false, false})

	x := a.Or(b)
	y := a.And(b)
	prob.Solve(solver.Solve)

	fmt.Println(x.SolVal())
	fmt.Println(y.SolVal())
}