Documentation

CslibFrontier.Tactic.CircuitBound.Init

The attribute circuit_bound #

Declares the attribute circuit_bound and the table of bounds it fills, in a file of its own because an attribute cannot be used in the file declaring it. The tactic circuit_bound of CslibFrontier.Tactic.CircuitBound reads the table.

Main definitions #

set_option trace.circuit_bound true shows the registered bounds and hypotheses the tactic uses.

The simp set circuit_simps rewrites the function, the size, the program cost and the exact depths of a circuit built with combinators such as Circuit.comp, Circuit.append, Circuit.pi, Circuit.wiring, Circuit.oneGate and Formula.toCircuit to those of its parts. It unfolds no definition: name the construction's own definitions beside it, as in simp only [circuit_simps, step]. CslibFrontier.Computability.Circuit.Simps lists its lemmas.

Seven of them are general: Fin.append_left, Fin.append_right, Function.comp_apply, Finset.sum_const, Finset.card_univ, Fintype.card_fin and smul_eq_mul rewrite every matching subterm of the goal, not only what the circuit lemmas produce. A step that follows simp only [circuit_simps, …] and depends on the shape of the goal, such as congr or exact (Fin.append_left _ _ i).trans h, sees the goal after these rewrites.

The sides of a bound lhs ≤ rhs or a value lhs = rhs between natural numbers, and whether it is an equation.

@[circuit_bound] registers a theorem m ≤ b or m = b between natural numbers for the tactic circuit_bound, which uses it to bound m wherever m occurs in the quantity it bounds. Typical uses are the depth, size or cost of a named circuit, (adder w).depth ≤ 6, and the rule of a combinator, (d.comp c).depth ≤ d.depth + c.depth: the tactic goes on to bound the right-hand side.

A hypothesis ∀ j, m' j ≤ D whose bound D occurs nowhere on the left-hand side, as in (∀ j, (cs j).depth ≤ D) → (Circuit.pi cs).depth ≤ D, asks the tactic for a bound of m' j that does not depend on j. Any other hypothesis must be among the local hypotheses.

A tag on a private theorem is used in its own module only.