use-logic 0.0.1

Utility-first boolean algebra helpers for RustUse
Documentation

use-logic

Install

[dependencies]
use-logic = "0.0.1"

Foundation

use-logic provides a deliberately small boolean-helper surface. The crate currently exposes explicit helpers for material implication, equivalence, exclusive-or, NAND, NOR, and three-input majority logic. The API stays close to plain bool instead of wrapping truth values in extra types that do not add invariants.

Helper group Primary items Best fit
Binary relations implication, equivalence, exclusive_or Truth-table oriented code that should stay readable without ad hoc boolean expressions
Gate helpers nand, nor Boolean-algebra code that wants named derived operations
Majority logic majority Small vote or quorum rules over three predicates

When to use directly

Choose use-logic directly when predicate and boolean-structure helpers are the only surface you need and you want to keep that concern narrower than the umbrella facade.

Scenario Use use-logic directly? Why
You only need named boolean helpers Yes The crate stays smaller than the facade and keeps boolean intent explicit
You want small majority or truth-table helpers without a broader predicate framework Yes The API already covers the common binary and three-input cases directly
You also need geometry, combinatorics, or other math domains Usually no use-math can unify the concrete surfaces behind features

Scope

  • The current surface is intentionally small and concrete.
  • Helpers stay as const fn over bool rather than introducing wrapper types without added invariants.
  • Set operations and algebraic structures belong in adjacent focused crates.

Examples

Binary boolean helpers

use use_logic::{equivalence, exclusive_or, implication};

assert!(implication(false, true));
assert!(!implication(true, false));
assert!(equivalence(true, true));
assert!(exclusive_or(true, false));

Derived gates and majority logic

use use_logic::{majority, nand, nor};

assert!(!nand(true, true));
assert!(nor(false, false));
assert!(majority(true, true, false));
assert!(!majority(true, false, false));

Status

use-logic is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while adjacent set and algebra crates continue to grow around it.