The AND/OR/MOD_m basis -- definitions #
This module defines the unbounded-fan-in basis of AND, OR, and MOD_m gates
over which the classes AC^i[m] are built. A MOD_m gate outputs true
exactly when the number of its true inputs is not divisible by m. Because
negation is a free per-input flag, the complementary convention (true exactly
when the count is divisible by m) would define the same circuit classes: a
complemented MOD_m gate feeds its consumers through negated edges.
Main definitions #
AndOrModOp— AND, OR, andMOD_moperationsAndOrModOp.eval— their evaluation onninput bitsBasis.unboundedAndOrMod— the unbounded-fan-in AND/OR/MOD_mbasisBasis.andOrToAndOrModHom— every AND/OR gate is an AND/OR/MOD_mgate
Operations of the AND/OR/MOD_m basis. Negation is handled by per-input
flags on gates.
- andOr
(op : AndOrOp)
: AndOrModOp
An unbounded AND or OR operation.
- mod : AndOrModOp
The
MOD_moperation:trueiff the number of true inputs is not divisible bym.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Complexity.instReprAndOrModOp.repr Complexity.AndOrModOp.mod prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Complexity.AndOrModOp.mod")).group prec✝
Instances For
Equations
Equations
- Complexity.instDecidableEqAndOrModOp.decEq (Complexity.AndOrModOp.andOr a) (Complexity.AndOrModOp.andOr b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Complexity.instDecidableEqAndOrModOp.decEq (Complexity.AndOrModOp.andOr op) Complexity.AndOrModOp.mod = isFalse ⋯
- Complexity.instDecidableEqAndOrModOp.decEq Complexity.AndOrModOp.mod (Complexity.AndOrModOp.andOr op) = isFalse ⋯
- Complexity.instDecidableEqAndOrModOp.decEq Complexity.AndOrModOp.mod Complexity.AndOrModOp.mod = isTrue ⋯
Instances For
Evaluate an AND/OR/MOD_m operation on n input bits. AND and OR use
AndOrOp.eval; MOD_m outputs true exactly when the number of true inputs
is not divisible by m.
Equations
- Complexity.AndOrModOp.eval m (Complexity.AndOrModOp.andOr op) x✝¹ x✝ = op.eval x✝¹ x✝
- Complexity.AndOrModOp.eval m Complexity.AndOrModOp.mod x✝¹ x✝ = decide (Fin.countP x✝ % m ≠ 0)
Instances For
The basis of unbounded-fan-in AND, OR, and MOD_m gates. Negation is free
(per-input flags on gates).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Every unbounded AND/OR gate is an AND/OR/MOD_m gate with the same
semantics.
Equations
- Complexity.Basis.andOrToAndOrModHom m = { mapOp := fun (op : Complexity.Basis.unboundedAndOr.Op) (x : ℕ) => Complexity.AndOrModOp.andOr op, mapArity := ⋯, eval_map := ⋯ }